Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
9
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
Francis
Blizzard api
Commits
974d2dd6
Commit
974d2dd6
authored
Oct 23, 2020
by
Francis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added modified crafting endpoints
parent
16c50b69
Pipeline
#207051498
passed with stage
in 5 minutes and 37 seconds
Changes
18
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
142 additions
and
24 deletions
+142
-24
CHANGELOG.md
CHANGELOG.md
+4
-0
Gemfile.lock
Gemfile.lock
+1
-1
lib/blizzard_api/version.rb
lib/blizzard_api/version.rb
+1
-1
lib/blizzard_api/wow.rb
lib/blizzard_api/wow.rb
+8
-0
lib/blizzard_api/wow/game_data/modified_crafting.rb
lib/blizzard_api/wow/game_data/modified_crafting.rb
+67
-0
test/blizzard/wow/game_data/achievement_test.rb
test/blizzard/wow/game_data/achievement_test.rb
+5
-5
test/blizzard/wow/game_data/auction_test.rb
test/blizzard/wow/game_data/auction_test.rb
+3
-3
test/blizzard/wow/game_data/connected_realm_test.rb
test/blizzard/wow/game_data/connected_realm_test.rb
+1
-1
test/blizzard/wow/game_data/creature_test.rb
test/blizzard/wow/game_data/creature_test.rb
+1
-1
test/blizzard/wow/game_data/journal_test.rb
test/blizzard/wow/game_data/journal_test.rb
+1
-1
test/blizzard/wow/game_data/modified_crafting_test.rb
test/blizzard/wow/game_data/modified_crafting_test.rb
+39
-0
test/blizzard/wow/game_data/mythic_keystone_test.rb
test/blizzard/wow/game_data/mythic_keystone_test.rb
+1
-1
test/blizzard/wow/game_data/pets_test.rb
test/blizzard/wow/game_data/pets_test.rb
+2
-2
test/blizzard/wow/game_data/playable_class_test.rb
test/blizzard/wow/game_data/playable_class_test.rb
+1
-1
test/blizzard/wow/game_data/profession_test.rb
test/blizzard/wow/game_data/profession_test.rb
+1
-1
test/blizzard/wow/game_data/reputation_test.rb
test/blizzard/wow/game_data/reputation_test.rb
+1
-1
test/blizzard/wow/game_data/talent_test.rb
test/blizzard/wow/game_data/talent_test.rb
+4
-4
test/blizzard/wow/game_data/title_test.rb
test/blizzard/wow/game_data/title_test.rb
+1
-1
No files found.
CHANGELOG.md
View file @
974d2dd6
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
...
...
Gemfile.lock
View file @
974d2dd6
PATH
remote: .
specs:
blizzard_api (0.5.
0
)
blizzard_api (0.5.
1
)
redis (~> 4.1, >= 4.1.0)
GEM
...
...
lib/blizzard_api/version.rb
View file @
974d2dd6
...
...
@@ -2,5 +2,5 @@
module
BlizzardApi
# Gem version
VERSION
=
'0.5.
0
'
VERSION
=
'0.5.
1
'
end
lib/blizzard_api/wow.rb
View file @
974d2dd6
...
...
@@ -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}
...
...
lib/blizzard_api/wow/game_data/modified_crafting.rb
0 → 100644
View file @
974d2dd6
# 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
test/blizzard/wow/game_data/achievement_test.rb
View file @
974d2dd6
...
...
@@ -11,7 +11,7 @@ module BlizzardApi
def
test_achievement_index
achievement_data
=
@achievement
.
index
assert_equal
5
131
,
achievement_data
[
:achievements
].
count
assert_equal
5
418
,
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
...
...
test/blizzard/wow/game_data/auction_test.rb
View file @
974d2dd6
...
...
@@ -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
...
...
test/blizzard/wow/game_data/connected_realm_test.rb
View file @
974d2dd6
...
...
@@ -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
1
8
,
realm_data
[
:results
].
size
assert_equal
1
7
,
realm_data
[
:results
].
size
end
end
end
...
...
test/blizzard/wow/game_data/creature_test.rb
View file @
974d2dd6
...
...
@@ -19,7 +19,7 @@ module BlizzardApi
def
test_creature_families
creature_families_data
=
@creature
.
families
assert_equal
7
8
,
creature_families_data
[
:creature_families
].
count
assert_equal
8
1
,
creature_families_data
[
:creature_families
].
count
creature_families_data
=
@creature
.
families
classic:
true
assert_equal
23
,
creature_families_data
[
:creature_families
].
count
...
...
test/blizzard/wow/game_data/journal_test.rb
View file @
974d2dd6
...
...
@@ -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
...
...
test/blizzard/wow/game_data/modified_crafting_test.rb
0 → 100644
View file @
974d2dd6
# 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
test/blizzard/wow/game_data/mythic_keystone_test.rb
View file @
974d2dd6
...
...
@@ -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
...
...
test/blizzard/wow/game_data/pets_test.rb
View file @
974d2dd6
...
...
@@ -11,7 +11,7 @@ module BlizzardApi
def
test_pet_index
pet_data
=
@pet
.
index
assert_equal
1
280
,
pet_data
[
:pets
].
count
assert_equal
1
365
,
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
6
5
6
,
pet_data
[
:abilities
].
count
assert_equal
66
9
,
pet_data
[
:abilities
].
count
end
def
test_pet_ability_get
...
...
test/blizzard/wow/game_data/playable_class_test.rb
View file @
974d2dd6
...
...
@@ -35,7 +35,7 @@ module BlizzardApi
def
test_playable_class_talent_slots
data
=
@playable_class
.
talent_slots
11
assert_equal
2
0
,
data
[
:talent_slots
][
0
][
:unlock_player_level
]
assert_equal
1
0
,
data
[
:talent_slots
][
0
][
:unlock_player_level
]
end
def
test_playable_class_media
...
...
test/blizzard/wow/game_data/profession_test.rb
View file @
974d2dd6
...
...
@@ -11,7 +11,7 @@ module BlizzardApi
def
test_profession_index
profession_data
=
@profession
.
index
assert_equal
1
4
,
profession_data
[
:professions
].
count
assert_equal
1
7
,
profession_data
[
:professions
].
count
end
def
test_profession_get
...
...
test/blizzard/wow/game_data/reputation_test.rb
View file @
974d2dd6
...
...
@@ -21,7 +21,7 @@ module BlizzardApi
def
test_reputation_tier_index
reputation_data
=
@reputation
.
tiers
assert_equal
3
7
,
reputation_data
[
:reputation_tiers
].
count
assert_equal
5
3
,
reputation_data
[
:reputation_tiers
].
count
end
def
test_reputation_tier_get
...
...
test/blizzard/wow/game_data/talent_test.rb
View file @
974d2dd6
...
...
@@ -11,7 +11,7 @@ module BlizzardApi
def
test_talent_index
talent_data
=
@talent
.
index
assert_equal
6
48
,
talent_data
[
:talents
].
count
assert_equal
6
36
,
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
...
...
test/blizzard/wow/game_data/title_test.rb
View file @
974d2dd6
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment