Class: SteamPrices::Game
- Inherits:
-
Object
- Object
- SteamPrices::Game
- Includes:
- Updater
- Defined in:
- lib/steam_prices/steam_game.rb
Constant Summary
Constants included from Updater
Updater::EXCEPTIONS, Updater::GAME, Updater::PACK
Instance Attribute Summary collapse
-
#app_id ⇒ Object
readonly
Returns the value of attribute app_id.
-
#app_name ⇒ Object
readonly
Returns the value of attribute app_name.
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#date_released ⇒ Object
readonly
Returns the value of attribute date_released.
-
#logo_link ⇒ Object
readonly
Returns the value of attribute logo_link.
-
#original_price ⇒ Object
Returns the value of attribute original_price.
-
#price ⇒ Object
Returns the value of attribute price.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#store_link ⇒ Object
readonly
Returns the value of attribute store_link.
Instance Method Summary collapse
-
#initialize(app_name = nil, app_id = nil, store_link = nil, logo_link = nil, date_released = nil, price = nil, original_price = nil) ⇒ Game
constructor
A new instance of Game.
- #update(currency = nil) ⇒ Object
Methods included from Updater
Constructor Details
#initialize(app_name = nil, app_id = nil, store_link = nil, logo_link = nil, date_released = nil, price = nil, original_price = nil) ⇒ Game
Returns a new instance of Game.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/steam_prices/steam_game.rb', line 9 def initialize(app_name = nil, app_id = nil, store_link = nil, logo_link = nil, date_released = nil, price = nil, original_price = nil) @app_id = app_id.to_i @app_name = app_name.to_s @store_link = store_link ||= "http://store.steampowered.com/app/12312312" @category = (@store_link.match(/(.*store\.steampowered\.com\/app\/[\d]+)/) ? GAME : PACK) @logo_link = logo_link @date_released = date_released raise ArgumentError, "Expected: Money()" if price.class.name != 'Money' && price != nil @price = price @original_price = original_price end |
Instance Attribute Details
#app_id ⇒ Object (readonly)
Returns the value of attribute app_id.
6 7 8 |
# File 'lib/steam_prices/steam_game.rb', line 6 def app_id @app_id end |
#app_name ⇒ Object (readonly)
Returns the value of attribute app_name.
6 7 8 |
# File 'lib/steam_prices/steam_game.rb', line 6 def app_name @app_name end |
#category ⇒ Object (readonly)
Returns the value of attribute category.
6 7 8 |
# File 'lib/steam_prices/steam_game.rb', line 6 def category @category end |
#date_released ⇒ Object (readonly)
Returns the value of attribute date_released.
6 7 8 |
# File 'lib/steam_prices/steam_game.rb', line 6 def date_released @date_released end |
#logo_link ⇒ Object (readonly)
Returns the value of attribute logo_link.
6 7 8 |
# File 'lib/steam_prices/steam_game.rb', line 6 def logo_link @logo_link end |
#original_price ⇒ Object
Returns the value of attribute original_price.
7 8 9 |
# File 'lib/steam_prices/steam_game.rb', line 7 def original_price @original_price end |
#price ⇒ Object
Returns the value of attribute price.
7 8 9 |
# File 'lib/steam_prices/steam_game.rb', line 7 def price @price end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/steam_prices/steam_game.rb', line 6 def status @status end |
#store_link ⇒ Object (readonly)
Returns the value of attribute store_link.
6 7 8 |
# File 'lib/steam_prices/steam_game.rb', line 6 def store_link @store_link end |
Instance Method Details
#update(currency = nil) ⇒ Object
21 22 23 24 |
# File 'lib/steam_prices/steam_game.rb', line 21 def update(currency = nil) return nil if !@app_name or @app_id == 0 self.class.update_one(@category, @app_name, @app_id, currency) end |