Class: IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::MemberApiModel
- Inherits:
-
BasicActiveModel
- Object
- BasicActiveModel
- IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::MemberApiModel
- Defined in:
- lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#email ⇒ Object
Returns the value of attribute email.
-
#emailConnects ⇒ Object
Returns the value of attribute emailConnects.
-
#firstName ⇒ Object
Returns the value of attribute firstName.
-
#id ⇒ Object
Returns the value of attribute id.
-
#isExternal ⇒ Object
Returns the value of attribute isExternal.
-
#lastName ⇒ Object
Returns the value of attribute lastName.
-
#message ⇒ Object
Returns the value of attribute message.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#socialAccounts ⇒ Object
Returns the value of attribute socialAccounts.
-
#token ⇒ Object
Returns the value of attribute token.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
Instance Method Summary collapse
- #add_emailConnects(email_connects) ⇒ Object
- #add_errors(json_response) ⇒ Object
- #add_messages(json_response) ⇒ Object
- #add_socialAccounts(accounts) ⇒ Object
- #as_json(options = {}) ⇒ Object
-
#initialize(parsed_response = nil, is_new = true) ⇒ MemberApiModel
constructor
A new instance of MemberApiModel.
- #to_json(*options) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(parsed_response = nil, is_new = true) ⇒ MemberApiModel
Returns a new instance of MemberApiModel.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb', line 12 def initialize(parsed_response = nil, is_new = true) if !parsed_response.nil? member_details = is_new ? parsed_response["member"] : parsed_response @isExternal = member_details["isExternal"] @id = member_details["id"] @uuid = member_details["uuid"] @description = member_details["description"] @email = member_details["email"] @firstName = member_details["firstName"] @lastName = member_details["lastName"] @phone = member_details["phone"] (member_details["socialAccounts"]) add_emailConnects(member_details["emailConnects"]) @token = IdnSdkRuby::Com::Nbos::Capi::Api::V0::TokenApiModel.new(parsed_response["token"]) end end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
9 10 11 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb', line 9 def description @description end |
#email ⇒ Object
Returns the value of attribute email.
9 10 11 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb', line 9 def email @email end |
#emailConnects ⇒ Object
Returns the value of attribute emailConnects.
9 10 11 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb', line 9 def emailConnects @emailConnects end |
#firstName ⇒ Object
Returns the value of attribute firstName.
9 10 11 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb', line 9 def firstName @firstName end |
#id ⇒ Object
Returns the value of attribute id.
9 10 11 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb', line 9 def id @id end |
#isExternal ⇒ Object
Returns the value of attribute isExternal.
9 10 11 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb', line 9 def isExternal @isExternal end |
#lastName ⇒ Object
Returns the value of attribute lastName.
9 10 11 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb', line 9 def lastName @lastName end |
#message ⇒ Object
Returns the value of attribute message.
9 10 11 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb', line 9 def end |
#phone ⇒ Object
Returns the value of attribute phone.
9 10 11 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb', line 9 def phone @phone end |
#socialAccounts ⇒ Object
Returns the value of attribute socialAccounts.
9 10 11 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb', line 9 def end |
#token ⇒ Object
Returns the value of attribute token.
9 10 11 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb', line 9 def token @token end |
#uuid ⇒ Object
Returns the value of attribute uuid.
9 10 11 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb', line 9 def uuid @uuid end |
Instance Method Details
#add_emailConnects(email_connects) ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb', line 38 def add_emailConnects(email_connects) @emailConnects = [] if email_connects.size > 0 email_connects.each do |ec| @emailConnects << IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::EmailConnectApiModel.new(ec) end end end |
#add_errors(json_response) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb', line 47 def add_errors(json_response) json_response["errors"].each do |e| property_name = e['propertyName'] msg = e['message'] self.errors[property_name] << msg end end |
#add_messages(json_response) ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb', line 55 def (json_response) if json_response["message"].present? = json_response["message"] elsif json_response["error"].present? = json_response["error"] end end |
#add_socialAccounts(accounts) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb', line 29 def (accounts) = [] if accounts.size > 0 accounts.each do |sp| << IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::SocialAccountApiModel.new(sp) end end end |
#as_json(options = {}) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb', line 64 def as_json(={}) { id: @id, email: @email, firstName: @firstName, lastName: @lastName, phone: @phone, description: @description, uuid: @uuid, isExternal: @isExternal, socialAccounts: , emailConnects: @emailConnects, token: @token } end |
#to_json(*options) ⇒ Object
80 81 82 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb', line 80 def to_json(*) as_json(*).to_json(*) end |
#to_s ⇒ Object
84 85 86 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb', line 84 def to_s to_json end |