Class: OnlinePayments::SDK::Domain::CurrencyConversionResponse

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from OnlinePayments::SDK::DataObject

new_from_hash

Instance Attribute Details

#dcc_session_idString

Returns the current value of dcc_session_id.

Returns:

  • (String)

    the current value of dcc_session_id



14
15
16
# File 'lib/onlinepayments/sdk/domain/currency_conversion_response.rb', line 14

def dcc_session_id
  @dcc_session_id
end

#proposalOnlinePayments::SDK::Domain::DccProposal

Returns the current value of proposal.

Returns:



14
15
16
# File 'lib/onlinepayments/sdk/domain/currency_conversion_response.rb', line 14

def proposal
  @proposal
end

#resultOnlinePayments::SDK::Domain::CurrencyConversionResult

Returns the current value of result.

Returns:



14
15
16
# File 'lib/onlinepayments/sdk/domain/currency_conversion_response.rb', line 14

def result
  @result
end

Instance Method Details

#from_hash(hash) ⇒ Object



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

def from_hash(hash)
  super
  @dcc_session_id = hash['dccSessionId'] if hash.key? 'dccSessionId'
  if hash.key? 'proposal'
    raise TypeError, "value '%s' is not a Hash" % [hash['proposal']] unless hash['proposal'].is_a? Hash
    @proposal = OnlinePayments::SDK::Domain::DccProposal.new_from_hash(hash['proposal'])
  end
  if hash.key? 'result'
    raise TypeError, "value '%s' is not a Hash" % [hash['result']] unless hash['result'].is_a? Hash
    @result = OnlinePayments::SDK::Domain::CurrencyConversionResult.new_from_hash(hash['result'])
  end
end

#to_hHash

Returns:

  • (Hash)


20
21
22
23
24
25
26
# File 'lib/onlinepayments/sdk/domain/currency_conversion_response.rb', line 20

def to_h
  hash = super
  hash['dccSessionId'] = @dcc_session_id unless @dcc_session_id.nil?
  hash['proposal'] = @proposal.to_h if @proposal
  hash['result'] = @result.to_h if @result
  hash
end