Class: ShopsavvyDataApi::PriceHistoryEntry
- Inherits:
-
Object
- Object
- ShopsavvyDataApi::PriceHistoryEntry
- Defined in:
- lib/shopsavvy_data_api/models.rb
Overview
Historical price data point
Instance Attribute Summary collapse
-
#availability ⇒ Object
readonly
Returns the value of attribute availability.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
Instance Method Summary collapse
-
#initialize(data) ⇒ PriceHistoryEntry
constructor
A new instance of PriceHistoryEntry.
- #to_h ⇒ Object
Constructor Details
#initialize(data) ⇒ PriceHistoryEntry
Returns a new instance of PriceHistoryEntry.
123 124 125 126 127 |
# File 'lib/shopsavvy_data_api/models.rb', line 123 def initialize(data) @date = data["date"] @price = data["price"].to_f @availability = data["availability"] end |
Instance Attribute Details
#availability ⇒ Object (readonly)
Returns the value of attribute availability.
121 122 123 |
# File 'lib/shopsavvy_data_api/models.rb', line 121 def availability @availability end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
121 122 123 |
# File 'lib/shopsavvy_data_api/models.rb', line 121 def date @date end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
121 122 123 |
# File 'lib/shopsavvy_data_api/models.rb', line 121 def price @price end |
Instance Method Details
#to_h ⇒ Object
129 130 131 132 133 134 135 |
# File 'lib/shopsavvy_data_api/models.rb', line 129 def to_h { date: date, price: price, availability: availability } end |