Class: GameAchievement
- Inherits:
-
Object
- Object
- GameAchievement
- Defined in:
- lib/steam/community/game_achievement.rb
Overview
The GameAchievement class represents a specific achievement for a single game and for a single user
Instance Attribute Summary collapse
-
#app_id ⇒ Object
readonly
Returns the value of attribute app_id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#steam_id64 ⇒ Object
readonly
Returns the value of attribute steam_id64.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
-
#initialize(steam_id64, app_id, achievement_data) ⇒ GameAchievement
constructor
Creates the achievement with the given name for the given user and game and achievement data.
-
#unlocked? ⇒ Boolean
Returns whether this achievement has been unlocked by its owner.
Constructor Details
#initialize(steam_id64, app_id, achievement_data) ⇒ GameAchievement
Creates the achievement with the given name for the given user and game and achievement data
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/steam/community/game_achievement.rb', line 14 def initialize(steam_id64, app_id, achievement_data) @app_id = app_id @name = achievement_data.elements['name'].text @steam_id64 = steam_id64 @unlocked = (achievement_data.attributes['closed'].to_i == 1) if @unlocked && !achievement_data.elements['unlockTimestamp'].nil? @timestamp = Time.at(achievement_data.elements['unlockTimestamp'].text.to_i) end end |
Instance Attribute Details
#app_id ⇒ Object (readonly)
Returns the value of attribute app_id.
10 11 12 |
# File 'lib/steam/community/game_achievement.rb', line 10 def app_id @app_id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/steam/community/game_achievement.rb', line 10 def name @name end |
#steam_id64 ⇒ Object (readonly)
Returns the value of attribute steam_id64.
10 11 12 |
# File 'lib/steam/community/game_achievement.rb', line 10 def steam_id64 @steam_id64 end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
10 11 12 |
# File 'lib/steam/community/game_achievement.rb', line 10 def @timestamp end |
Instance Method Details
#unlocked? ⇒ Boolean
Returns whether this achievement has been unlocked by its owner
26 27 28 |
# File 'lib/steam/community/game_achievement.rb', line 26 def unlocked? @unlocked end |