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.



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

#currencyObject

Returns the value of attribute currency.



9
10
11
# File 'lib/ebisu/models/price.rb', line 9

def currency
  @currency
end

#valueObject

Returns the value of attribute value.



5
6
7
# File 'lib/ebisu/models/price.rb', line 5

def value
  @value
end