Class: Starcraft2::Reward

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Reward

Returns a new instance of Reward.



5
6
7
# File 'lib/starcraft2/reward.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/reward.rb', line 3

def achievement_id
  @achievement_id
end

#iconObject

Returns the value of attribute icon.



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

def icon
  @icon
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#titleObject

Returns the value of attribute title.



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

def title
  @title
end

Class Method Details

.build(rewards_json) ⇒ Object



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

def self.build(rewards_json)
  data = JSON.parse(rewards_json)
  data['portraits'].map do |reward|
    new(reward)
  end
end