Class: OnlinePayments::SDK::Domain::ApiParameters

Inherits:
DataObject
  • Object
show all
Defined in:
lib/onlinepayments/sdk/domain/api_parameters.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DataObject

new_from_hash

Instance Attribute Details

#amexOnlinePayments::SDK::Domain::Amex?

Returns the current value of amex.

Returns:



18
19
20
# File 'lib/onlinepayments/sdk/domain/api_parameters.rb', line 18

def amex
  @amex
end

#cbOnlinePayments::SDK::Domain::PaymentProduct5002defaultBrandParameters?

Returns the current value of cb.

Returns:



18
19
20
# File 'lib/onlinepayments/sdk/domain/api_parameters.rb', line 18

def cb
  @cb
end

#eftposOnlinePayments::SDK::Domain::PaymentProduct5002defaultBrandParameters?

Returns the current value of eftpos.

Returns:



18
19
20
# File 'lib/onlinepayments/sdk/domain/api_parameters.rb', line 18

def eftpos
  @eftpos
end

#mastercardOnlinePayments::SDK::Domain::Mastercard?

Returns the current value of mastercard.

Returns:



18
19
20
# File 'lib/onlinepayments/sdk/domain/api_parameters.rb', line 18

def mastercard
  @mastercard
end

#visaOnlinePayments::SDK::Domain::Visa?

Returns the current value of visa.

Returns:



18
19
20
# File 'lib/onlinepayments/sdk/domain/api_parameters.rb', line 18

def visa
  @visa
end

Instance Method Details

#from_hash(hash) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/onlinepayments/sdk/domain/api_parameters.rb', line 41

def from_hash(hash)
  super
  if hash.has_key? 'amex'
    raise TypeError, "value '%s' is not a Hash" % [hash['amex']] unless hash['amex'].is_a? Hash
    @amex = OnlinePayments::SDK::Domain::Amex.new_from_hash(hash['amex'])
  end
  if hash.has_key? 'cb'
    raise TypeError, "value '%s' is not a Hash" % [hash['cb']] unless hash['cb'].is_a? Hash
    @cb = OnlinePayments::SDK::Domain::PaymentProduct5002defaultBrandParameters.new_from_hash(hash['cb'])
  end
  if hash.has_key? 'eftpos'
    raise TypeError, "value '%s' is not a Hash" % [hash['eftpos']] unless hash['eftpos'].is_a? Hash
    @eftpos = OnlinePayments::SDK::Domain::PaymentProduct5002defaultBrandParameters.new_from_hash(hash['eftpos'])
  end
  if hash.has_key? 'mastercard'
    raise TypeError, "value '%s' is not a Hash" % [hash['mastercard']] unless hash['mastercard'].is_a? Hash
    @mastercard = OnlinePayments::SDK::Domain::Mastercard.new_from_hash(hash['mastercard'])
  end
  if hash.has_key? 'visa'
    raise TypeError, "value '%s' is not a Hash" % [hash['visa']] unless hash['visa'].is_a? Hash
    @visa = OnlinePayments::SDK::Domain::Visa.new_from_hash(hash['visa'])
  end
end

#to_hHash

Returns:

  • (Hash)


31
32
33
34
35
36
37
38
39
# File 'lib/onlinepayments/sdk/domain/api_parameters.rb', line 31

def to_h
  hash = super
  hash['amex'] = @amex.to_h unless @amex.nil?
  hash['cb'] = @cb.to_h unless @cb.nil?
  hash['eftpos'] = @eftpos.to_h unless @eftpos.nil?
  hash['mastercard'] = @mastercard.to_h unless @mastercard.nil?
  hash['visa'] = @visa.to_h unless @visa.nil?
  hash
end