Class: Ingenico::Direct::SDK::Domain::CustomerToken

Inherits:
Ingenico::Direct::SDK::DataObject show all
Defined in:
lib/ingenico/direct/sdk/domain/customer_token.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Ingenico::Direct::SDK::DataObject

new_from_hash

Instance Attribute Details

#billing_addressIngenico::Direct::SDK::Domain::Address

Returns the current value of billing_address.

Returns:



16
17
18
# File 'lib/ingenico/direct/sdk/domain/customer_token.rb', line 16

def billing_address
  @billing_address
end

#company_informationIngenico::Direct::SDK::Domain::CompanyInformation

Returns the current value of company_information.

Returns:



16
17
18
# File 'lib/ingenico/direct/sdk/domain/customer_token.rb', line 16

def company_information
  @company_information
end

#personal_informationIngenico::Direct::SDK::Domain::PersonalInformationToken

Returns the current value of personal_information.

Returns:



16
17
18
# File 'lib/ingenico/direct/sdk/domain/customer_token.rb', line 16

def personal_information
  @personal_information
end

Instance Method Details

#from_hash(hash) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# 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_hHash

Returns:

  • (Hash)


22
23
24
25
26
27
28
# 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