Class: Cb::Clients::User
- Inherits:
-
Object
- Object
- Cb::Clients::User
- Defined in:
- lib/cb/clients/user.rb
Class Method Summary collapse
- .change_password(external_id, old_password, new_password, test_mode = false) ⇒ Object
- .check_existing(email, password) ⇒ Object
- .delete(external_id, password, test_mode = false) ⇒ Object
- .retrieve(external_id, test_mode = false) ⇒ Object
Class Method Details
.change_password(external_id, old_password, new_password, test_mode = false) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/cb/clients/user.rb', line 28 def change_password external_id, old_password, new_password, test_mode = false result = false my_api = Cb::Utils::Api.new json_hash = my_api.cb_post Cb.configuration.uri_user_change_password, :body => build_change_password_request(external_id, old_password, new_password, test_mode) if json_hash.has_key? 'ResponseUserChangePW' if json_hash['ResponseUserChangePW'].has_key?('Status') && json_hash['ResponseUserChangePW']['Status'].include?('Success') result = true end my_api.append_api_responses result, json_hash['ResponseUserChangePW'] end my_api.append_api_responses result, json_hash end |
.check_existing(email, password) ⇒ Object
9 10 11 12 13 |
# File 'lib/cb/clients/user.rb', line 9 def check_existing(email, password) xml = build_check_existing_request(email, password) response = api_client.cb_post(Cb.configuration.uri_user_check_existing, body: xml) Cb::Responses::User::CheckExisting.new(response) end |
.delete(external_id, password, test_mode = false) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/cb/clients/user.rb', line 43 def delete external_id, password, test_mode = false result = false my_api = Cb::Utils::Api.new json_hash = my_api.cb_post Cb.configuration.uri_user_delete, :body => build_delete_request(external_id, password, test_mode) if json_hash.has_key? 'ResponseUserDelete' if json_hash['ResponseUserDelete'].has_key?('Status') && json_hash['ResponseUserDelete']['Status'].include?('Success') result = true end my_api.append_api_responses result, json_hash['ResponseUserDelete'] end my_api.append_api_responses result, json_hash end |
.retrieve(external_id, test_mode = false) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/cb/clients/user.rb', line 15 def retrieve external_id, test_mode = false my_api = Cb::Utils::Api.new json_hash = my_api.cb_post Cb.configuration.uri_user_retrieve, :body => build_retrieve_request(external_id, true) if json_hash.has_key? 'ResponseUserInfo' if json_hash['ResponseUserInfo'].has_key? 'UserInfo' user = Models::User.new json_hash['ResponseUserInfo']['UserInfo'] end my_api.append_api_responses user, json_hash['ResponseUserInfo'] end my_api.append_api_responses user, json_hash end |