Class: Portal2Stats

Inherits:
GameStats show all
Defined in:
lib/steam/community/portal2/portal2_stats.rb

Overview

This class represents the game statistics for a single user in Portal 2

Author:

  • Sebastian Staudt

Instance Attribute Summary

Attributes inherited from GameStats

#game, #hours_played, #privacy_state, #user

Instance Method Summary collapse

Methods inherited from GameStats

#achievements, #achievements_done, #achievements_percentage, base_url, #base_url, create_game_stats, #public?

Methods included from XMLData

#parse

Constructor Details

#initialize(steam_id, fetch = true, bypass_cache = false) ⇒ Portal2Stats

Creates a ‘Portal2Stats` object by calling the super constructor with the game name `’portal2’‘

Parameters:

  • steam_id (String, Fixnum)

    The custom URL or 64bit Steam ID of the user

  • fetch (Boolean)

    if ‘true` the object’s data is fetched after creation

  • bypass_cache (Boolean)

    if ‘true` the object’s data is fetched again even if it has been cached already



20
21
22
# File 'lib/steam/community/portal2/portal2_stats.rb', line 20

def initialize(steam_id)
  super steam_id, 'portal2'
end

Instance Method Details

#inventoryPortal2Inventory

Returns the current Portal 2 inventory (a.k.a Robot Enrichment) of this player

Returns:



28
29
30
31
# File 'lib/steam/community/portal2/portal2_stats.rb', line 28

def inventory
  @inventory = Portal2Inventory.new(user.steam_id64) if @inventory.nil?
  @inventory
end