Class: Covetous::Profile::Career
- Defined in:
- lib/covetous/profile/career.rb
Instance Attribute Summary
Attributes inherited from Shen
Instance Method Summary collapse
- #get_hero_details_of(hero_name) ⇒ Object
- #hero_names ⇒ Object
-
#initialize(battle_tag) ⇒ Career
constructor
A new instance of Career.
Methods inherited from Shen
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Covetous::Shen
Instance Method Details
#get_hero_details_of(hero_name) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/covetous/profile/career.rb', line 16 def get_hero_details_of(hero_name) raise NoHeroFoundForProfileError, "No such hero was found under #{battle_tag}" unless hero_names.include? hero_name hero_index = hero_names.index hero_name battle_tag_for_api = battle_tag.gsub('#', '-') Covetous::Profile::Hero.new battle_tag_for_api, heroes[hero_index]['id'] end |
#hero_names ⇒ Object
12 13 14 |
# File 'lib/covetous/profile/career.rb', line 12 def hero_names heroes.map{ |hero| hero['name'] } end |