Class: Cain::Career

Inherits:
Model
  • Object
show all
Defined in:
lib/cain/career.rb

Instance Attribute Summary collapse

Attributes inherited from Model

#battle_tag, #last_updated

Instance Method Summary collapse

Methods inherited from Model

#path

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

#heroesObject



17
18
19
# File 'lib/cain/career.rb', line 17

def heroes
  @heroes ||= []
end