Class: Raas::CurrencyBreakdownModel
- Defined in:
- lib/raas/models/currency_breakdown_model.rb
Overview
Represents a breakdown of an amount and currency information
Instance Attribute Summary collapse
-
#currency_code ⇒ String
A 3 digit currency code.
-
#exchange_rate ⇒ Float
The exchange rate.
-
#fee ⇒ Float
The amount of the fee applied.
-
#total ⇒ Float
The order total.
-
#value ⇒ Float
The value of the order.
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(currency_code = nil, exchange_rate = nil, fee = nil, total = nil, value = nil) ⇒ CurrencyBreakdownModel
constructor
A new instance of CurrencyBreakdownModel.
Methods inherited from BaseModel
Constructor Details
#initialize(currency_code = nil, exchange_rate = nil, fee = nil, total = nil, value = nil) ⇒ CurrencyBreakdownModel
Returns a new instance of CurrencyBreakdownModel.
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/raas/models/currency_breakdown_model.rb', line 38 def initialize(currency_code = nil, exchange_rate = nil, fee = nil, total = nil, value = nil) @currency_code = currency_code @exchange_rate = exchange_rate @fee = fee @total = total @value = value end |
Instance Attribute Details
#currency_code ⇒ String
A 3 digit currency code
9 10 11 |
# File 'lib/raas/models/currency_breakdown_model.rb', line 9 def currency_code @currency_code end |
#exchange_rate ⇒ Float
The exchange rate
13 14 15 |
# File 'lib/raas/models/currency_breakdown_model.rb', line 13 def exchange_rate @exchange_rate end |
#fee ⇒ Float
The amount of the fee applied
17 18 19 |
# File 'lib/raas/models/currency_breakdown_model.rb', line 17 def fee @fee end |
#total ⇒ Float
The order total
21 22 23 |
# File 'lib/raas/models/currency_breakdown_model.rb', line 21 def total @total end |
#value ⇒ Float
The value of the order
25 26 27 |
# File 'lib/raas/models/currency_breakdown_model.rb', line 25 def value @value end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/raas/models/currency_breakdown_model.rb', line 51 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. currency_code = hash['currencyCode'] exchange_rate = hash['exchangeRate'] fee = hash['fee'] total = hash['total'] value = hash['value'] # Create object from extracted values. CurrencyBreakdownModel.new(currency_code, exchange_rate, fee, total, value) end |
.names ⇒ Object
A mapping from model property names to API property names.
28 29 30 31 32 33 34 35 36 |
# File 'lib/raas/models/currency_breakdown_model.rb', line 28 def self.names @_hash = {} if @_hash.nil? @_hash['currency_code'] = 'currencyCode' @_hash['exchange_rate'] = 'exchangeRate' @_hash['fee'] = 'fee' @_hash['total'] = 'total' @_hash['value'] = 'value' @_hash end |