Class: PaypalServerSdk::ExchangeRate
- Defined in:
- lib/paypal_server_sdk/models/exchange_rate.rb
Overview
The exchange rate that determines the amount to convert from one currency to another currency.
Instance Attribute Summary collapse
-
#source_currency ⇒ String
The [three-character ISO-4217 currency code](/api/rest/reference/currency-codes/) that identifies the currency.
-
#target_currency ⇒ String
The [three-character ISO-4217 currency code](/api/rest/reference/currency-codes/) that identifies the currency.
-
#value ⇒ String
The target currency amount.
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.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(source_currency: SKIP, target_currency: SKIP, value: SKIP) ⇒ ExchangeRate
constructor
A new instance of ExchangeRate.
Methods inherited from BaseModel
Constructor Details
#initialize(source_currency: SKIP, target_currency: SKIP, value: SKIP) ⇒ ExchangeRate
Returns a new instance of ExchangeRate.
52 53 54 55 56 |
# File 'lib/paypal_server_sdk/models/exchange_rate.rb', line 52 def initialize(source_currency: SKIP, target_currency: SKIP, value: SKIP) @source_currency = source_currency unless source_currency == SKIP @target_currency = target_currency unless target_currency == SKIP @value = value unless value == SKIP end |
Instance Attribute Details
#source_currency ⇒ String
The [three-character ISO-4217 currency code](/api/rest/reference/currency-codes/) that identifies the currency.
16 17 18 |
# File 'lib/paypal_server_sdk/models/exchange_rate.rb', line 16 def source_currency @source_currency end |
#target_currency ⇒ String
The [three-character ISO-4217 currency code](/api/rest/reference/currency-codes/) that identifies the currency.
21 22 23 |
# File 'lib/paypal_server_sdk/models/exchange_rate.rb', line 21 def target_currency @target_currency end |
#value ⇒ String
The target currency amount. Equivalent to one unit of the source currency. Formatted as integer or decimal value with one to 15 digits to the right of the decimal point.
27 28 29 |
# File 'lib/paypal_server_sdk/models/exchange_rate.rb', line 27 def value @value end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/paypal_server_sdk/models/exchange_rate.rb', line 59 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. source_currency = hash.key?('source_currency') ? hash['source_currency'] : SKIP target_currency = hash.key?('target_currency') ? hash['target_currency'] : SKIP value = hash.key?('value') ? hash['value'] : SKIP # Create object from extracted values. ExchangeRate.new(source_currency: source_currency, target_currency: target_currency, value: value) end |
.names ⇒ Object
A mapping from model property names to API property names.
30 31 32 33 34 35 36 |
# File 'lib/paypal_server_sdk/models/exchange_rate.rb', line 30 def self.names @_hash = {} if @_hash.nil? @_hash['source_currency'] = 'source_currency' @_hash['target_currency'] = 'target_currency' @_hash['value'] = 'value' @_hash end |
.nullables ⇒ Object
An array for nullable fields
48 49 50 |
# File 'lib/paypal_server_sdk/models/exchange_rate.rb', line 48 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
39 40 41 42 43 44 45 |
# File 'lib/paypal_server_sdk/models/exchange_rate.rb', line 39 def self.optionals %w[ source_currency target_currency value ] end |