Commit 25e83f33 authored by Francis's avatar Francis
Browse files

Added character profile encounter endpoints

parent 566edbd5
Pipeline #123411770 failed with stage
in 1 minute and 4 seconds
Please view this file on the master branch, otherwise it may be outdated
**Version 0.3.3**
Added character profile encounter endpoints:
https://us.forums.blizzard.com/en/blizzard/t/world-of-warcraft-api-patch-notes-20200226/3713
Added missing media endpoints for `playable_class`, `playable_specialization` and `mythic_keystone_affix`
**Version 0.3.2**
Added new WoW endpoints: https://us.forums.blizzard.com/en/blizzard/t/world-of-warcraft-api-update-visions-of-nzoth/3461
......
......@@ -2,5 +2,5 @@
module BlizzardApi
# Gem version
VERSION = '0.3.2'
VERSION = '0.3.3'
end
......@@ -10,6 +10,19 @@ module BlizzardApi
# You can get an instance of this class using the default region as follows:
# api_instance = BlizzardApi::Wow.mythic_keystone_affix
class MythicKeystoneAffix < Wow::GenericDataEndpoint
##
# Fetch media for one of the affixes listed by the {#index} using its *id*
#
# @param id [Integer] Keystone affix id
#
# @!macro request_options
#
# @!macro response
def media(id, options = {})
api_request "#{base_url(:media)}/keystone-affix/#{id}", default_options.merge(options)
end
protected
def endpoint_setup
......
......@@ -51,6 +51,18 @@ module BlizzardApi
data
end
##
# Fetch media for one of the playable classes listed by the {#index} using its *id*
#
# @param id [Integer] Playable class id
#
# @!macro request_options
#
# @!macro response
def media(id, options = {})
api_request "#{base_url(:media)}/playable-class/#{id}", default_options.merge(options)
end
protected
def endpoint_setup
......
......@@ -20,6 +20,18 @@ module BlizzardApi
response_data
end
##
# Fetch media for one of the playable specializations listed by the {#index} using its *id*
#
# @param id [Integer] Playable specialization id
#
# @!macro request_options
#
# @!macro response
def media(id, options = {})
api_request "#{base_url(:media)}/playable-specialization/#{id}", default_options.merge(options)
end
protected
def endpoint_setup
......
......@@ -40,22 +40,21 @@ module BlizzardApi
end
##
# Return character status
# Return character achievements
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
# @see https://us.forums.blizzard.com/en/blizzard/t/data-protection-notice-and-faq/609
#
# @param realm [String] The character realm's slug
# @param character [String] The character name
# @!macro request_options
#
# @!macro response
def status(realm, character, options = {})
character_request realm, character, options, 'status'
def achievements(realm, character, options = {})
character_request realm, character, options, 'achievements'
end
##
# Return character achievements
# Return character achievements statistics
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
#
......@@ -64,12 +63,12 @@ module BlizzardApi
# @!macro request_options
#
# @!macro response
def achievements(realm, character, options = {})
character_request realm, character, options, 'achievements'
def achievement_statistics(realm, character, options = {})
character_request realm, character, options, 'achievements/statistics'
end
##
# Return character achievements statistics
# Return character appearance
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
#
......@@ -78,12 +77,12 @@ module BlizzardApi
# @!macro request_options
#
# @!macro response
def achievement_statistics(realm, character, options = {})
character_request realm, character, options, 'achievements/statistics'
def appearance(realm, character, options = {})
character_request realm, character, options, 'appearance'
end
##
# Return character appearance
# Return a character's collections
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
#
......@@ -92,12 +91,12 @@ module BlizzardApi
# @!macro request_options
#
# @!macro response
def appearance(realm, character, options = {})
character_request realm, character, options, 'appearance'
def collections(realm, character, options = {})
character_request realm, character, options, 'collections'
end
##
# Return character equipment
# Return a character's pet collection
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
#
......@@ -106,12 +105,12 @@ module BlizzardApi
# @!macro request_options
#
# @!macro response
def equipment(realm, character, options = {})
character_request realm, character, options, 'equipment'
def pets(realm, character, options = {})
character_request realm, character, options, 'collections/pets'
end
##
# Return character media
# Return a character's mount collection
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
#
......@@ -120,27 +119,26 @@ module BlizzardApi
# @!macro request_options
#
# @!macro response
def media(realm, character, options = {})
character_request realm, character, options, 'character-media'
def mounts(realm, character, options = {})
character_request realm, character, options, 'collections/mounts'
end
##
# Return the pvp bracket of a character
# Return a character's encounter summary
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
#
# @param realm [String] The character realm's slug
# @param character [String] The character name
# @param bracket [String] Pvp bracket
# @!macro request_options
#
# @!macro response
def pvp_bracket(realm, character, bracket, options = {})
character_request realm, character, options, "pvp-bracket/#{bracket}"
def encounters(realm, character, options = {})
character_request realm, character, options, 'encounters'
end
##
# Return the pvp summary of a character
# Return a character's dungeon progress
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
#
......@@ -149,12 +147,12 @@ module BlizzardApi
# @!macro request_options
#
# @!macro response
def pvp_summary(realm, character, options = {})
character_request realm, character, options, 'pvp-summary'
def dungeons(realm, character, options = {})
character_request realm, character, options, 'encounters/dungeons'
end
##
# Return a character's quests
# Return a character's raid progress
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
#
......@@ -163,14 +161,12 @@ module BlizzardApi
# @!macro request_options
#
# @!macro response
def quests(realm, character, completed = false, options = {})
return character_request realm, character, options, 'quests/completed' if completed
character_request realm, character, options, 'quests'
def raids(realm, character, options = {})
character_request realm, character, options, 'encounters/raids'
end
##
# Return a character's specialization
# Return character equipment
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
#
......@@ -179,12 +175,12 @@ module BlizzardApi
# @!macro request_options
#
# @!macro response
def specializations(realm, character, options = {})
character_request realm, character, options, 'specializations'
def equipment(realm, character, options = {})
character_request realm, character, options, 'equipment'
end
##
# Return a character's statistics
# Return a character's hunter pets
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
#
......@@ -193,12 +189,12 @@ module BlizzardApi
# @!macro request_options
#
# @!macro response
def statistics(realm, character, options = {})
character_request realm, character, options, 'statistics'
def hunter_pets(realm, character, options = {})
character_request realm, character, options, 'hunter-pets'
end
##
# Return a character's titles
# Return character media
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
#
......@@ -207,8 +203,8 @@ module BlizzardApi
# @!macro request_options
#
# @!macro response
def titles(realm, character, options = {})
character_request realm, character, options, 'titles'
def media(realm, character, options = {})
character_request realm, character, options, 'character-media'
end
##
......@@ -241,35 +237,37 @@ module BlizzardApi
end
##
# Return a character's collections
# Return character status
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
# @see https://us.forums.blizzard.com/en/blizzard/t/data-protection-notice-and-faq/609
#
# @param realm [String] The character realm's slug
# @param character [String] The character name
# @!macro request_options
#
# @!macro response
def collections(realm, character, options = {})
character_request realm, character, options, 'collections'
def status(realm, character, options = {})
character_request realm, character, options, 'status'
end
##
# Return a character's pet collection
# Return the pvp bracket of a character
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
#
# @param realm [String] The character realm's slug
# @param character [String] The character name
# @param bracket [String] Pvp bracket
# @!macro request_options
#
# @!macro response
def pets(realm, character, options = {})
character_request realm, character, options, 'collections/pets'
def pvp_bracket(realm, character, bracket, options = {})
character_request realm, character, options, "pvp-bracket/#{bracket}"
end
##
# Return a character's mount collection
# Return the pvp summary of a character
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
#
......@@ -278,8 +276,24 @@ module BlizzardApi
# @!macro request_options
#
# @!macro response
def mounts(realm, character, options = {})
character_request realm, character, options, 'collections/mounts'
def pvp_summary(realm, character, options = {})
character_request realm, character, options, 'pvp-summary'
end
##
# Return a character's quests
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
#
# @param realm [String] The character realm's slug
# @param character [String] The character name
# @!macro request_options
#
# @!macro response
def quests(realm, character, completed = false, options = {})
return character_request realm, character, options, 'quests/completed' if completed
character_request realm, character, options, 'quests'
end
##
......@@ -297,7 +311,7 @@ module BlizzardApi
end
##
# Return a character's hunter pets
# Return a character's specialization
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
#
......@@ -306,12 +320,12 @@ module BlizzardApi
# @!macro request_options
#
# @!macro response
def hunter_pets(realm, character, options = {})
character_request realm, character, options, 'hunter-pets'
def specializations(realm, character, options = {})
character_request realm, character, options, 'specializations'
end
##
# Return a character's raid progression
# Return a character's statistics
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
#
......@@ -320,8 +334,22 @@ module BlizzardApi
# @!macro request_options
#
# @!macro response
def raid_progression(realm, character, options = {})
character_request realm, character, options, 'raid-progression'
def statistics(realm, character, options = {})
character_request realm, character, options, 'statistics'
end
##
# Return a character's titles
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
#
# @param realm [String] The character realm's slug
# @param character [String] The character name
# @!macro request_options
#
# @!macro response
def titles(realm, character, options = {})
character_request realm, character, options, 'titles'
end
private
......
......@@ -5,23 +5,29 @@ require 'test_helper'
module BlizzardApi
module Wow
class MythicKeystoneAffixTest < Minitest::Test
def setup
@affix = BlizzardApi::Wow::MythicKeystoneAffix.new
end
def test_mythic_keystone_affix_index
affix = BlizzardApi::Wow::MythicKeystoneAffix.new
affix_data = affix.index
affix_data = @affix.index
assert_equal 'Overflowing', affix_data[:affixes][0][:name][:en_US]
end
def test_mythic_keystone_affix_get
affix = BlizzardApi::Wow::MythicKeystoneAffix.new
affix_data = affix.get 1
affix_data = @affix.get 1
assert_equal 'Overflowing', affix_data[:name][:en_US]
end
def test_mythic_keystone_affix_complete
affix = BlizzardApi::Wow::MythicKeystoneAffix.new
affix_data = affix.complete
affix_data = @affix.complete
assert_equal 'Overflowing', affix_data[0][:name][:en_US]
end
def test_mythic_keystone_affix_media
affix_data = @affix.media 1
assert_equal 'https://render-us.worldofwarcraft.com/icons/56/inv_misc_volatilewater.jpg', affix_data[:assets][0][:value]
end
end
end
end
......@@ -5,37 +5,42 @@ require 'test_helper'
module BlizzardApi
module Wow
class PlayableClassTest < Minitest::Test
def setup
@playable_class = BlizzardApi::Wow::PlayableClass.new
end
def test_playable_class_index
classes = BlizzardApi::Wow::PlayableClass.new
classes_data = classes.index
assert_equal 12, classes_data[:classes].count
data = @playable_class.index
assert_equal 12, data[:classes].count
classes_data = classes.index classic: true
assert_equal 9, classes_data[:classes].count
data = @playable_class.index classic: true
assert_equal 9, data[:classes].count
end
def test_playable_class_get
playable_class = BlizzardApi::Wow::PlayableClass.new
playable_class_data = playable_class.get 11
assert_equal 'Druid', playable_class_data[:name][:en_US]
data = @playable_class.get 11
assert_equal 'Druid', data[:name][:en_US]
playable_class_data = playable_class.get 11, classic: true
assert_equal 'Druid', playable_class_data[:name][:en_US]
data = @playable_class.get 11, classic: true
assert_equal 'Druid', data[:name][:en_US]
end
def test_playable_class_complete
playable_class = BlizzardApi::Wow::PlayableClass.new
playable_class_data = playable_class.complete
assert_equal 'Warrior', playable_class_data[0][:name][:en_US]
data = @playable_class.complete
assert_equal 'Warrior', data[0][:name][:en_US]
data = @playable_class.complete classic: true
assert_equal 'Warrior', data[0][:name][:en_US]
end
playable_class_data = playable_class.complete classic: true
assert_equal 'Warrior', playable_class_data[0][:name][:en_US]
def test_playable_class_talent_slots
data = @playable_class.talent_slots 11
assert_equal 20, data[:talent_slots][0][:unlock_player_level]
end
def test_class_talent_slots
playable_class = BlizzardApi::Wow::PlayableClass.new
talent_slots_data = playable_class.talent_slots 11
assert_equal 20, talent_slots_data[:talent_slots][0][:unlock_player_level]
def test_playable_class_media
data = @playable_class.media 11
assert_equal 'https://render-us.worldofwarcraft.com/icons/56/classicon_druid.jpg', data[:assets][0][:value]
end
end
end
......
......@@ -5,23 +5,28 @@ require 'test_helper'
module BlizzardApi
module Wow
class PlayableSpecializationTest < Minitest::Test
def setup
@playable_specialization = BlizzardApi::Wow::PlayableSpecialization.new
end
def test_specialization_index
specs = BlizzardApi::Wow::PlayableSpecialization.new
specs_data = specs.index
specs_data = @playable_specialization.index
assert_equal 62, specs_data[:character_specializations][0][:id]
end
def test_specialization_get
specs = BlizzardApi::Wow::PlayableSpecialization.new
specs_data = specs.get 62
specs_data = @playable_specialization.get 62
assert_equal 'Arcane', specs_data[:name][:en_US]
end
def test_specialization_complete
specs = BlizzardApi::Wow::PlayableSpecialization.new
specs_data = specs.complete
specs_data = @playable_specialization.complete
assert_equal 'Ferocity', specs_data[:pet_specializations][0][:name][:en_US]
end
def test_specialization_media
specs_data = @playable_specialization.media 262
assert_equal 'https://render-us.worldofwarcraft.com/icons/56/spell_nature_lightning.jpg', specs_data[:assets][0][:value]
end
end
end
end
......@@ -29,6 +29,22 @@ module BlizzardApi
assert_equal 4, character_data[:appearance][:face_variation]
end
def test_character_encounters
character_data = @character.encounters 'Azralon', 'Schiller'
assert character_data.key? :dungeons
assert character_data.key? :raids
end
def test_character_dungeons
character_data = @character.dungeons 'Azralon', 'Schiller'
assert character_data.key? :expansions
end
def test_character_raids
character_data = @character.raids 'Azralon', 'Schiller'
assert character_data.key? :expansions
end
def test_character_equipment
character_data = @character.equipment 'Azralon', 'Schiller'
assert character_data.key? :equipped_items
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment