Class: Ebisu::Price
- Inherits:
-
Object
- Object
- Ebisu::Price
- Defined in:
- lib/ebisu/models/price.rb
Instance Attribute Summary collapse
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(price) ⇒ Price
constructor
A new instance of Price.
Constructor Details
#initialize(price) ⇒ Price
Returns a new instance of Price.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ebisu/models/price.rb', line 11 def initialize(price) case price when Hash @value = Integer(price['__content__']) @currency = price['currency'] when String @value = Integer(price) @currency = 'JPY' when Integer @value = price @currency = 'JPY' else raise "assertion failed. invalid price response value: #{price}" end end |
Instance Attribute Details
#currency ⇒ Object
Returns the value of attribute currency.
9 10 11 |
# File 'lib/ebisu/models/price.rb', line 9 def currency @currency end |
#value ⇒ Object
Returns the value of attribute value.
5 6 7 |
# File 'lib/ebisu/models/price.rb', line 5 def value @value end |