Commit 566edbd5 authored by Francis's avatar Francis
Browse files

Update for Visions of N'Zoth

parent 186f7dfe
Pipeline #122187986 passed with stage
in 5 minutes and 4 seconds
Please view this file on the master branch, otherwise it may be outdated
**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
**Attention:** Removed compatibility with community endpoints for all migrated endpoints.
**Version 0.3.1**
https://us.forums.blizzard.com/en/blizzard/t/hearthstone-api-updates/2978
......
PATH
remote: .
specs:
blizzard_api (0.3.1)
blizzard_api (0.3.2)
redis (~> 4.1, >= 4.1.0)
GEM
......@@ -14,7 +14,7 @@ GEM
parser (2.6.3.0)
ast (~> 2.4.0)
rainbow (3.0.0)
rake (10.5.0)
rake (13.0.1)
redis (4.1.3)
rubocop (0.74.0)
jaro_winkler (~> 1.5.1)
......@@ -32,7 +32,7 @@ PLATFORMS
DEPENDENCIES
blizzard_api!
minitest (~> 5.0)
rake (~> 10.0)
rake (~> 13.0)
rubocop (~> 0.61)
BUNDLED WITH
......
......@@ -35,6 +35,6 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency 'redis', '~> 4.1', '>= 4.1.0'
spec.add_development_dependency 'minitest', '~> 5.0'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rubocop', '~> 0.61'
end
......@@ -50,7 +50,8 @@ module BlizzardApi
game_data: 'https://%s.api.blizzard.com/data/%s',
community: 'https://%s.api.blizzard.com/%s',
profile: 'https://%s.api.blizzard.com/profile/%s',
media: 'https://%s.api.blizzard.com/data/%s/media'
media: 'https://%s.api.blizzard.com/data/%s/media',
user_profile: 'https://%s.api.blizzard.com/profile/user/%s'
}.freeze
##
......
......@@ -2,5 +2,5 @@
module BlizzardApi
# Gem version
VERSION = '0.3.1'
VERSION = '0.3.2'
end
......@@ -8,30 +8,33 @@ module BlizzardApi
# WoW data api
require_relative 'wow/game_data/achievement'
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/creature'
require_relative 'wow/game_data/guild'
require_relative 'wow/game_data/guild_crest'
require_relative 'wow/game_data/item'
require_relative 'wow/game_data/journal'
require_relative 'wow/game_data/mount'
require_relative 'wow/game_data/mythic_keystone_affix'
require_relative 'wow/game_data/mythic_keystone'
require_relative 'wow/game_data/mythic_raid_leaderboard'
require_relative 'wow/game_data/mount'
require_relative 'wow/game_data/mythic_keystone_leaderboard'
require_relative 'wow/game_data/pet'
require_relative 'wow/game_data/playable_class'
require_relative 'wow/game_data/playable_race'
require_relative 'wow/game_data/playable_specialization'
require_relative 'wow/game_data/power_type'
require_relative 'wow/game_data/pvp_season'
require_relative 'wow/game_data/pvp_tier'
require_relative 'wow/game_data/quest'
require_relative 'wow/game_data/realm'
require_relative 'wow/game_data/region'
require_relative 'wow/game_data/wow_token'
require_relative 'wow/game_data/race'
require_relative 'wow/game_data/reputation'
require_relative 'wow/game_data/spell'
require_relative 'wow/game_data/talent'
require_relative 'wow/game_data/title'
require_relative 'wow/game_data/item'
require_relative 'wow/game_data/azerite_essence'
require_relative 'wow/game_data/reputation_tier'
require_relative 'wow/game_data/reputation_faction'
require_relative 'wow/game_data/wow_token'
##
# @return {Achievement}
......@@ -39,6 +42,18 @@ module BlizzardApi
BlizzardApi::Wow::Achievement.new
end
##
# @return {Auction}
def self.auction
BlizzardApi::Wow::Auction.new
end
##
# @return {AzeriteEssence}
def self.azerite_essence
BlizzardApi::Wow::AzeriteEssence.new
end
##
# @return {ConnectedRealm}
def self.connected_realm
......@@ -51,18 +66,30 @@ module BlizzardApi
BlizzardApi::Wow::Creature.new
end
##
# @return {Guild}
def self.guild
BlizzardApi::Wow::Guild.new
end
##
# @return {GuildCrest}
def self.guild_crest
BlizzardApi::Wow::GuildCrest.new
end
##
# @return {Item}
def self.item
BlizzardApi::Wow::Item.new
end
##
# @return {Journal}
def self.journal
BlizzardApi::Wow::Journal.new
end
##
# @return {Mount}
def self.mount
BlizzardApi::Wow::Mount.new
end
##
# @return {MythicKeystoneAffix}
def self.mythic_keystone_affix
......@@ -81,12 +108,6 @@ module BlizzardApi
BlizzardApi::Wow::MythicRaidLeaderboard.new
end
##
# @return {Mount}
def self.mount
BlizzardApi::Wow::Mount.new
end
##
# @return {MythicKeystoneLeaderboard}
def self.mythic_keystone_leaderboard
......@@ -105,6 +126,12 @@ module BlizzardApi
BlizzardApi::Wow::PlayableClass.new
end
##
# @return {Race}
def self.playable_race
BlizzardApi::Wow::PlayableRace.new
end
##
# @return {PlayableSpecialization}
def self.playable_specialization
......@@ -129,6 +156,12 @@ module BlizzardApi
BlizzardApi::Wow::PvpTier.new
end
##
# @return {Quest}
def self.quest
BlizzardApi::Wow::Quest.new
end
##
# @return {Realm}
def self.realm
......@@ -142,63 +175,42 @@ module BlizzardApi
end
##
# @return {WowToken}
def self.wow_token
BlizzardApi::Wow::WowToken.new
end
##
# @return {Race}
def self.race
BlizzardApi::Wow::Race.new
end
##
# @return {Title}
def self.title
BlizzardApi::Wow::Title.new
# @return {Reputation}
def self.reputation
BlizzardApi::Wow::Reputation.new
end
##
# @return {Item}
def self.item
BlizzardApi::Wow::Item.new
# @return {Spell}
def self.spell
BlizzardApi::Wow::Spell.new
end
##
# @return {AzeriteEssence}
def self.azerite_essence
BlizzardApi::Wow::AzeriteEssence.new
# @return {Talent}
def self.talent
BlizzardApi::Wow::Talent.new
end
##
# @return {ReputationTier}
def self.reputation_tier
BlizzardApi::Wow::ReputationTier.new
# @return {Title}
def self.title
BlizzardApi::Wow::Title.new
end
##
# @return {ReputationFaction}
def self.reputation_faction
BlizzardApi::Wow::ReputationFaction.new
# @return {WowToken}
def self.wow_token
BlizzardApi::Wow::WowToken.new
end
# Wow community api
require_relative 'wow/community/auction'
require_relative 'wow/community/boss'
require_relative 'wow/community/challenge'
require_relative 'wow/community/pvp'
require_relative 'wow/community/quest'
require_relative 'wow/community/recipe'
require_relative 'wow/community/spell'
require_relative 'wow/community/zone'
##
# @return {Auction}
def self.auction
BlizzardApi::Wow::Auction.new
end
##
# @return {Boss}
def self.boss
......@@ -223,32 +235,38 @@ module BlizzardApi
BlizzardApi::Wow::PvP.new
end
##
# @return {Quest}
def self.quest
BlizzardApi::Wow::Quest.new
end
##
# @return {Recipe}
def self.recipe
BlizzardApi::Wow::Recipe.new
end
##
# @return {Spell}
def self.spell
BlizzardApi::Wow::Spell.new
end
##
# @return {Zone}
def self.zone
BlizzardApi::Wow::Zone.new
end
require_relative 'wow/profile/profile'
require_relative 'wow/profile/guild'
require_relative 'wow/profile/character_profile'
##
# @param token [String] A token obtained using the authorization_code flow
#
# @!macro request_options
#
# @return {Profile}
def self.profile(token)
BlizzardApi::Wow::Profile.new(token)
end
##
# @return {Guild}
def self.guild
BlizzardApi::Wow::Guild.new
end
##
# @return {CharacterProfile}
def self.character_profile
......
# frozen_string_literal: true
module BlizzardApi
module Wow
##
# This class allows access to World of Warcraft quest data
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
#
# @deprecated See https://us.forums.blizzard.com/en/blizzard/t/world-of-warcraft-community-api-migration/767
#
# You can get an instance of this class using the default region as follows:
# api_instance = BlizzardApi::Wow.quest
class Quest < Wow::Request
##
# Return information about a quest by its id
#
# @param id [Integer] Quest id
# @!macro request_options
#
# @!macro response
def get(id, options = {})
api_request "#{base_url(:community)}/quest/#{id}", { ttl: CACHE_TRIMESTER }.merge(options)
end
end
end
end
# frozen_string_literal: true
module BlizzardApi
module Wow
##
# This class allows access to World of Warcraft spell data
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
#
# @deprecated See https://us.forums.blizzard.com/en/blizzard/t/world-of-warcraft-community-api-migration/767
#
# You can get an instance of this class using the default region as follows:
# api_instance = BlizzardApi::Wow.spell
class Spell < Wow::Request
##
# Return information about a spell by its id
#
# @param id [Integer] Spell id
# @!macro request_options
#
# @!macro response
def get(id, options = {})
api_request "#{base_url(:community)}/spell/#{id}", { ttl: CACHE_TRIMESTER }.merge(options)
end
end
end
end
......@@ -10,22 +10,6 @@ module BlizzardApi
# You can get an instance of this class using the default region as follows:
# api_instance = BlizzardApi::Wow.achievement
class Achievement < Wow::GenericDataEndpoint
##
# Fetch all possible data for one of the items listed by the {#index} using its *id*
#
# @param id [Integer] One of the IDs returned by the {#index}
#
# @!macro request_options
# @option options [Boolean] :use_community_endpoint If set to true, this method will call the community endpoint
# instead of the data endpoint https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
#
# @!macro response
def get(id, options = {})
return super id, options unless options.include? :use_community_endpoint
api_request "#{base_url(:community)}/achievement/#{id}", { ttl: CACHE_TRIMESTER }.merge(options)
end
##
# This method overrides the inherited default behavior to prevent high server load and fetch time
#
......
......@@ -5,22 +5,21 @@ module BlizzardApi
##
# This class allows access to World of Warcraft auctions
#
# @deprecated See https://us.forums.blizzard.com/en/blizzard/t/world-of-warcraft-community-api-migration/767
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
# @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.auction
class Auction < Wow::Request
##
# Return a link to the most recent dump of all active auctions for the desired realm
# Return all active auctions for the specified connected realm
#
# @param realm [String] Realm's slug
# @param connected_realm_id [Integer] A valid connected realm id
# @!macro request_options
#
# @!macro response
def get(realm, options = {})
api_request "#{base_url(:community)}/auction/data/#{realm}", { ttl: CACHE_HOUR }.merge(options)
def get(connected_realm_id, options = {})
opts = { ttl: CACHE_HOUR, namespace: :dynamic }.merge(options)
api_request "#{base_url(:game_data)}/connected-realm/#{connected_realm_id}/auctions", opts
end
end
end
......
......@@ -5,7 +5,7 @@ module BlizzardApi
##
# This class allows access to World of Warcraft item data
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
# @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.item
......@@ -26,47 +26,14 @@ module BlizzardApi
raise BlizzardApi::ApiException, 'This endpoint does not have a complete method'
end
##
# Return complete data of an item by id
#
# @param id [Integer] Item id
# @!macro request_options
# @option options [Boolean] :use_community_endpoint If set to true, this method will call the community endpoint
# instead of the data endpoint https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
# @option options [Boolean] :classic If set to true, this method will call the classic version
#
# @!macro response
def get(id, options = {})
return super id, options unless options.include? :use_community_endpoint
api_request "#{base_url(:community)}/item/#{id}", { ttl: CACHE_TRIMESTER }.merge(options)
end
##
# Return complete data of an item set by id
#
# @param set_id [Integer] Item set id
# @!macro request_options
#
# @!macro response
def item_set(set_id, options = {})
api_request "#{base_url(:community)}/item/set/#{set_id}", { ttl: CACHE_TRIMESTER }.merge(options)
end
##
# Return a list of item classes
#
# @!macro request_options
# @option options [Boolean] :use_community_endpoint If set to true, this method will call the community endpoint
# instead of the data endpoint https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
# @option options [Boolean] :classic If set to true, this method will call the classic version
#
# @!macro response
def classes(options = {})
if options.include? :use_community_endpoint
return api_request "#{base_url(:community)}/data/item/classes", { ttl: CACHE_TRIMESTER }.merge(options)
end
api_request "#{endpoint_uri('class')}/index", default_options.merge(options)
end
......@@ -108,6 +75,27 @@ module BlizzardApi
api_request "#{base_url(:media)}/item/#{id}", default_options.merge(options)
end
##
# Return a list of item sets
#
# @!macro request_options
#
# @!macro response
def sets(options = {})
api_request "#{endpoint_uri('set')}/index", default_options.merge(options)
end
##
# Return data about an item set
#
# @param id [Integer] Item set id
# @!macro request_options
#
# @!macro response
def set(id, options = {})
api_request "#{endpoint_uri('set')}/#{id}", default_options.merge(options)
end
protected
def endpoint_setup
......
# frozen_string_literal: true
module BlizzardApi
module Wow
##
# This class allows access to World of Warcraft journal 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.journal
class Journal < Wow::GenericDataEndpoint
##
# This method overrides the inherited default behavior to prevent high server load and fetch time
#
# @!macro response
def index
raise BlizzardApi::ApiException, 'This endpoint does not have a index method'
end
##
# This method overrides the inherited default behavior to prevent high server load and fetch time
#
# @!macro response
def complete
raise BlizzardApi::ApiException, 'This endpoint does not have a complete method'
end
##
# This method overrides the inherited default behavior to prevent high server load and fetch time
#
# @!macro response
def get(_id, _options = {})
raise BlizzardApi::ApiException, 'This endpoint does not have a get method'
end
##
# Return a list of expansion journal entries
#
# @!macro request_options
#
# @!macro response
def expansions(options = {})
api_request "#{endpoint_uri('expansion')}/index", default_options.merge(options)
end
##
# Return data about an expansion journal entry
#
# @param id [Integer] Journal entry id
# @!macro request_options
#
# @!macro response
def expansion(id, options = {})
api_request "#{endpoint_uri('expansion')}/#{id}", default_options.merge(options)
end
##
# Return a list of instance journal entries
#
# @!macro request_options
#
# @!macro response
def instances(options = {})
api_request "#{endpoint_uri('instance')}/index", default_options.merge(options)
end
##
# Return data about an instance journal entry
#
# @param id [Integer] Journal entry id
# @!macro request_options
#
# @!macro response
def instance(id, options = {})
api_request "#{endpoint_uri('instance')}/#{id}", default_options.merge(options)
end