Class: OnlinePayments::SDK::Domain::CurrencyConversion

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from OnlinePayments::SDK::DataObject

new_from_hash

Instance Attribute Details

#accepted_by_usertrue/false

Returns the current value of accepted_by_user.

Returns:

  • (true/false)

    the current value of accepted_by_user



12
13
14
# File 'lib/onlinepayments/sdk/domain/currency_conversion.rb', line 12

def accepted_by_user
  @accepted_by_user
end

#proposalOnlinePayments::SDK::Domain::DccProposal

Returns the current value of proposal.

Returns:



12
13
14
# File 'lib/onlinepayments/sdk/domain/currency_conversion.rb', line 12

def proposal
  @proposal
end

Instance Method Details

#from_hash(hash) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/onlinepayments/sdk/domain/currency_conversion.rb', line 24

def from_hash(hash)
  super
  @accepted_by_user = hash['acceptedByUser'] if hash.key? 'acceptedByUser'
  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
end

#to_hHash

Returns:

  • (Hash)


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

def to_h
  hash = super
  hash['acceptedByUser'] = @accepted_by_user unless @accepted_by_user.nil?
  hash['proposal'] = @proposal.to_h if @proposal
  hash
end