Class: OnlinePayments::SDK::Domain::CurrencyConversionRequest

Inherits:
OnlinePayments::SDK::DataObject show all
Defined in:
lib/onlinepayments/sdk/domain/currency_conversion_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from OnlinePayments::SDK::DataObject

new_from_hash

Instance Attribute Details

#card_sourceOnlinePayments::SDK::Domain::DccCardSource

Returns the current value of card_source.

Returns:



13
14
15
# File 'lib/onlinepayments/sdk/domain/currency_conversion_request.rb', line 13

def card_source
  @card_source
end

#transactionOnlinePayments::SDK::Domain::Transaction

Returns the current value of transaction.

Returns:



13
14
15
# File 'lib/onlinepayments/sdk/domain/currency_conversion_request.rb', line 13

def transaction
  @transaction
end

Instance Method Details

#from_hash(hash) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/onlinepayments/sdk/domain/currency_conversion_request.rb', line 25

def from_hash(hash)
  super
  if hash.key? 'cardSource'
    raise TypeError, "value '%s' is not a Hash" % [hash['cardSource']] unless hash['cardSource'].is_a? Hash
    @card_source = OnlinePayments::SDK::Domain::DccCardSource.new_from_hash(hash['cardSource'])
  end
  if hash.key? 'transaction'
    raise TypeError, "value '%s' is not a Hash" % [hash['transaction']] unless hash['transaction'].is_a? Hash
    @transaction = OnlinePayments::SDK::Domain::Transaction.new_from_hash(hash['transaction'])
  end
end

#to_hHash

Returns:

  • (Hash)


18
19
20
21
22
23
# File 'lib/onlinepayments/sdk/domain/currency_conversion_request.rb', line 18

def to_h
  hash = super
  hash['cardSource'] = @card_source.to_h if @card_source
  hash['transaction'] = @transaction.to_h if @transaction
  hash
end