Commit a2aadbb1 authored by Francis's avatar Francis

Shadowlands covenant endpoints

parent 974d2dd6
Pipeline #217612787 passed with stage
in 5 minutes and 22 seconds
Please view this file on the master branch, otherwise it may be outdated
**Version 0.5.2**
Added new endpoints: https://us.forums.blizzard.com/en/blizzard/t/wow-shadowlands-api-update-covenenats-soulbinds-more/13385
**Version 0.5.1**
Added new endpoints: https://us.forums.blizzard.com/en/blizzard/t/wow-game-data-api-modified-crafting-support/12727
......
......@@ -2,5 +2,5 @@
module BlizzardApi
# Gem version
VERSION = '0.5.1'
VERSION = '0.5.2'
end
......@@ -14,6 +14,7 @@ module BlizzardApi
require_relative 'wow/game_data/auction'
require_relative 'wow/game_data/azerite_essence'
require_relative 'wow/game_data/connected_realm'
require_relative 'wow/game_data/covenant'
require_relative 'wow/game_data/creature'
require_relative 'wow/game_data/guild_crest'
require_relative 'wow/game_data/item'
......@@ -39,6 +40,7 @@ module BlizzardApi
require_relative 'wow/game_data/reputation'
require_relative 'wow/game_data/spell'
require_relative 'wow/game_data/talent'
require_relative 'wow/game_data/tech_talent'
require_relative 'wow/game_data/title'
require_relative 'wow/game_data/wow_token'
......@@ -70,6 +72,13 @@ module BlizzardApi
BlizzardApi::Wow::ConnectedRealm.new(region)
end
##
# @param region [String] API Region
# @return {Covenant}
def self.covenant(region = BlizzardApi.region)
BlizzardApi::Wow::Covenant.new(region)
end
##
# @param region [String] API Region
# @return {Creature}
......@@ -245,6 +254,13 @@ module BlizzardApi
BlizzardApi::Wow::Talent.new(region)
end
##
# @param region [String] API Region
# @return {TechTalent}
def self.tech_talent(region = BlizzardApi.region)
BlizzardApi::Wow::TechTalent.new(region)
end
##
# @param region [String] API Region
# @return {Title}
......
# frozen_string_literal: true
module BlizzardApi
module Wow
##
# This class allows access to World of Warcraft azerite essences
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-game-data-api
#
# You can get an instance of this class using the default region as follows:
# api_instance = BlizzardApi::Wow.azerite_essence
class Covenant < Wow::GenericDataEndpoint
##
# Fetch media for one of the covenants listed by the {#index} using its *id*
#
# @param id [Integer] Covenant id
#
# @!macro request_options
#
# @!macro response
def media(id, options = {})
api_request "#{base_url(:media)}/covenant/#{id}", default_options.merge(options)
end
##
# Fetch all soulbinds
#
# @!macro request_options
#
# @!macro response
def soulbinds(options = {})
api_request "#{base_url(:game_data)}/covenant/soulbind/index", default_options.merge(options)
end
##
# Fetch a soulbind by its id
#
# @param id Soulbind id
#
# @!macro request_options
#
# @!macro response
def soulbind(id, options = {})
api_request "#{base_url(:game_data)}/covenant/soulbind/#{id}", default_options.merge(options)
end
##
# Fetch all conduits
#
# @!macro request_options
#
# @!macro response
def conduits(options = {})
api_request "#{base_url(:game_data)}/covenant/conduit/index", default_options.merge(options)
end
##
# Fetch a conduit by its id
#
# @param id Conduit id
#
# @!macro request_options
#
# @!macro response
def conduit(id, options = {})
api_request "#{base_url(:game_data)}/covenant/conduit/#{id}", default_options.merge(options)
end
protected
def endpoint_setup
@endpoint = 'covenant'
@namespace = :static
@collection = 'covenants'
@ttl = CACHE_TRIMESTER
end
end
end
end
# frozen_string_literal: true
module BlizzardApi
module Wow
##
# This class allows access to World of Warcraft talent data
#
# @see https://develop.battle.net/documentation/world-of-warcraft/game-data-apis
#
# You can get an instance of this class using the default region as follows:
# api_instance = BlizzardApi::Wow.talent
class TechTalent < Wow::GenericDataEndpoint
##
# Fetch tech talent trees
#
# @!macro request_options
#
# @!macro response
def tech_talent_trees(options = {})
api_request "#{base_url(:game_data)}/tech-talent-tree/index", default_options.merge(options)
end
##
# Fetch a tech talent tree
#
# @param id [Integer] Tech talent id
#
# @!macro request_options
#
# @!macro response
def tech_talent_tree(id, options = {})
api_request "#{base_url(:game_data)}/tech-talent-tree/#{id}", default_options.merge(options)
end
##
# Fetch a tech talent media
#
# @param id [Integer] Tech talent id
#
# @!macro request_options
#
# @!macro response
def media(id, options = {})
api_request "#{base_url(:media)}/tech-talent/#{id}", default_options.merge(options)
end
protected
def endpoint_setup
@endpoint = 'tech-talent'
@namespace = :static
@collection = 'tech-talents'
@ttl = CACHE_TRIMESTER
end
end
end
end
......@@ -313,6 +313,20 @@ module BlizzardApi
character_request realm, character, options, 'reputations'
end
##
# Return a character's soulbinds
#
# @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 soulbinds(realm, character, options = {})
character_request realm, character, options, 'soulbinds'
end
##
# Return a character's specialization
#
......
......@@ -11,7 +11,7 @@ module BlizzardApi
def test_achievement_index
achievement_data = @achievement.index
assert_equal 5418, achievement_data[:achievements].count
assert achievement_data.key? :achievements
end
def test_achievement_get
......
# frozen_string_literal: true
require 'test_helper'
module BlizzardApi
module Wow
class CovenantTest < Minitest::Test
def setup
@covenant = BlizzardApi::Wow.covenant
end
def test_covenant_index
data = @covenant.index
assert_equal 4, data[:covenants].count
end
def test_covenant_get
data = @covenant.get 3
assert_equal 'Night Fae', data[:name][:en_US]
end
def test_covenant_media
data = @covenant.media 3
assert data.key? :assets
end
def test_soulbind_index
data = @covenant.soulbinds
assert data.key? :soulbinds
end
def test_soulbind_get
data = @covenant.soulbind 1
assert_equal 'Niya', data[:name][:en_US]
end
def test_conduit_index
data = @covenant.conduits
assert data.key? :conduits
end
def test_conduit_get
data = @covenant.conduit 10
assert_equal 'Fueled by Violence', data[:name][:en_US]
end
end
end
end
......@@ -11,7 +11,7 @@ module BlizzardApi
def test_pet_index
pet_data = @pet.index
assert_equal 1365, pet_data[:pets].count
assert pet_data.key? :pets
end
def test_pet_get
......@@ -26,7 +26,7 @@ module BlizzardApi
def test_pet_ability_index
pet_data = @pet.abilities
assert_equal 669, pet_data[:abilities].count
assert pet_data.key? :abilities
end
def test_pet_ability_get
......
......@@ -21,7 +21,7 @@ module BlizzardApi
def test_reputation_tier_index
reputation_data = @reputation.tiers
assert_equal 53, reputation_data[:reputation_tiers].count
assert_equal 55, reputation_data[:reputation_tiers].count
end
def test_reputation_tier_get
......
......@@ -11,7 +11,7 @@ module BlizzardApi
def test_talent_index
talent_data = @talent.index
assert_equal 636, talent_data[:talents].count
assert talent_data.key? :talents
end
def test_talent_get
......@@ -21,7 +21,7 @@ module BlizzardApi
def test_pvp_talent_index
talent_data = @talent.pvp_talents
assert_equal 389, talent_data[:pvp_talents].count
assert_equal 390, talent_data[:pvp_talents].count
end
def test_pvp_talent_get
......
# frozen_string_literal: true
require 'test_helper'
module BlizzardApi
module Wow
class TechTalentTest < Minitest::Test
def setup
@talent = BlizzardApi::Wow.tech_talent
end
def test_tech_talent_index
talent_data = @talent.index
assert talent_data.key? :talents
end
def test_tech_talent_get
talent_data = @talent.get 807
assert_equal 'Skillful Duelist', talent_data[:name][:en_US]
end
def test_tech_talent_media
talent_data = @talent.media 807
assert_equal 'https://render-us.worldofwarcraft.com/icons/56/inv_tabard_duelersguild.jpg', talent_data[:assets][0][:value]
end
def test_tech_talent_tree_index
talent_data = @talent.tech_talent_trees
assert talent_data.key? :talent_trees
end
def test_tech_talent_tree
talent_data = @talent.tech_talent_tree 272
assert_equal 5, talent_data[:max_tiers]
end
end
end
end
......@@ -26,7 +26,7 @@ module BlizzardApi
def test_character_appearance
character_data = @character.appearance 'Azralon', 'Schiller'
assert_equal 4, character_data[:appearance][:face_variation]
assert character_data.key? :customizations
end
def test_character_encounters
......@@ -52,7 +52,7 @@ module BlizzardApi
def test_character_media
character_data = @character.media 'Azralon', 'Schiller'
assert character_data.key? :avatar_url
assert character_data[:assets].map { |item| item[:key] }.include?('avatar')
end
def test_character_pvp_summary
......
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