Module: BnetApi::WoW

Extended by:
WoW
Included in:
WoW
Defined in:
lib/bnet_api/wow.rb,
lib/bnet_api/wow_data.rb

Overview

All API methods relating to World of Warcraft are contained in this module.

Defined Under Namespace

Modules: Data

Instance Method Summary collapse

Instance Method Details

#achievement(id) ⇒ Hash

Retrieves the achievement with the specified ID.

Parameters:

  • id (Integer)

    The ID of the achievement.

Returns:

  • (Hash)

    A hash containing the achievement data.



12
13
14
# File 'lib/bnet_api/wow.rb', line 12

def achievement(id)
  BnetApi.make_request("/wow/achievement/#{id}")
end

#auction_data(realm) ⇒ Hash

Retrieves the URL of a JSON file containing the most recent auction data dump.

Parameters:

  • realm (String)

    The realm to retrieve auction data for.

Returns:

  • (Hash)

    A hash containing the URL of the auction data file.



20
21
22
# File 'lib/bnet_api/wow.rb', line 20

def auction_data(realm)
  BnetApi.make_request("/wow/auction/data/#{realm}")
end

#challenge_mode_realm(realm) ⇒ Hash

Retrieves the challenge mode leaderboard for the specified realm.

Parameters:

  • realm (String)

    The realm to retrieve the leaderboard for.

Returns:

  • (Hash)

    A hash containing the leaderboard data.



28
29
30
# File 'lib/bnet_api/wow.rb', line 28

def challenge_mode_realm(realm)
  BnetApi.make_request("/wow/challenge/#{realm}")
end

#challenge_mode_regionHash

Retrieves the challenge mode leaderboard for the current API region.

Returns:

  • (Hash)

    A hash containing the leaderboard data.



35
36
37
# File 'lib/bnet_api/wow.rb', line 35

def challenge_mode_region
  BnetApi.make_request('/wow/challenge/region')
end

#character(realm, name, *optional_fields) ⇒ Hash

Retrieves the character with the specified name on the specified realm.

Parameters:

  • realm (String)

    The realm the character is on.

  • name (String)

    The name of the character.

  • *optional_fields (Array<Symbol>)

    Any optional fields to retrieve data for.

Returns:

  • (Hash)

    A hash containing the character data.



45
46
47
48
49
50
# File 'lib/bnet_api/wow.rb', line 45

def character(realm, name, *optional_fields)
  if optional_fields[0] == :all
    optional_fields = :achievements, :appearance, :feed, :guild, :items, :mounts, :pets, :petSlots, :progression, :pvp, :quests, :reputation, :stats, :talents, :titles, :audit
  end
  BnetApi.make_request("/wow/character/#{URI.escape(realm)}/#{URI.escape(name)}", optional_fields)
end

#guild(realm, name, *optional_fields) ⇒ Hash

Retrieves the guild with the specified name on the specified realm.

Parameters:

  • realm (String)

    The realm the guild is on.

  • name (String)

    The name of the guild.

  • *optional_fields (Array<Symbol>)

    Any optional fields to retrieve data for.

Returns:

  • (Hash)

    A hash containing the guild data.



74
75
76
77
78
79
# File 'lib/bnet_api/wow.rb', line 74

def guild(realm, name, *optional_fields)
  if optional_fields[0] == :all
    optional_fields = :members, :achievements, :news, :challenge
  end
  BnetApi.make_request("/wow/guild/#{URI.escape(realm)}/#{URI.escape(name)}", optional_fields)
end

#item(id) ⇒ Hash

Retrieves the item with the specified ID.

Parameters:

  • id (Integer)

    The ID of the item.

Returns:

  • (Hash)

    A hash containing the item data.



56
57
58
# File 'lib/bnet_api/wow.rb', line 56

def item(id)
  BnetApi.make_request("/wow/item/#{id}")
end

#item_set(id) ⇒ Hash

Retrieves the item set with the specified ID.

Parameters:

  • id (Integer)

    The ID of the item set.

Returns:

  • (Hash)

    A hash containing the item set data.



64
65
66
# File 'lib/bnet_api/wow.rb', line 64

