Class: Stew::Store::Sale
- Inherits:
-
Object
- Object
- Stew::Store::Sale
- Defined in:
- lib/stew/store/sale.rb
Overview
A single sale in the Steam Store
Instance Method Summary collapse
- #app_id ⇒ Object
-
#initialize(node) ⇒ Sale
constructor
A new instance of Sale.
- #name ⇒ Object
- #original_price ⇒ Object
- #price ⇒ Object
Constructor Details
#initialize(node) ⇒ Sale
Returns a new instance of Sale.
5 6 7 |
# File 'lib/stew/store/sale.rb', line 5 def initialize(node) @node = node end |
Instance Method Details
#app_id ⇒ Object
23 24 25 |
# File 'lib/stew/store/sale.rb', line 23 def app_id @node.to_s.match(/tab_row_Discounts_([0-9]+)/)[1].to_i end |
#name ⇒ Object
9 10 11 |
# File 'lib/stew/store/sale.rb', line 9 def name @node.at_css("div.tab_desc").at_css("h4").content end |
#original_price ⇒ Object
17 18 19 20 21 |
# File 'lib/stew/store/sale.rb', line 17 def original_price possible_price = Stew.money(self.class.content_or_nil(@node.at_css("div.tab_price").at_css('strike'))) return price if possible_price.fractional == 0 possible_price end |
#price ⇒ Object
13 14 15 |
# File 'lib/stew/store/sale.rb', line 13 def price Stew.money @node.at_css("div.tab_price").children.last.content.strip end |