Class: SixSaferpay::Payer

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: nil, ip_address: nil, ip_location: nil, language_code: nil, delivery_address: nil, billing_address: nil) ⇒ Payer

Returns a new instance of Payer.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/six_saferpay/models/payer.rb', line 14

def initialize(
               id: nil,
               ip_address: nil,
               ip_location: nil,
               language_code: nil,
               delivery_address: nil,
               billing_address: nil
              )
  @id = id
  @ip_address = ip_address
  @ip_location = ip_location
  @language_code = language_code
  @delivery_address = SixSaferpay::DeliveryAddress.new(**delivery_address.to_h) if delivery_address
  @billing_address = SixSaferpay::BillingAddress.new(**billing_address.to_h) if billing_address
end

Instance Attribute Details

#billing_addressObject

Returns the value of attribute billing_address.



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

def billing_address
  @billing_address
end

#delivery_addressObject

Returns the value of attribute delivery_address.



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

def delivery_address
  @delivery_address
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#ip_addressObject

Returns the value of attribute ip_address.



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

def ip_address
  @ip_address
end

#ip_locationObject

Returns the value of attribute ip_location.



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

def ip_location
  @ip_location
end

#language_codeObject

Returns the value of attribute language_code.



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

def language_code
  @language_code
end

Instance Method Details

#to_hashObject Also known as: to_h



30
31
32
33
34
35
36
37
38
39
# File 'lib/six_saferpay/models/payer.rb', line 30

def to_hash
  hash = Hash.new
  hash.merge!(id: @id) if @id
  hash.merge!(ip_address: @ip_address) if @ip_address
  hash.merge!(ip_location: @ip_location) if @ip_location
  hash.merge!(language_code: @language_code) if @language_code
  hash.merge!(delivery_address: @delivery_address.to_h) if @delivery_address
  hash.merge!(billing_address: @billing_address.to_h) if @billing_address
  hash
end