Class: XboxLive::GamesPage
- Inherits:
-
Object
- Object
- XboxLive::GamesPage
- Defined in:
- lib/xbox_live/games_page.rb
Overview
Each GamesPage tracks the data contianed in an Xbox Live “Compare Games” page. This can be used to determine which games a player has played, and their score and number of achievements acquired in each game.
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#gamerscore ⇒ Object
Returns the value of attribute gamerscore.
-
#gamertag ⇒ Object
Returns the value of attribute gamertag.
-
#gamertile_large ⇒ Object
Returns the value of attribute gamertile_large.
-
#games ⇒ Object
Returns the value of attribute games.
-
#page ⇒ Object
Returns the value of attribute page.
-
#progress ⇒ Object
Returns the value of attribute progress.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(gamertag) ⇒ GamesPage
constructor
Create a new GamesPage for the provided gamertag.
-
#refresh ⇒ Object
Force a reload of the GamesPage data from the Xbox Live web site.
Constructor Details
#initialize(gamertag) ⇒ GamesPage
Create a new GamesPage for the provided gamertag. Retrieve the html game compare page from the Xbox Live web site for analysis.
17 18 19 20 |
# File 'lib/xbox_live/games_page.rb', line 17 def initialize(gamertag) @gamertag = gamertag refresh end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
11 12 13 |
# File 'lib/xbox_live/games_page.rb', line 11 def data @data end |
#gamerscore ⇒ Object
Returns the value of attribute gamerscore.
11 12 13 |
# File 'lib/xbox_live/games_page.rb', line 11 def gamerscore @gamerscore end |
#gamertag ⇒ Object
Returns the value of attribute gamertag.
11 12 13 |
# File 'lib/xbox_live/games_page.rb', line 11 def gamertag @gamertag end |
#gamertile_large ⇒ Object
Returns the value of attribute gamertile_large.
11 12 13 |
# File 'lib/xbox_live/games_page.rb', line 11 def gamertile_large @gamertile_large end |
#games ⇒ Object
Returns the value of attribute games.
11 12 13 |
# File 'lib/xbox_live/games_page.rb', line 11 def games @games end |
#page ⇒ Object
Returns the value of attribute page.
11 12 13 |
# File 'lib/xbox_live/games_page.rb', line 11 def page @page end |
#progress ⇒ Object
Returns the value of attribute progress.
11 12 13 |
# File 'lib/xbox_live/games_page.rb', line 11 def progress @progress end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
11 12 13 |
# File 'lib/xbox_live/games_page.rb', line 11 def updated_at @updated_at end |
#url ⇒ Object
Returns the value of attribute url.
11 12 13 |
# File 'lib/xbox_live/games_page.rb', line 11 def url @url end |
Instance Method Details
#refresh ⇒ Object
Force a reload of the GamesPage data from the Xbox Live web site.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/xbox_live/games_page.rb', line 24 def refresh url = XboxLive.[:url_prefix] + '/en-US/Activity?' + Mechanize::Util.build_query_string(compareTo: @gamertag) @page = XboxLive::Scraper::get_page(url) return false if page.nil? @url = url @updated_at = Time.now @data = retrieve_game_data @gamertag = find_gamertag @gamertile_large = find_gamertile_large @gamerscore = find_gamerscore @progress = find_progress @games = find_games return true end |