Class: Ingenico::Connect::SDK::Domain::Payment::PersonalInformation

Inherits:
Ingenico::Connect::SDK::DataObject show all
Defined in:
lib/ingenico/connect/sdk/domain/payment/personal_information.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

new_from_hash

Instance Attribute Details

#date_of_birthObject

String



15
16
17
# File 'lib/ingenico/connect/sdk/domain/payment/personal_information.rb', line 15

def date_of_birth
  @date_of_birth
end

#genderObject

String



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

def gender
  @gender
end

#nameObject



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

def name
  @name
end

Instance Method Details

#from_hash(hash) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/ingenico/connect/sdk/domain/payment/personal_information.rb', line 31

def from_hash(hash)
  super
  if hash.has_key?('dateOfBirth')
    @date_of_birth = hash['dateOfBirth']
  end
  if hash.has_key?('gender')
    @gender = hash['gender']
  end
  if hash.has_key?('name')
    if !(hash['name'].is_a? Hash)
      raise TypeError, "value '%s' is not a Hash" % [hash['name']]
    end
    @name = Ingenico::Connect::SDK::Domain::Payment::PersonalName.new_from_hash(hash['name'])
  end
end

#to_hObject



23
24
25
26
27
28
29
# File 'lib/ingenico/connect/sdk/domain/payment/personal_information.rb', line 23

def to_h
  hash = super
  add_to_hash(hash, 'dateOfBirth', @date_of_birth)
  add_to_hash(hash, 'gender', @gender)
  add_to_hash(hash, 'name', @name)
  hash
end