Class: Skyhook::Game
- Inherits:
-
Core
- Object
- Configuration
- Core
- Skyhook::Game
- Defined in:
- lib/skyhook/game.rb
Constant Summary
Constants inherited from Configuration
Configuration::BASE, Configuration::FORMATS
Instance Attribute Summary collapse
-
#achievements ⇒ Object
readonly
Returns the value of attribute achievements.
-
#appid ⇒ Object
readonly
Returns the value of attribute appid.
-
#game_name ⇒ Object
readonly
Returns the value of attribute game_name.
-
#stats ⇒ Object
readonly
Returns the value of attribute stats.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(appid, steamid = nil) ⇒ Game
constructor
A new instance of Game.
- #set_global_attributes ⇒ Object
- #set_user_attributes(response) ⇒ Object
Methods inherited from Core
api_reference, get_method, method_missing
Methods inherited from Configuration
Constructor Details
#initialize(appid, steamid = nil) ⇒ Game
Returns a new instance of Game.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/skyhook/game.rb', line 6 def initialize( appid, steamid = nil ) @appid = appid if steamid == nil # If steamid is not set a game should contain global data set_global_attributes else if steamid.is_a? Skyhook::User @user = steamid else @user = Skyhook::User.new steamid end set_user_attributes Skyhook::Core::ISteamUserStats.player_stats( appid, @user.steamid ) end end |
Instance Attribute Details
#achievements ⇒ Object (readonly)
Returns the value of attribute achievements.
4 5 6 |
# File 'lib/skyhook/game.rb', line 4 def achievements @achievements end |
#appid ⇒ Object (readonly)
Returns the value of attribute appid.
4 5 6 |
# File 'lib/skyhook/game.rb', line 4 def appid @appid end |
#game_name ⇒ Object (readonly)
Returns the value of attribute game_name.
4 5 6 |
# File 'lib/skyhook/game.rb', line 4 def game_name @game_name end |
#stats ⇒ Object (readonly)
Returns the value of attribute stats.
4 5 6 |
# File 'lib/skyhook/game.rb', line 4 def stats @stats end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
4 5 6 |
# File 'lib/skyhook/game.rb', line 4 def user @user end |
Instance Method Details
#set_global_attributes ⇒ Object
30 31 32 33 |
# File 'lib/skyhook/game.rb', line 30 def set_global_attributes #Will return a games global stats raise NotImplementedError end |
#set_user_attributes(response) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/skyhook/game.rb', line 22 def set_user_attributes( response ) @game_name = response['gameName'] @achievements = response['achievements'] @stats = response['stats'] @user.games= self end |