Class: Raas::CurrencyBreakdownModel
- Defined in:
- lib/raas/models/currency_breakdown_model.rb
Instance Attribute Summary collapse
-
#currency_code ⇒ String
Currency Code.
-
#exchange_rate ⇒ Float
Exchange Rate.
-
#fee ⇒ Float
Fee.
-
#total ⇒ Float
Total.
-
#value ⇒ Float
Value.
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
Currency Code
7 8 9 |
# File 'lib/raas/models/currency_breakdown_model.rb', line 7 def currency_code @currency_code end |
#exchange_rate ⇒ Float
Exchange Rate
11 12 13 |
# File 'lib/raas/models/currency_breakdown_model.rb', line 11 def exchange_rate @exchange_rate end |
#fee ⇒ Float
Fee
15 16 17 |
# File 'lib/raas/models/currency_breakdown_model.rb', line 15 def fee @fee end |
#total ⇒ Float
Total
19 20 21 |
# File 'lib/raas/models/currency_breakdown_model.rb', line 19 def total @total end |
#value ⇒ Float
Value
23 24 25 |
# File 'lib/raas/models/currency_breakdown_model.rb', line 23 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
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/raas/models/currency_breakdown_model.rb', line 26 def self.names if @_hash.nil? @_hash = {} @_hash["currency_code"] = "currencyCode" @_hash["exchange_rate"] = "exchangeRate" @_hash["fee"] = "fee" @_hash["total"] = "total" @_hash["value"] = "value" end @_hash end |