Class: Ingenico::Connect::SDK::Domain::Token::CustomerToken

Inherits:
Definitions::CustomerBase show all
Defined in:
lib/ingenico/connect/sdk/domain/token/customer_token.rb

Overview

Direct Known Subclasses

CustomerTokenWithContactDetails

Instance Attribute Summary collapse

Attributes inherited from Definitions::CustomerBase

#company_information, #merchant_customer_id, #vat_number

Instance Method Summary collapse

Methods inherited from Ingenico::Connect::SDK::DataObject

new_from_hash

Instance Attribute Details

#billing_addressObject



17
18
19
# File 'lib/ingenico/connect/sdk/domain/token/customer_token.rb', line 17

def billing_address
  @billing_address
end

#personal_informationObject



20
21
22
# File 'lib/ingenico/connect/sdk/domain/token/customer_token.rb', line 20

def personal_information
  @personal_information
end

Instance Method Details

#from_hash(hash) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/ingenico/connect/sdk/domain/token/customer_token.rb', line 29

def from_hash(hash)
  super
  if hash.has_key?('billingAddress')
    if !(hash['billingAddress'].is_a? Hash)
      raise TypeError, "value '%s' is not a Hash" % [hash['billingAddress']]
    end
    @billing_address = Ingenico::Connect::SDK::Domain::Definitions::Address.new_from_hash(hash['billingAddress'])
  end
  if hash.has_key?('personalInformation')
    if !(hash['personalInformation'].is_a? Hash)
      raise TypeError, "value '%s' is not a Hash" % [hash['personalInformation']]
    end
    @personal_information = Ingenico::Connect::SDK::Domain::Token::PersonalInformationToken.new_from_hash(hash['personalInformation'])
  end
end

#to_hObject



22
23
24
25
26
27
# File 'lib/ingenico/connect/sdk/domain/token/customer_token.rb', line 22

def to_h
  hash = super
  add_to_hash(hash, 'billingAddress', @billing_address)
  add_to_hash(hash, 'personalInformation', @personal_information)
  hash
end