Class: Ingenico::Connect::SDK::Domain::Payment::Customer

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

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



18
19
20
# File 'lib/ingenico/connect/sdk/domain/payment/customer.rb', line 18

def billing_address
  @billing_address
end

#contact_detailsObject



21
22
23
# File 'lib/ingenico/connect/sdk/domain/payment/customer.rb', line 21

def contact_details
  @contact_details
end

#fiscal_numberObject

String



24
25
26
# File 'lib/ingenico/connect/sdk/domain/payment/customer.rb', line 24

def fiscal_number
  @fiscal_number
end

#localeObject

String



27
28
29
# File 'lib/ingenico/connect/sdk/domain/payment/customer.rb', line 27

def locale
  @locale
end

#personal_informationObject



30
31
32
# File 'lib/ingenico/connect/sdk/domain/payment/customer.rb', line 30

def personal_information
  @personal_information
end

#shipping_addressObject



33
34
35
# File 'lib/ingenico/connect/sdk/domain/payment/customer.rb', line 33

def shipping_address
  @shipping_address
end

Instance Method Details

#from_hash(hash) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/ingenico/connect/sdk/domain/payment/customer.rb', line 46

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?('contactDetails')
    if !(hash['contactDetails'].is_a? Hash)
      raise TypeError, "value '%s' is not a Hash" % [hash['contactDetails']]
    end
    @contact_details = Ingenico::Connect::SDK::Domain::Payment::ContactDetails.new_from_hash(hash['contactDetails'])
  end
  if hash.has_key?('fiscalNumber')
    @fiscal_number = hash['fiscalNumber']
  end
  if hash.has_key?('locale')
    @locale = hash['locale']
  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::Payment::PersonalInformation.new_from_hash(hash['personalInformation'])
  end
  if hash.has_key?('shippingAddress')
    if !(hash['shippingAddress'].is_a? Hash)
      raise TypeError, "value '%s' is not a Hash" % [hash['shippingAddress']]
    end
    @shipping_address = Ingenico::Connect::SDK::Domain::Payment::AddressPersonal.new_from_hash(hash['shippingAddress'])
  end
end

#to_hObject



35
36
37
38
39
40
41
42
43
44
# File 'lib/ingenico/connect/sdk/domain/payment/customer.rb', line 35

def to_h
  hash = super
  add_to_hash(hash, 'billingAddress', @billing_address)
  add_to_hash(hash, 'contactDetails', @contact_details)
  add_to_hash(hash, 'fiscalNumber', @fiscal_number)
  add_to_hash(hash, 'locale', @locale)
  add_to_hash(hash, 'personalInformation', @personal_information)
  add_to_hash(hash, 'shippingAddress', @shipping_address)
  hash
end