Class: PaymentsApi::Quote
- Defined in:
- lib/payments_api/models/quote.rb
Overview
Quote Information Object
Instance Attribute Summary collapse
-
#beneficiary_amount ⇒ Float
Amount to send in beneficiary currency.
-
#beneficiary_currency ⇒ String
Beneficiary currency code in ISO 4217 format.
-
#exchange_rate ⇒ Float
The exchange rate for the quote.
-
#id ⇒ Integer
Quote ID.
-
#locked ⇒ Boolean
Set to true if the quote rate is locked.
-
#originator_amount ⇒ Float
Amount to send in originator currency.
-
#originator_amount_is_fixed ⇒ Boolean
If true, then the originator amount is fixed to the provided value.
-
#revision ⇒ Integer
Quote revision number.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(beneficiary_currency = nil, id = nil, beneficiary_amount = nil, originator_amount = nil, originator_amount_is_fixed = nil, exchange_rate = nil, locked = nil, revision = nil) ⇒ Quote
constructor
A new instance of Quote.
Methods inherited from BaseModel
Constructor Details
#initialize(beneficiary_currency = nil, id = nil, beneficiary_amount = nil, originator_amount = nil, originator_amount_is_fixed = nil, exchange_rate = nil, locked = nil, revision = nil) ⇒ Quote
Returns a new instance of Quote.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/payments_api/models/quote.rb', line 61 def initialize(beneficiary_currency = nil, id = nil, beneficiary_amount = nil, originator_amount = nil, originator_amount_is_fixed = nil, exchange_rate = nil, locked = nil, revision = nil) @id = id @beneficiary_amount = beneficiary_amount @beneficiary_currency = beneficiary_currency @originator_amount = originator_amount @originator_amount_is_fixed = originator_amount_is_fixed @exchange_rate = exchange_rate @locked = locked @revision = revision end |
Instance Attribute Details
#beneficiary_amount ⇒ Float
Amount to send in beneficiary currency. Not required if originatorAmount is provided.
16 17 18 |
# File 'lib/payments_api/models/quote.rb', line 16 def beneficiary_amount @beneficiary_amount end |
#beneficiary_currency ⇒ String
Beneficiary currency code in ISO 4217 format
20 21 22 |
# File 'lib/payments_api/models/quote.rb', line 20 def beneficiary_currency @beneficiary_currency end |
#exchange_rate ⇒ Float
The exchange rate for the quote
36 37 38 |
# File 'lib/payments_api/models/quote.rb', line 36 def exchange_rate @exchange_rate end |
#id ⇒ Integer
Quote ID
11 12 13 |
# File 'lib/payments_api/models/quote.rb', line 11 def id @id end |
#locked ⇒ Boolean
Set to true if the quote rate is locked
40 41 42 |
# File 'lib/payments_api/models/quote.rb', line 40 def locked @locked end |
#originator_amount ⇒ Float
Amount to send in originator currency. Not required if beneficiaryAmount is provided
25 26 27 |
# File 'lib/payments_api/models/quote.rb', line 25 def originator_amount @originator_amount end |
#originator_amount_is_fixed ⇒ Boolean
If true, then the originator amount is fixed to the provided value. If false, then the beneficiary amount is fixed to the provided value. This field is automatically set based on whether the originator or beneficary amount was provided.
32 33 34 |
# File 'lib/payments_api/models/quote.rb', line 32 def originator_amount_is_fixed @originator_amount_is_fixed end |
#revision ⇒ Integer
Quote revision number. This is automatically incremented each time the quote is refreshed or updated, and starts from 1
45 46 47 |
# File 'lib/payments_api/models/quote.rb', line 45 def revision @revision end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/payments_api/models/quote.rb', line 80 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. beneficiary_currency = hash['beneficiaryCurrency'] id = hash['id'] beneficiary_amount = hash['beneficiaryAmount'] originator_amount = hash['originatorAmount'] originator_amount_is_fixed = hash['originatorAmountIsFixed'] exchange_rate = hash['exchangeRate'] locked = hash['locked'] revision = hash['revision'] # Create object from extracted values. Quote.new(beneficiary_currency, id, beneficiary_amount, originator_amount, originator_amount_is_fixed, exchange_rate, locked, revision) end |
.names ⇒ Object
A mapping from model property names to API property names.
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/payments_api/models/quote.rb', line 48 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['beneficiary_amount'] = 'beneficiaryAmount' @_hash['beneficiary_currency'] = 'beneficiaryCurrency' @_hash['originator_amount'] = 'originatorAmount' @_hash['originator_amount_is_fixed'] = 'originatorAmountIsFixed' @_hash['exchange_rate'] = 'exchangeRate' @_hash['locked'] = 'locked' @_hash['revision'] = 'revision' @_hash end |