class IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::MemberApiModel

Attributes

description[RW]
email[RW]
emailConnects[RW]
firstName[RW]
id[RW]
isExternal[RW]
lastName[RW]
message[RW]
phone[RW]
socialAccounts[RW]
token[RW]
uuid[RW]

Public Class Methods

new(parsed_response = nil, is_new = true) click to toggle source
# 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"]
    add_socialAccounts(member_details["socialAccounts"])
    add_emailConnects(member_details["emailConnects"])
    @token = IdnSdkRuby::Com::Nbos::Capi::Api::V0::TokenApiModel.new(parsed_response["token"])
  end
end

Public Instance Methods

add_emailConnects(email_connects) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb, line 55
def add_messages(json_response)
  if json_response["message"].present?
    @message = json_response["message"]
  elsif json_response["error"].present?
    @message = json_response["error"]
  end

end
add_socialAccounts(accounts) click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb, line 29
def add_socialAccounts(accounts)
  @socialAccounts = []
  if accounts.size > 0
    accounts.each do |sp|
      @socialAccounts << IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::SocialAccountApiModel.new(sp)
    end
  end
end
as_json(options={}) click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb, line 64
def as_json(options={})
  {
      id: @id,
      email: @email,
      firstName: @firstName,
      lastName: @lastName,
      phone: @phone,
      description: @description,
      uuid: @uuid,
      isExternal: @isExternal,
      socialAccounts: @socialAccounts,
      emailConnects: @emailConnects,
      token: @token
  }
end
to_json(*options) click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb, line 80
def to_json(*options)
  as_json(*options).to_json(*options)
end
to_s() click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb, line 84
def to_s
  to_json
end