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.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ebisu/models/price.rb', line 13 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.
11 12 13 |
# File 'lib/ebisu/models/price.rb', line 11 def currency @currency end |
#value ⇒ Object
Returns the value of attribute value.
7 8 9 |
# File 'lib/ebisu/models/price.rb', line 7 def value @value end |