Class: Starcraft2::Achievement

Inherits:
Object
  • Object
show all
Defined in:
lib/starcraft2/achievement.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Achievement

Returns a new instance of Achievement.



5
6
7
# File 'lib/starcraft2/achievement.rb', line 5

def initialize(options = {})
  Utils.load(self, options, {:icon => Icon})
end

Instance Attribute Details

#achievement_idObject

Returns the value of attribute achievement_id.



3
4
5
# File 'lib/starcraft2/achievement.rb', line 3

def achievement_id
  @achievement_id
end

#category_idObject

Returns the value of attribute category_id.



3
4
5
# File 'lib/starcraft2/achievement.rb', line 3

def category_id
  @category_id
end

#descriptionObject

Returns the value of attribute description.



3
4
5
# File 'lib/starcraft2/achievement.rb', line 3

def description
  @description
end

#iconObject

Returns the value of attribute icon.



3
4
5
# File 'lib/starcraft2/achievement.rb', line 3

def icon
  @icon
end

#pointsObject

Returns the value of attribute points.



3
4
5
# File 'lib/starcraft2/achievement.rb', line 3

def points
  @points
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/starcraft2/achievement.rb', line 3

def title
  @title
end

Class Method Details

.build(achievements_json) ⇒ Object



9
10
11
12
13
14
# File 'lib/starcraft2/achievement.rb', line 9

def self.build(achievements_json)
  data = JSON.parse(achievements_json)
  data['achievements'].map do |achievement|
    new(achievement)
  end
end