def item_set(id)
  BnetApi.make_request("/wow/item/set/#{id}")
end

#pet_ability(id) ⇒ Hash

Retrieves the pet ability with the specified ID.

Parameters:

  • id (Integer)

    The ID of the ability.

Returns:

  • (Hash)

    A hash containing the ability data.



92
93
94
# File 'lib/bnet_api/wow.rb', line 92

def pet_ability(id)
  BnetApi.make_request("/wow/pet/ability/#{id}")
end

#pet_master_listHash

Retrieves a list of all battle and vanity pets.

Returns:

  • (Hash)

    A hash containing a list of pets.



84
85
86
# File 'lib/bnet_api/wow.rb', line 84

def pet_master_list
  BnetApi.make_request("/wow/pet/")
end

#pet_species(id) ⇒ Hash

Retrieves the pet species with the specified ID.

Parameters:

  • id (Integer)

    The ID of the species.

Returns:

  • (Hash)

    A hash containing the species data.



100
101
102
# File 'lib/bnet_api/wow.rb', line 100

def pet_species(id)
  BnetApi.make_request("/wow/pet/species/#{id}")
end

#pet_stats(species_id, options = {}) ⇒ Hash

Retrieves the stats for the pet with the specified ID.

Parameters:

  • species_id (Integer)

    The ID of the pet species.

  • options (Hash) (defaults to: {})

    Any additional options.

Options Hash (options):

  • :level (Integer)

    The level of the species.

  • :breedId (Integer)

    The ID of the breed.

  • :qualityId (Integer)

    The quality of the pet.

Returns:

  • (Hash)

    A hash containing the pet stats data.



112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/bnet_api/wow.rb', line 112

def pet_stats(species_id, options = {})
  level = options[:level] || 1
  breedId = options[:breedId] || 3
  qualityId = options[:qualityId] || 1

  BnetApi.make_request_with_params("/wow/pet/stats/#{species_id}",
    { 
      level: level, 
      breedId: breedId, 
      qualityId: qualityId }
  )
end

#pvp(bracket) ⇒ Hash

Retrieves the PvP leaderboard for the specified bracket.

Parameters:

  • bracket (String)

    The PvP bracket to retrieve data for.

Returns:

  • (Hash)

    A hash containing the leaderboard data.



129
130
131
# File 'lib/bnet_api/wow.rb', line 129

def pvp(bracket)
  BnetApi.make_request("/wow/leaderboard/#{bracket}")
end

#quest(id) ⇒ Hash

Retrieves the quest with the specified ID.

Parameters:

  • id (Integer)

    The ID of the quest.

Returns:

  • (Hash)

    A hash containing the quest data.



137
138
139
# File 'lib/bnet_api/wow.rb', line 137

def quest(id)
  BnetApi.make_request("/wow/quest/#{id}")
end

#realm_status(*realms) ⇒ Hash

Retrieves the realm status for the region. If any realms are specified as parameters, only the status of these realms will be returned.

Parameters:

  • *realms (Array<String>)

    Any realms to restrict the data to.

Returns:

  • (Hash)

    A hash containing the realm status data.



146
147
148
149
150
151
152
# File 'lib/bnet_api/wow.rb', line 146

def realm_status(*realms)
  if realms.count > 0
    BnetApi.make_request_with_params("/wow/realm/status", { realms: realms.join(',') })
  else
    BnetApi.make_request("/wow/realm/status")
  end
end

#recipe(id) ⇒ Hash

Retrieves the recipe with the specified ID.

Parameters:

  • id (Integer)

    The ID of the recipe.

Returns:

  • (Hash)

    A hash containing the recipe data.



158
159
160
# File 'lib/bnet_api/wow.rb', line 158

def recipe(id)
  BnetApi.make_request("/wow/recipe/#{id}")
end

#spell(id) ⇒ Hash

Retrieves the spell with the specified ID.

Parameters:

  • id (Integer)

    The ID of the spell.

Returns:

  • (Hash)

    A hash containing the spell data.



166
167
168
# File 'lib/bnet_api/wow.rb', line 166

def spell(id)
  BnetApi.make_request("/wow/spell/#{id}")
end