Sha256: dd8aa71a3faeac15d6d5a273f278af93506e8a639f40326190b8278074466504
Contents?: true
Size: 702 Bytes
Versions: 4
Compression:
Stored size: 702 Bytes
Contents
class NoHeroFoundForProfileError < StandardError end module Covetous module Profile class Career < Covetous::Shen def initialize(battle_tag) @url = "#{Covetous::Profile::BASE_URL}/#{battle_tag}/" super end def hero_names heroes.map{ |hero| hero['name'] } end 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 end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
covetous-0.1.3 | lib/covetous/profile/career.rb |
covetous-0.1.2 | lib/covetous/profile/career.rb |
covetous-0.1.1 | lib/covetous/profile/career.rb |
covetous-0.1.0 | lib/covetous/profile/career.rb |