class Skyhook::Game

Attributes

achievements[R]
appid[R]
game_name[R]
stats[R]
user[R]

Public Class Methods

new( appid, steamid = nil ) click to toggle source
# 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

Public Instance Methods

set_global_attributes() click to toggle source
# File lib/skyhook/game.rb, line 30
def set_global_attributes
  #Will return a games global stats
  raise NotImplementedError
end
set_user_attributes( response ) click to toggle source
# 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