class Centaman::Service::UpdateMember
Attributes
address[R]
date_of_birth[R]
email[R]
first_name[R]
gender[R]
id[R]
is_primary[R]
last_name[R]
password[R]
phone[R]
Public Instance Methods
after_init(args)
click to toggle source
# File lib/centaman/service/update_member.rb, line 10 def after_init(args) @id = args[:id].try(:to_i) @first_name = args[:first_name].try(:squish) @last_name = args[:last_name].try(:squish) @address = args[:address].try(:symbolize_keys) @gender = args[:gender] @date_of_birth = args[:date_of_birth] @phone = args[:phone] @email = args[:email].try(:squish) @password = args[:password] @is_primary = args[:is_primary] end
build_object(resp)
click to toggle source
# File lib/centaman/service/update_member.rb, line 31 def build_object(resp) return update_error(resp) unless resp.respond_to?(:merge) @build_object ||= object_class.new(resp.merge(additional_hash_to_serialize_after_response)) end
endpoint()
click to toggle source
# File lib/centaman/service/update_member.rb, line 23 def endpoint "/member_services/Member/#{id}" end
object_class()
click to toggle source
# File lib/centaman/service/update_member.rb, line 27 def object_class Centaman::Object::Member end
options_hash()
click to toggle source
# File lib/centaman/service/update_member.rb, line 49 def options_hash options_hash_no_json.compact.to_json end
options_hash_no_json()
click to toggle source
# File lib/centaman/service/update_member.rb, line 36 def options_hash_no_json { 'FirstName' => first_name.try(:upcase), 'LastName' => last_name.try(:upcase), 'HomeAddress' => home_address, 'Gender' => gender, 'DateOfBirth' => date_of_birth, 'Email' => email.try(:upcase), 'Password' => password, 'IsPrimary' => is_primary } end
Private Instance Methods
home_address()
click to toggle source
# File lib/centaman/service/update_member.rb, line 55 def home_address return if !address { 'street1': address[:street_address].try(:squish).try(:upcase), 'street2': address[:street_address_two].try(:squish).try(:upcase), 'suburb': address[:suburb].try(:squish).try(:upcase), 'city': address[:city].try(:squish).try(:upcase), 'state': address[:state].try(:squish).try(:upcase), 'postcode': address[:zip].try(:squish).try(:upcase), 'country': address[:country].try(:squish).try(:upcase), 'homePhone': phone.try(:delete, "^0-9"), 'workPhone': address[:work_phone].try(:delete, "^0-9"), 'mobilePhone': address[:mobile_phone].try(:delete, "^0-9") } end
update_error(resp)
click to toggle source
# File lib/centaman/service/update_member.rb, line 71 def update_error(resp) message = resp.parsed_response || 'Unable to update member record.' raise Centaman::Exceptions::CentamanError.new(message) end