Class: Steam::Game

Inherits:
Base
  • Object
show all
Includes:
HTTParty
Defined in:
lib/steam/game.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#attribute_names, #attributes, #inspect

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/steam/game.rb', line 8

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/steam/game.rb', line 8

def name
  @name
end

#profileObject (readonly)

Returns the value of attribute profile.



8
9
10
# File 'lib/steam/game.rb', line 8

def profile
  @profile
end

Class Method Details

.find_all(profile, options = {}) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/steam/game.rb', line 29

def find_all profile, options = {}
  base_uri profile.url
  data = get '/games', options
  
  if data['gamesList'] && data['gamesList']['games'] && data['gamesList']['games']['game']
    data['gamesList']['games']['game'].map do |game_data|
      new profile, game_data, options
    end
  else
    []
  end
end

Instance Method Details

#achievements(reload = false) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/steam/game.rb', line 14

def achievements reload = false
  return [] unless has_achievements?
  
  if reload or @achievements.nil?
    @achievements = Achievement.find_all self, @request_options
  end
  
  @achievements
end

#has_achievements?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/steam/game.rb', line 10

def has_achievements?
  !@stats_link.nil?
end

#to_sObject



24
25
26
# File 'lib/steam/game.rb', line 24

def to_s
  name
end