Class: Cain::Career
Instance Attribute Summary collapse
Attributes inherited from Model
Instance Method Summary collapse
-
#initialize(battle_tag = nil) ⇒ Career
constructor
A new instance of Career.
Methods inherited from Model
Constructor Details
#initialize(battle_tag = nil) ⇒ Career
Returns a new instance of Career.
7 8 9 10 11 12 13 |
# File 'lib/cain/career.rb', line 7 def initialize battle_tag=nil super battle_tag uri = URI(path) data = JSON.parse(Net::HTTP.get(uri)) data["heroes"].each { |hero| heroes << Hero.build_from_json(hero) } end |
Instance Attribute Details
#heroes ⇒ Object
17 18 19 |
# File 'lib/cain/career.rb', line 17 def heroes @heroes ||= [] end |