Class: Cain::Hero

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

Instance Attribute Summary collapse

Attributes inherited from Model

#battle_tag, #last_updated

Class Method Summary collapse

Methods inherited from Model

#initialize, #path

Constructor Details

This class inherits a constructor from Cain::Model

Instance Attribute Details

#character_classObject

Returns the value of attribute character_class.



19
20
21
# File 'lib/cain/hero.rb', line 19

def character_class
  @character_class
end

#deadObject

Returns the value of attribute dead.



19
20
21
# File 'lib/cain/hero.rb', line 19

def dead
  @dead
end

#genderObject

Returns the value of attribute gender.



19
20
21
# File 'lib/cain/hero.rb', line 19

def gender
  @gender
end

#hardcoreObject

Returns the value of attribute hardcore.



19
20
21
# File 'lib/cain/hero.rb', line 19

def hardcore
  @hardcore
end

#idObject

Returns the value of attribute id.



19
20
21
# File 'lib/cain/hero.rb', line 19

def id
  @id
end

#levelObject

Returns the value of attribute level.



19
20
21
# File 'lib/cain/hero.rb', line 19

def level
  @level
end

#nameObject

Returns the value of attribute name.



19
20
21
# File 'lib/cain/hero.rb', line 19

def name
  @name
end

#paragon_levelObject

Returns the value of attribute paragon_level.



19
20
21
# File 'lib/cain/hero.rb', line 19

def paragon_level
  @paragon_level
end

Class Method Details

.build_from_json(params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/cain/hero.rb', line 7

def self.build_from_json params
  hero = new

  params.keys.each do |key|
    method = key.gsub(/([a-z\d])([A-Z])/,'\1_\2').tr("-", "_").downcase
    method = "character_class" if method == "class"
    hero.send(method + "=", params[key])
  end

  hero
end