Class: OnlinePayments::SDK::Domain::CustomerToken

Inherits:
OnlinePayments::SDK::DataObject show all
Defined in:
lib/onlinepayments/sdk/domain/customer_token.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from OnlinePayments::SDK::DataObject

new_from_hash

Instance Attribute Details

#billing_addressOnlinePayments::SDK::Domain::Address

Returns the current value of billing_address.

Returns:



15
16
17
# File 'lib/onlinepayments/sdk/domain/customer_token.rb', line 15

def billing_address
  @billing_address
end

#company_informationOnlinePayments::SDK::Domain::CompanyInformation

Returns the current value of company_information.

Returns:



15
16
17
# File 'lib/onlinepayments/sdk/domain/customer_token.rb', line 15

def company_information
  @company_information
end

#personal_informationOnlinePayments::SDK::Domain::PersonalInformationToken

Returns the current value of personal_information.

Returns:



15
16
17
# File 'lib/onlinepayments/sdk/domain/customer_token.rb', line 15

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/onlinepayments/sdk/domain/customer_token.rb', line 29

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 = OnlinePayments::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 = OnlinePayments::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 = OnlinePayments::SDK::Domain::PersonalInformationToken.new_from_hash(hash['personalInformation'])
  end
end

#to_hHash

Returns:

  • (Hash)


21
22
23
24
25
26
27
# File 'lib/onlinepayments/sdk/domain/customer_token.rb', line 21

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