Class: Steam::Achievement

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#attribute_names, #attributes, #inspect

Instance Attribute Details

#gameObject (readonly)

Returns the value of attribute game.



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

def game
  @game
end

Class Method Details

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



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/steam/achievement.rb', line 23

def find_all game, options = {}
  data = get game.stats_link, options
  
  if data['playerstats'] && data['playerstats']['achievements'] && data['playerstats']['achievements']['achievement']
    data['playerstats']['achievements']['achievement'].map do |achievement_data|
      new game, achievement_data
    end
  else
    []
  end
end

Instance Method Details

#completed?Boolean

Returns:

  • (Boolean)


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

def completed?
  @closed == '1'
end

#to_sObject



18
19
20
# File 'lib/steam/achievement.rb', line 18

def to_s
  name
end

#unlocked_atObject



14
15
16
# File 'lib/steam/achievement.rb', line 14

def unlocked_at
  Time.at @unlock_timestamp if @unlock_timestamp
end