Class: SixSaferpay::Address

Inherits:
Object
  • Object
show all
Defined in:
lib/six_saferpay/models/address.rb

Direct Known Subclasses

BillingAddress, DeliveryAddress

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(first_name: nil, last_name: nil, date_of_birth: nil, company: nil, gender: nil, legal_form: nil, street: nil, street2: nil, zip: nil, city: nil, country_subdevision_code: nil, country_code: nil, phone: nil, email: nil) ⇒ Address

Returns a new instance of Address.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/six_saferpay/models/address.rb', line 21

def initialize(first_name: nil,
              last_name: nil,
              date_of_birth: nil,
              company: nil,
              gender: nil,
              legal_form: nil,
              street: nil,
              street2: nil,
              zip: nil,
              city: nil,
              country_subdevision_code: nil,
              country_code: nil,
              phone: nil,
              email: nil
             )
  @first_name = first_name
  @last_name = last_name
  @date_of_birth = date_of_birth
  @company = company
  @gender = gender
  @legal_form = legal_form
  @street = street
  @street2 = street2
  @zip = zip
  @city = city
  @country_subdevision_code = country_subdevision_code
  @country_code = country_code
  @phone = phone
  @email = email
end

Instance Attribute Details

#cityObject

Returns the value of attribute city.



4
5
6
# File 'lib/six_saferpay/models/address.rb', line 4

def city
  @city
end

#companyObject

Returns the value of attribute company.



4
5
6
# File 'lib/six_saferpay/models/address.rb', line 4

def company
  @company
end

#country_codeObject

Returns the value of attribute country_code.



4
5
6
# File 'lib/six_saferpay/models/address.rb', line 4

def country_code
  @country_code
end

#country_subdevision_codeObject

Returns the value of attribute country_subdevision_code.



4
5
6
# File 'lib/six_saferpay/models/address.rb', line 4

def country_subdevision_code
  @country_subdevision_code
end

#date_of_birthObject

Returns the value of attribute date_of_birth.



4
5
6
# File 'lib/six_saferpay/models/address.rb', line 4

def date_of_birth
  @date_of_birth
end

#first_nameObject

Returns the value of attribute first_name.



4
5
6
# File 'lib/six_saferpay/models/address.rb', line 4

def first_name
  @first_name
end

#genderObject

Returns the value of attribute gender.



4
5
6
# File 'lib/six_saferpay/models/address.rb', line 4

def gender
  @gender
end

#last_nameObject

Returns the value of attribute last_name.



4
5
6
# File 'lib/six_saferpay/models/address.rb', line 4

def last_name
  @last_name
end

Returns the value of attribute legal_form.



4
5
6
# File 'lib/six_saferpay/models/address.rb', line 4

def legal_form
  @legal_form
end

#phoneObject

Returns the value of attribute phone.



4
5
6
# File 'lib/six_saferpay/models/address.rb', line 4

def phone
  @phone
end

#streetObject

Returns the value of attribute street.



4
5
6
# File 'lib/six_saferpay/models/address.rb', line 4

def street
  @street
end

#street2Object

Returns the value of attribute street2.



4
5
6
# File 'lib/six_saferpay/models/address.rb', line 4

def street2
  @street2
end

#zipObject

Returns the value of attribute zip.



4
5
6
# File 'lib/six_saferpay/models/address.rb', line 4

def zip
  @zip
end

Instance Method Details

#to_hashObject Also known as: to_h



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/six_saferpay/models/address.rb', line 52

def to_hash
  hash = Hash.new
  hash.merge!(first_name: @first_name) if @first_name
  hash.merge!(last_name: @last_name) if @last_name
  hash.merge!(date_of_birth: @date_of_birth) if @date_of_birth
  hash.merge!(company: @company) if @company
  hash.merge!(gender: @gender) if @gender
  hash.merge!(legal_form: @legal_form) if @legal_form
  hash.merge!(street: @street) if @street
  hash.merge!(street2: @street2) if @street2.present?
  hash.merge!(zip: @zip) if @zip
  hash.merge!(city: @city) if @city
  hash.merge!(country_subdevision_code: @country_subdevision_code) if @country_subdevision_code
  hash.merge!(country_code: @country_code) if @country_code
  hash.merge!(phone: @phone) if @phone
  hash.merge!(email: @email) if @email
  hash
end