Commit 974d2dd6 authored by Francis's avatar Francis

Added modified crafting endpoints

parent 16c50b69
Pipeline #207051498 passed with stage
in 5 minutes and 37 seconds
Please view this file on the master branch, otherwise it may be outdated
**Version 0.5.1**
Added new endpoints: https://us.forums.blizzard.com/en/blizzard/t/wow-game-data-api-modified-crafting-support/12727
**Version 0.5.0**
This version brings a lot of internal changes to the way the gem works. While
......
PATH
remote: .
specs:
blizzard_api (0.5.0)
blizzard_api (0.5.1)
redis (~> 4.1, >= 4.1.0)
GEM
......
......@@ -2,5 +2,5 @@
module BlizzardApi
# Gem version
VERSION = '0.5.0'
VERSION = '0.5.1'
end
......@@ -19,6 +19,7 @@ module BlizzardApi
require_relative 'wow/game_data/item'
require_relative 'wow/game_data/journal'
require_relative 'wow/game_data/media'
require_relative 'wow/game_data/modified_crafting'
require_relative 'wow/game_data/mount'
require_relative 'wow/game_data/mythic_keystone_affix'
require_relative 'wow/game_data/mythic_keystone'
......@@ -104,6 +105,13 @@ module BlizzardApi
BlizzardApi::Wow::Media.new(region)
end
##
# @param region [String] API Region
# @return {ModifiedCrafting}
def self.modified_crafting(region = BlizzardApi.region)
BlizzardApi::Wow::ModifiedCrafting.new(region)
end
##
# @param region [String] API Region
# @return {Mount}
......
# frozen_string_literal: true
module BlizzardApi
module Wow
##
# This class allows access to World of Warcraft professions
#
# @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.modified_crafting
class ModifiedCrafting < Wow::GenericDataEndpoint
def complete
raise BlizzardApi::ApiException, 'This endpoint does not have a complete method.'
end
##
# Fetch modified crafting category index
#
# @!macro request_options
def categories(options = {})
api_request "#{base_url(:game_data)}/modified-crafting/category/index", default_options.merge(options)
end
##
# Fetch a modified crafting category
#
# @param id [Integer] Modified crafting category id
#
# @!macro request_options
#
# @!macro response
def category(id, options = {})
api_request "#{base_url(:game_data)}/modified-crafting/category/#{id}", default_options.merge(options)
end
##
# Fetch modified crafting slot type index
#
# @!macro request_options
def slot_types(options = {})
api_request "#{base_url(:game_data)}/modified-crafting/reagent-slot-type/index", default_options.merge(options)
end
##
# Fetch a modified crafting slot type
#
# @param id [Integer] Modified crafting slot type id
#
# @!macro request_options
#
# @!macro response
def slot_type(id, options = {})
api_request "#{base_url(:game_data)}/modified-crafting/reagent-slot-type/#{id}", default_options.merge(options)
end
protected
def endpoint_setup
@endpoint = 'modified-crafting'
@namespace = :static
@collection = 'professions'
@ttl = CACHE_TRIMESTER
end
end
end
end
......@@ -11,7 +11,7 @@ module BlizzardApi
def test_achievement_index
achievement_data = @achievement.index
assert_equal 5131, achievement_data[:achievements].count
assert_equal 5418, achievement_data[:achievements].count
end
def test_achievement_get
......@@ -27,15 +27,15 @@ module BlizzardApi
def test_achievement_categories
achievement_categories_data = @achievement.categories
assert_equal 14, achievement_categories_data[:root_categories].count
assert_equal 115, achievement_categories_data[:categories].count
assert_equal 24, achievement_categories_data[:guild_categories].count
assert achievement_categories_data.key?(:root_categories)
assert achievement_categories_data.key?(:categories)
assert achievement_categories_data.key?(:guild_categories)
end
def test_achievement_category
achievement_categories_data = @achievement.category 81
assert_equal 'Feats of Strength', achievement_categories_data[:name][:en_US]
assert_equal 109, achievement_categories_data[:achievements].count
assert achievement_categories_data.key?(:achievements)
end
def test_achievement_media
......
......@@ -11,17 +11,17 @@ module BlizzardApi
end
def test_auction_get
auction_data = @auction.get 1146
auction_data = @auction.get 4
assert auction_data.key? :auctions
end
def test_auction_modified_get
auction_data = @auction.get 1146, since: DateTime.parse('2000-01-01Z')
auction_data = @auction.get 4, since: DateTime.parse('2000-01-01Z')
assert auction_data.key? :auctions
end
def test_auction_unmodified_get
auction_data = @auction.get 1146, since: DateTime.parse('2099-01-01Z')
auction_data = @auction.get 4, since: DateTime.parse('2099-01-01Z')
assert_nil auction_data
end
end
......
......@@ -48,7 +48,7 @@ module BlizzardApi
realm_data = @connected_realm.search(1, 100) do |options|
options.where 'id', min: 60, max: 100
end
assert_equal 18, realm_data[:results].size
assert_equal 17, realm_data[:results].size
end
end
end
......
......@@ -19,7 +19,7 @@ module BlizzardApi
def test_creature_families
creature_families_data = @creature.families
assert_equal 78, creature_families_data[:creature_families].count
assert_equal 81, creature_families_data[:creature_families].count
creature_families_data = @creature.families classic: true
assert_equal 23, creature_families_data[:creature_families].count
......
......@@ -11,7 +11,7 @@ module BlizzardApi
def test_journal_expansions
journal_data = @journal.expansions
assert_equal 8, journal_data[:tiers].count
assert_equal 9, journal_data[:tiers].count
end
def test_journal_expansion
......
# frozen_string_literal: true
require 'test_helper'
module BlizzardApi
module Wow
class ModifiedCraftingTest < Minitest::Test
def setup
@modified_crafting = BlizzardApi::Wow.modified_crafting
end
def test_modified_crafting_index
data = @modified_crafting.index
assert data.key?(:categories)
assert data.key?(:slot_types)
end
def test_modified_crafting_categories
data = @modified_crafting.categories
assert data.key?(:categories)
end
def test_modified_crafting_category
data = @modified_crafting.category 1
assert_equal 'Specify Haste', data[:name][:en_US]
end
def test_modified_crafting_slot_types
data = @modified_crafting.slot_types
assert data.key?(:slot_types)
end
def test_modified_crafting_slot_type
data = @modified_crafting.slot_type 16
assert_equal 'Increase Item Level', data[:description][:en_US]
end
end
end
end
......@@ -37,7 +37,7 @@ module BlizzardApi
def test_mythic_keystone_seasons
mythic_keystone_seasons_data = @mythic_keystone.seasons
assert_equal 5, mythic_keystone_seasons_data[:seasons].count
assert_equal 4, mythic_keystone_seasons_data[:seasons].count
end
def test_mythic_keystone_season
......
......@@ -11,7 +11,7 @@ module BlizzardApi
def test_pet_index
pet_data = @pet.index
assert_equal 1280, pet_data[:pets].count
assert_equal 1365, pet_data[:pets].count
end
def test_pet_get
......@@ -26,7 +26,7 @@ module BlizzardApi
def test_pet_ability_index
pet_data = @pet.abilities
assert_equal 656, pet_data[:abilities].count
assert_equal 669, pet_data[:abilities].count
end
def test_pet_ability_get
......
......@@ -35,7 +35,7 @@ module BlizzardApi
def test_playable_class_talent_slots
data = @playable_class.talent_slots 11
assert_equal 20, data[:talent_slots][0][:unlock_player_level]
assert_equal 10, data[:talent_slots][0][:unlock_player_level]
end
def test_playable_class_media
......
......@@ -11,7 +11,7 @@ module BlizzardApi
def test_profession_index
profession_data = @profession.index
assert_equal 14, profession_data[:professions].count
assert_equal 17, profession_data[:professions].count
end
def test_profession_get
......
......@@ -21,7 +21,7 @@ module BlizzardApi
def test_reputation_tier_index
reputation_data = @reputation.tiers
assert_equal 37, reputation_data[:reputation_tiers].count
assert_equal 53, 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 648, talent_data[:talents].count
assert_equal 636, talent_data[:talents].count
end
def test_talent_get
......@@ -21,12 +21,12 @@ module BlizzardApi
def test_pvp_talent_index
talent_data = @talent.pvp_talents
assert_equal 508, talent_data[:pvp_talents].count
assert_equal 389, talent_data[:pvp_talents].count
end
def test_pvp_talent_get
talent_data = @talent.pvp_talent 3
assert_equal 'Gladiator\'s Medallion', talent_data[:spell][:name][:en_US]
talent_data = @talent.pvp_talent 11
assert_equal 'Bane of Fragility', talent_data[:spell][:name][:en_US]
end
end
end
......
......@@ -11,7 +11,7 @@ module BlizzardApi
def test_title_index
title_data = @title.index
assert_equal 375, title_data[:titles].count
assert title_data.key?(:titles)
end
def test_title_get
......
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