class Ingenico::Direct::SDK::Domain::CustomerToken

@attr [Ingenico::Direct::SDK::Domain::Address] billing_address @attr [Ingenico::Direct::SDK::Domain::CompanyInformation] company_information @attr [Ingenico::Direct::SDK::Domain::PersonalInformationToken] personal_information

Attributes

billing_address[RW]
company_information[RW]
personal_information[RW]

Public Instance Methods

from_hash(hash) click to toggle source
# File lib/ingenico/direct/sdk/domain/customer_token.rb, line 30
def from_hash(hash)
  super
  if hash.key? 'billingAddress'
    raise TypeError, "value '%s' is not a Hash" % [hash['billingAddress']] unless hash['billingAddress'].is_a? Hash
    @billing_address = Ingenico::Direct::SDK::Domain::Address.new_from_hash(hash['billingAddress'])
  end
  if hash.key? 'companyInformation'
    raise TypeError, "value '%s' is not a Hash" % [hash['companyInformation']] unless hash['companyInformation'].is_a? Hash
    @company_information = Ingenico::Direct::SDK::Domain::CompanyInformation.new_from_hash(hash['companyInformation'])
  end
  if hash.key? 'personalInformation'
    raise TypeError, "value '%s' is not a Hash" % [hash['personalInformation']] unless hash['personalInformation'].is_a? Hash
    @personal_information = Ingenico::Direct::SDK::Domain::PersonalInformationToken.new_from_hash(hash['personalInformation'])
  end
end
to_h() click to toggle source

@return (Hash)

Calls superclass method Ingenico::Direct::SDK::DataObject#to_h
# File lib/ingenico/direct/sdk/domain/customer_token.rb, line 22
def to_h
  hash = super
  hash['billingAddress'] = @billing_address.to_h if @billing_address
  hash['companyInformation'] = @company_information.to_h if @company_information
  hash['personalInformation'] = @personal_information.to_h if @personal_information
  hash
end