11
12
13
14
15
16
17
18
19
20
|
# File 'lib/honsolo/character.rb', line 11
def find(name_or_id)
id = name_or_id.is_a?(Fixnum) ? name_or_id : find_id(name_or_id)
data = Honsolo.post("f" => "get_all_stats", "account_id[]" => id)
raise Honsolo::CharacterNotFound, name_or_id if data["all_stats"].is_a?(Array) && data["all_stats"].empty?
character = Honsolo.to_ostruct(data["all_stats"],id)
character.last_match = Honsolo.to_ostruct(data["last_match"])
character.clan_info = Honsolo.to_ostruct(data["clan_info"],id)
character
end
|