Class: Stew::Store::AppOffer
- Inherits:
-
Object
- Object
- Stew::Store::AppOffer
- Defined in:
- lib/stew/store/app_offer.rb
Overview
Represents a price of an application in the steam store
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(node) ⇒ AppOffer
constructor
A new instance of AppOffer.
- #name ⇒ Object
- #price ⇒ Object
- #regular_price ⇒ Object
- #sale? ⇒ Boolean
Constructor Details
#initialize(node) ⇒ AppOffer
Returns a new instance of AppOffer.
11 12 13 |
# File 'lib/stew/store/app_offer.rb', line 11 def initialize(node) @node = node end |
Class Method Details
.create(node) ⇒ Object
6 7 8 9 |
# File 'lib/stew/store/app_offer.rb', line 6 def self.create(node) return AppOfferSale.new(node) unless node.css('div.discount_final_price').empty? return AppOffer.new(node) end |
Instance Method Details
#description ⇒ Object
27 28 29 |
# File 'lib/stew/store/app_offer.rb', line 27 def description description_empty? ? nil : @node.at_css('p').content end |
#name ⇒ Object
31 32 33 |
# File 'lib/stew/store/app_offer.rb', line 31 def name @node.at_css('h1').content.strip.gsub('Buy ','') end |
#price ⇒ Object
15 16 17 |
# File 'lib/stew/store/app_offer.rb', line 15 def price Stew.money @node.at_css('div.game_purchase_price').content.gsub(/[\n\t\r\s]/, '') end |
#regular_price ⇒ Object
19 20 21 |
# File 'lib/stew/store/app_offer.rb', line 19 def regular_price price end |
#sale? ⇒ Boolean
23 24 25 |
# File 'lib/stew/store/app_offer.rb', line 23 def sale? false end |