Class: Ebisu::Price

Inherits:
Object
  • Object
show all
Defined in:
lib/ebisu/models/price.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#currencyObject

Returns the value of attribute currency.



11
12
13
# File 'lib/ebisu/models/price.rb', line 11

def currency
  @currency
end

#valueObject

Returns the value of attribute value.



7
8
9
# File 'lib/ebisu/models/price.rb', line 7

def value
  @value
end