Module: ArmoryApi::Client::Character

Included in:
ArmoryApi::Client
Defined in:
lib/armory_api/client/character.rb

Instance Method Summary collapse

Instance Method Details

#character(name, realm = nil, fields = []) ⇒ Hash

Retrieves a character from the Armory

Parameters:

Returns:

  • (Hash)

    the character hash

Raises:



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/armory_api/client/character.rb', line 14

def character(name, realm=nil, fields=[])
  if realm.class == Array
    fields = realm
    realm = nil
  end
  realm ||= @realm
  raise ArmoryApi::RealmNotFound if realm.nil?
  fields ||= []
  params = { fields: fields.join(',') } unless fields.empty?
  get("/api/wow/character/#{realm}/#{URI.escape(name)}", params)
end