Class: Simplepay::Support::Amount
- Inherits:
-
Object
- Object
- Simplepay::Support::Amount
- Defined in:
- lib/simplepay/support/amount.rb
Overview
Amazon often represents dollar values as a combination of a value and a currency. In several types of requests, the combination is required for communication.
At the present time, Amazon only uses USD.
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#currency ⇒ Object
Returns the value of attribute currency.
Instance Method Summary collapse
-
#initialize(amount, currency = Simplepay::Currency::USD) ⇒ Amount
constructor
A new instance of Amount.
- #to_s ⇒ Object
Constructor Details
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
15 16 17 |
# File 'lib/simplepay/support/amount.rb', line 15 def amount @amount end |
#currency ⇒ Object
Returns the value of attribute currency.
16 17 18 |
# File 'lib/simplepay/support/amount.rb', line 16 def currency @currency end |
Instance Method Details
#to_s ⇒ Object
48 49 50 |
# File 'lib/simplepay/support/amount.rb', line 48 def to_s "#{currency.code} #{currency.format % amount}" end |