Class: Spree::Conekta::Exchange
- Inherits:
-
Object
- Object
- Spree::Conekta::Exchange
- Defined in:
- lib/spree/conekta/exchange.rb
Constant Summary collapse
- EXCHANCE_SERVICES =
'https://currency-api.appspot.com/api/'
Instance Method Summary collapse
- #amount_exchanged ⇒ Object
-
#initialize(amount, currency_from) ⇒ Exchange
constructor
A new instance of Exchange.
Constructor Details
#initialize(amount, currency_from) ⇒ Exchange
Returns a new instance of Exchange.
6 7 8 9 10 |
# File 'lib/spree/conekta/exchange.rb', line 6 def initialize(amount, currency_from) @amount = (amount.to_i) @currency_from = currency_from get_exchange_rate end |
Instance Method Details
#amount_exchanged ⇒ Object
12 13 14 |
# File 'lib/spree/conekta/exchange.rb', line 12 def amount_exchanged @amount_exchanged ||= (@amount * @exchange_rate).round end |