blizzard_api_rb_rb 3.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/workflows/ruby.yml +22 -0
- data/.gitignore +12 -0
- data/.rubocop.yml +18 -0
- data/.rubocop_todo.yml +7 -0
- data/CHANGELOG.md +269 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +50 -0
- data/LICENSE.txt +21 -0
- data/README.md +200 -0
- data/Rakefile +12 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/blizzard_api_rb.gemspec +44 -0
- data/lib/blizzard_api_rb/api_response.rb +27 -0
- data/lib/blizzard_api_rb/api_standards.rb +55 -0
- data/lib/blizzard_api_rb/configuration.rb +93 -0
- data/lib/blizzard_api_rb/diablo/community/act.rb +35 -0
- data/lib/blizzard_api_rb/diablo/community/artisan.rb +38 -0
- data/lib/blizzard_api_rb/diablo/community/character_class.rb +38 -0
- data/lib/blizzard_api_rb/diablo/community/follower.rb +25 -0
- data/lib/blizzard_api_rb/diablo/community/item.rb +25 -0
- data/lib/blizzard_api_rb/diablo/community/item_type.rb +35 -0
- data/lib/blizzard_api_rb/diablo/community/profile.rb +83 -0
- data/lib/blizzard_api_rb/diablo/game_data/era.rb +21 -0
- data/lib/blizzard_api_rb/diablo/game_data/generic_data_endpoint.rb +58 -0
- data/lib/blizzard_api_rb/diablo/game_data/season.rb +21 -0
- data/lib/blizzard_api_rb/diablo/request.rb +15 -0
- data/lib/blizzard_api_rb/diablo.rb +91 -0
- data/lib/blizzard_api_rb/exception.rb +14 -0
- data/lib/blizzard_api_rb/hearthstone/game_data/back.rb +59 -0
- data/lib/blizzard_api_rb/hearthstone/game_data/card.rb +111 -0
- data/lib/blizzard_api_rb/hearthstone/game_data/deck.rb +30 -0
- data/lib/blizzard_api_rb/hearthstone/game_data/generic_data_endpoint.rb +49 -0
- data/lib/blizzard_api_rb/hearthstone/game_data/metadata.rb +22 -0
- data/lib/blizzard_api_rb/hearthstone/request.rb +15 -0
- data/lib/blizzard_api_rb/hearthstone.rb +49 -0
- data/lib/blizzard_api_rb/overwatch_league/community/matches.rb +22 -0
- data/lib/blizzard_api_rb/overwatch_league/community/players.rb +22 -0
- data/lib/blizzard_api_rb/overwatch_league/community/segments.rb +22 -0
- data/lib/blizzard_api_rb/overwatch_league/community/summary.rb +22 -0
- data/lib/blizzard_api_rb/overwatch_league/community/teams.rb +22 -0
- data/lib/blizzard_api_rb/overwatch_league/request.rb +15 -0
- data/lib/blizzard_api_rb/overwatch_league.rb +50 -0
- data/lib/blizzard_api_rb/request.rb +189 -0
- data/lib/blizzard_api_rb/starcraft/community/account.rb +23 -0
- data/lib/blizzard_api_rb/starcraft/community/ladder.rb +34 -0
- data/lib/blizzard_api_rb/starcraft/community/legacy.rb +87 -0
- data/lib/blizzard_api_rb/starcraft/community/profile.rb +76 -0
- data/lib/blizzard_api_rb/starcraft/game_data/league.rb +27 -0
- data/lib/blizzard_api_rb/starcraft/request.rb +36 -0
- data/lib/blizzard_api_rb/starcraft.rb +57 -0
- data/lib/blizzard_api_rb/token_manager.rb +49 -0
- data/lib/blizzard_api_rb/version.rb +6 -0
- data/lib/blizzard_api_rb/wow/game_data/achievement.rb +46 -0
- data/lib/blizzard_api_rb/wow/game_data/auction.rb +50 -0
- data/lib/blizzard_api_rb/wow/game_data/azerite_essence.rb +30 -0
- data/lib/blizzard_api_rb/wow/game_data/connected_realm.rb +18 -0
- data/lib/blizzard_api_rb/wow/game_data/covenant.rb +72 -0
- data/lib/blizzard_api_rb/wow/game_data/creature.rb +102 -0
- data/lib/blizzard_api_rb/wow/game_data/generic_data_endpoint.rb +50 -0
- data/lib/blizzard_api_rb/wow/game_data/guild_crest.rb +48 -0
- data/lib/blizzard_api_rb/wow/game_data/heirloom.rb +16 -0
- data/lib/blizzard_api_rb/wow/game_data/item.rb +102 -0
- data/lib/blizzard_api_rb/wow/game_data/journal.rb +110 -0
- data/lib/blizzard_api_rb/wow/game_data/media.rb +26 -0
- data/lib/blizzard_api_rb/wow/game_data/modified_crafting.rb +60 -0
- data/lib/blizzard_api_rb/wow/game_data/mount.rb +18 -0
- data/lib/blizzard_api_rb/wow/game_data/mythic_keystone.rb +86 -0
- data/lib/blizzard_api_rb/wow/game_data/mythic_keystone_affix.rb +28 -0
- data/lib/blizzard_api_rb/wow/game_data/mythic_keystone_leaderboard.rb +48 -0
- data/lib/blizzard_api_rb/wow/game_data/mythic_raid_leaderboard.rb +28 -0
- data/lib/blizzard_api_rb/wow/game_data/pet.rb +62 -0
- data/lib/blizzard_api_rb/wow/game_data/playable_class.rb +39 -0
- data/lib/blizzard_api_rb/wow/game_data/playable_race.rb +16 -0
- data/lib/blizzard_api_rb/wow/game_data/playable_specialization.rb +65 -0
- data/lib/blizzard_api_rb/wow/game_data/power_type.rb +16 -0
- data/lib/blizzard_api_rb/wow/game_data/profession.rb +65 -0
- data/lib/blizzard_api_rb/wow/game_data/pvp_region.rb +82 -0
- data/lib/blizzard_api_rb/wow/game_data/pvp_season.rb +53 -0
- data/lib/blizzard_api_rb/wow/game_data/pvp_tier.rb +26 -0
- data/lib/blizzard_api_rb/wow/game_data/quest.rb +79 -0
- data/lib/blizzard_api_rb/wow/game_data/realm.rb +18 -0
- data/lib/blizzard_api_rb/wow/game_data/region.rb +16 -0
- data/lib/blizzard_api_rb/wow/game_data/reputation.rb +74 -0
- data/lib/blizzard_api_rb/wow/game_data/spell.rb +38 -0
- data/lib/blizzard_api_rb/wow/game_data/talent.rb +75 -0
- data/lib/blizzard_api_rb/wow/game_data/tech_talent.rb +50 -0
- data/lib/blizzard_api_rb/wow/game_data/title.rb +16 -0
- data/lib/blizzard_api_rb/wow/game_data/toy.rb +16 -0
- data/lib/blizzard_api_rb/wow/game_data/wow_token.rb +20 -0
- data/lib/blizzard_api_rb/wow/profile/account_profile.rb +97 -0
- data/lib/blizzard_api_rb/wow/profile/character_profile.rb +415 -0
- data/lib/blizzard_api_rb/wow/profile/guild.rb +75 -0
- data/lib/blizzard_api_rb/wow/request.rb +16 -0
- data/lib/blizzard_api_rb/wow/search/search_composer.rb +97 -0
- data/lib/blizzard_api_rb/wow/search/search_request.rb +24 -0
- data/lib/blizzard_api_rb/wow/slug.rb +12 -0
- data/lib/blizzard_api_rb/wow.rb +335 -0
- data/lib/blizzard_api_rb.rb +26 -0
- metadata +237 -0
@@ -0,0 +1,86 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Wow
|
5
|
+
##
|
6
|
+
# This class allows access to World of Warcraft achievements
|
7
|
+
#
|
8
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-game-data-api
|
9
|
+
#
|
10
|
+
# You can get an instance of this class using the default region as follows:
|
11
|
+
# api_instance = BlizzardApi::Wow.mythic_keystone
|
12
|
+
class MythicKeystone < Wow::GenericDataEndpoint
|
13
|
+
setup 'mythic-keystone', :dynamic, CACHE_TRIMESTER
|
14
|
+
|
15
|
+
def get
|
16
|
+
raise BlizzardApi::ApiException, 'Mythic keystone endpoint does not have a get method'
|
17
|
+
end
|
18
|
+
|
19
|
+
##
|
20
|
+
# Fetch all mythic keystone dungeons
|
21
|
+
#
|
22
|
+
# @!macro request_options
|
23
|
+
#
|
24
|
+
# @!macro response
|
25
|
+
def dungeons(**options)
|
26
|
+
api_request "#{endpoint_uri}/dungeon/index", **default_options.merge(options)
|
27
|
+
end
|
28
|
+
|
29
|
+
##
|
30
|
+
# Fetch all possible data for one of the items listed by the {#dungeons} using its *id*
|
31
|
+
#
|
32
|
+
# @param id [Integer] Dungeon id
|
33
|
+
#
|
34
|
+
# @!macro request_options
|
35
|
+
#
|
36
|
+
# @!macro response
|
37
|
+
def dungeon(id, **options)
|
38
|
+
api_request "#{endpoint_uri}/dungeon/#{id}", **default_options.merge(options)
|
39
|
+
end
|
40
|
+
|
41
|
+
##
|
42
|
+
# Fetch all mythic keystone periods
|
43
|
+
#
|
44
|
+
# @!macro request_options
|
45
|
+
#
|
46
|
+
# @!macro response
|
47
|
+
def periods(**options)
|
48
|
+
api_request "#{endpoint_uri}/period/index", **default_options.merge(options)
|
49
|
+
end
|
50
|
+
|
51
|
+
##
|
52
|
+
# Fetch all possible data for one of the items listed by the {#periods} using its *id*
|
53
|
+
#
|
54
|
+
# @param id [Integer] Mythic keystone period id
|
55
|
+
#
|
56
|
+
# @!macro request_options
|
57
|
+
#
|
58
|
+
# @!macro response
|
59
|
+
def period(id, **options)
|
60
|
+
api_request "#{endpoint_uri}/period/#{id}", **default_options.merge(options)
|
61
|
+
end
|
62
|
+
|
63
|
+
##
|
64
|
+
# Fetch all mythic keystone seasons
|
65
|
+
#
|
66
|
+
# @!macro request_options
|
67
|
+
#
|
68
|
+
# @!macro response
|
69
|
+
def seasons(**options)
|
70
|
+
api_request "#{endpoint_uri}/season/index", **default_options.merge(options)
|
71
|
+
end
|
72
|
+
|
73
|
+
##
|
74
|
+
# Fetch all possible data for one of the items listed by the {#seasons} using its *id*
|
75
|
+
#
|
76
|
+
# @param id [Integer] Mythic keystone season id
|
77
|
+
#
|
78
|
+
# @!macro request_options
|
79
|
+
#
|
80
|
+
# @!macro response
|
81
|
+
def season(id, **options)
|
82
|
+
api_request "#{endpoint_uri}/season/#{id}", **default_options.merge(options)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Wow
|
5
|
+
##
|
6
|
+
# This class allows access to World of Warcraft mythic keystone affixes
|
7
|
+
#
|
8
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-game-data-api
|
9
|
+
#
|
10
|
+
# You can get an instance of this class using the default region as follows:
|
11
|
+
# api_instance = BlizzardApi::Wow.mythic_keystone_affix
|
12
|
+
class MythicKeystoneAffix < Wow::GenericDataEndpoint
|
13
|
+
setup 'keystone-affix', :static, CACHE_TRIMESTER
|
14
|
+
|
15
|
+
##
|
16
|
+
# Fetch media for one of the affixes listed by the {#index} using its *id*
|
17
|
+
#
|
18
|
+
# @param id [Integer] Keystone affix id
|
19
|
+
#
|
20
|
+
# @!macro request_options
|
21
|
+
#
|
22
|
+
# @!macro response
|
23
|
+
def media(id, **options)
|
24
|
+
api_request "#{base_url(:media)}/keystone-affix/#{id}", **default_options.merge(options)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Wow
|
5
|
+
##
|
6
|
+
# This class allows access to World of Warcraft mythic raid leaderboard
|
7
|
+
#
|
8
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-game-data-api
|
9
|
+
#
|
10
|
+
# You can get an instance of this class using the default region as follows:
|
11
|
+
# api_instance = BlizzardApi::Wow.mythic_keystone_leaderboard
|
12
|
+
class MythicKeystoneLeaderboard < Wow::Request
|
13
|
+
##
|
14
|
+
# Fetch mythic keystone leaderboards for the specified realm
|
15
|
+
#
|
16
|
+
# @param connected_realm_id [Integer] One of the IDs returned by the {ConnectedRealm#index}
|
17
|
+
#
|
18
|
+
# @!macro request_options
|
19
|
+
#
|
20
|
+
# @!macro response
|
21
|
+
def index(connected_realm_id, **options)
|
22
|
+
api_request "#{endpoint_uri(connected_realm_id)}/index", **default_options(options)
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Fetch mythic keystone leaderboard for the specified realm, dungeon and period
|
27
|
+
#
|
28
|
+
# @param connected_realm_id [Integer] One of the IDs returned by the {ConnectedRealm#index}
|
29
|
+
#
|
30
|
+
# @!macro request_options
|
31
|
+
#
|
32
|
+
# @!macro response
|
33
|
+
def get(connected_realm_id, dungeon_id, period, **options)
|
34
|
+
api_request "#{endpoint_uri(connected_realm_id)}/#{dungeon_id}/period/#{period}", **default_options(options)
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def default_options(options)
|
40
|
+
{ ttl: CACHE_DAY, namespace: :dynamic }.merge options
|
41
|
+
end
|
42
|
+
|
43
|
+
def endpoint_uri(connected_realm_id)
|
44
|
+
"#{base_url(:game_data)}/connected-realm/#{connected_realm_id}/mythic-leaderboard"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Wow
|
5
|
+
##
|
6
|
+
# This class allows access to World of Warcraft mythic raid leaderboard
|
7
|
+
#
|
8
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-game-data-api
|
9
|
+
#
|
10
|
+
# You can get an instance of this class using the default region as follows:
|
11
|
+
# api_instance = BlizzardApi::Wow.mythic_raid_leaderboard
|
12
|
+
class MythicRaidLeaderboard < Wow::Request
|
13
|
+
##
|
14
|
+
# Fetch leaderboard data for given raid and faction
|
15
|
+
#
|
16
|
+
# @param raid [String] Raid slug
|
17
|
+
# @param faction [String] Faction slug
|
18
|
+
#
|
19
|
+
# @!macro request_options
|
20
|
+
#
|
21
|
+
# @!macro response
|
22
|
+
def get(raid, faction, **options)
|
23
|
+
opts = options.merge(namespace: :dynamic, ttl: CACHE_DAY)
|
24
|
+
api_request "#{base_url(:game_data)}/leaderboard/hall-of-fame/#{raid}/#{faction}", **opts
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Wow
|
5
|
+
##
|
6
|
+
# This class allows access to World of Warcraft pet data
|
7
|
+
#
|
8
|
+
# @see https://develop.battle.net/documentation/world-of-warcraft/game-data-apis
|
9
|
+
#
|
10
|
+
# You can get an instance of this class using the default region as follows:
|
11
|
+
# api_instance = BlizzardApi::Wow.pet
|
12
|
+
class Pet < Wow::GenericDataEndpoint
|
13
|
+
setup 'pet', :static, CACHE_TRIMESTER
|
14
|
+
|
15
|
+
##
|
16
|
+
# Fetch media for one of the pets listed by the {#index} using its *id*
|
17
|
+
#
|
18
|
+
# @param id [Integer] Pet id
|
19
|
+
#
|
20
|
+
# @!macro request_options
|
21
|
+
#
|
22
|
+
# @!macro response
|
23
|
+
def media(id, **options)
|
24
|
+
api_request "#{base_url(:media)}/pet/#{id}", **default_options.merge(options)
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Fetch all pet abilities
|
29
|
+
#
|
30
|
+
# @!macro request_options
|
31
|
+
#
|
32
|
+
# @!macro response
|
33
|
+
def abilities(**options)
|
34
|
+
api_request "#{endpoint_uri('ability')}/index", **default_options.merge(options)
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# Fetch a pet ability
|
39
|
+
#
|
40
|
+
# @param id [Integer] Pet id
|
41
|
+
#
|
42
|
+
# @!macro request_options
|
43
|
+
#
|
44
|
+
# @!macro response
|
45
|
+
def ability(id, **options)
|
46
|
+
api_request "#{endpoint_uri('ability')}/#{id}", **default_options.merge(options)
|
47
|
+
end
|
48
|
+
|
49
|
+
##
|
50
|
+
# Fetch media for one of the pet abilities listed by the {#abilities} using its *id*
|
51
|
+
#
|
52
|
+
# @param id [Integer] Pet ability id
|
53
|
+
#
|
54
|
+
# @!macro request_options
|
55
|
+
#
|
56
|
+
# @!macro response
|
57
|
+
def ability_media(id, **options)
|
58
|
+
api_request "#{base_url(:media)}/pet-ability/#{id}", **default_options.merge(options)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Wow
|
5
|
+
##
|
6
|
+
# This class allows access to World of Warcraft playable classes
|
7
|
+
#
|
8
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-game-data-api
|
9
|
+
#
|
10
|
+
# You can get an instance of this class using the default region as follows:
|
11
|
+
# api_instance = BlizzardApi::Wow.playable_class
|
12
|
+
class PlayableClass < Wow::GenericDataEndpoint
|
13
|
+
setup 'playable-class', :static, CACHE_TRIMESTER
|
14
|
+
|
15
|
+
##
|
16
|
+
# Returns the PvP talent slots data of a specific class
|
17
|
+
#
|
18
|
+
# @param id [Integer] Class id to fetch talent data. One of the IDs returned by the {index} method
|
19
|
+
# @!macro request_options
|
20
|
+
#
|
21
|
+
# @!macro response
|
22
|
+
def talent_slots(id, **options)
|
23
|
+
api_request "#{endpoint_uri}/#{id}/pvp-talent-slots", **default_options.merge(options)
|
24
|
+
end
|
25
|
+
|
26
|
+
##
|
27
|
+
# Fetch media for one of the playable classes listed by the {#index} using its *id*
|
28
|
+
#
|
29
|
+
# @param id [Integer] Playable class id
|
30
|
+
#
|
31
|
+
# @!macro request_options
|
32
|
+
#
|
33
|
+
# @!macro response
|
34
|
+
def media(id, **options)
|
35
|
+
api_request "#{base_url(:media)}/playable-class/#{id}", **default_options.merge(options)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Wow
|
5
|
+
##
|
6
|
+
# This class allows access to World of Warcraft playable races
|
7
|
+
#
|
8
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-game-data-api
|
9
|
+
#
|
10
|
+
# You can get an instance of this class using the default region as follows:
|
11
|
+
# race = BlizzardApi::Wow.playable_race
|
12
|
+
class PlayableRace < Wow::GenericDataEndpoint
|
13
|
+
setup 'playable-race', :static, CACHE_TRIMESTER
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Wow
|
5
|
+
##
|
6
|
+
# This class allows access to World of Warcraft playable specializations
|
7
|
+
#
|
8
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-game-data-api
|
9
|
+
#
|
10
|
+
# You can get an instance of this class using the default region as follows:
|
11
|
+
# spec = BlizzardApi::Wow.playable_specialization
|
12
|
+
class PlayableSpecialization < Wow::GenericDataEndpoint
|
13
|
+
setup 'playable-specialization', :static, CACHE_TRIMESTER
|
14
|
+
|
15
|
+
##
|
16
|
+
# Fetch media for one of the playable specializations listed by the {#index} using its *id*
|
17
|
+
#
|
18
|
+
# @param id [Integer] Playable specialization id
|
19
|
+
#
|
20
|
+
# @!macro request_options
|
21
|
+
#
|
22
|
+
# @!macro response
|
23
|
+
def media(id, **options)
|
24
|
+
api_request "#{base_url(:media)}/playable-specialization/#{id}", **default_options.merge(options)
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def character_data(index_data, options)
|
30
|
+
[].tap do |specs|
|
31
|
+
index_data[:character_specializations].each do |spec|
|
32
|
+
spec_id = %r{playable-specialization/([0-9]+)}.match(spec[:key].to_s)[1]
|
33
|
+
spec_data = get spec_id, **options
|
34
|
+
spec_data[:icon] = resolve_icon(spec_data[:media][:key][:href])
|
35
|
+
cleanup spec_data
|
36
|
+
specs.push spec_data
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def pet_data(index_data, options)
|
42
|
+
[].tap do |specs|
|
43
|
+
index_data[:pet_specializations].each do |spec|
|
44
|
+
spec_id = %r{playable-specialization/([0-9]+)}.match(spec[:key].to_s)[1]
|
45
|
+
spec_data = get spec_id, **options
|
46
|
+
spec_data[:icon] = resolve_icon(spec_data[:media][:key][:href])
|
47
|
+
cleanup spec_data
|
48
|
+
specs.push spec_data
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def cleanup(data)
|
54
|
+
data.delete :_links
|
55
|
+
data[:playable_class].delete :key
|
56
|
+
data.delete :media
|
57
|
+
end
|
58
|
+
|
59
|
+
def resolve_icon(media_url)
|
60
|
+
media_data = api_request(media_url)
|
61
|
+
media_data.dig(:assets, 0, :value)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Wow
|
5
|
+
##
|
6
|
+
# This class allows access to World of Warcraft power types
|
7
|
+
#
|
8
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-game-data-api
|
9
|
+
#
|
10
|
+
# You can get an instance of this class using the default region as follows:
|
11
|
+
# api_instance = BlizzardApi::Wow.power_type
|
12
|
+
class PowerType < Wow::GenericDataEndpoint
|
13
|
+
setup 'power-type', :static, CACHE_TRIMESTER
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Wow
|
5
|
+
##
|
6
|
+
# This class allows access to World of Warcraft professions
|
7
|
+
#
|
8
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-game-data-api
|
9
|
+
#
|
10
|
+
# You can get an instance of this class using the default region as follows:
|
11
|
+
# api_instance = BlizzardApi::Wow.profession
|
12
|
+
class Profession < Wow::GenericDataEndpoint
|
13
|
+
setup 'profession', :static, CACHE_TRIMESTER
|
14
|
+
|
15
|
+
##
|
16
|
+
# Fetch media for a profession using its *id*
|
17
|
+
#
|
18
|
+
# @param id [Integer] Profession id
|
19
|
+
#
|
20
|
+
# @!macro request_options
|
21
|
+
#
|
22
|
+
# @!macro response
|
23
|
+
def media(id, **options)
|
24
|
+
api_request "#{base_url(:media)}/profession/#{id}", **default_options.merge(options)
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Fetch skill tier for a profession using its *ids*
|
29
|
+
#
|
30
|
+
# @param id [Integer] Profession id
|
31
|
+
# @param tier_id [Integer] Profession skill tier id
|
32
|
+
#
|
33
|
+
# @!macro request_options
|
34
|
+
#
|
35
|
+
# @!macro response
|
36
|
+
def skill_tier(id, tier_id, **options)
|
37
|
+
api_request "#{base_url(:game_data)}/profession/#{id}/skill-tier/#{tier_id}", **default_options.merge(options)
|
38
|
+
end
|
39
|
+
|
40
|
+
##
|
41
|
+
# Fetch data for a recipe using its *ids*
|
42
|
+
#
|
43
|
+
# @param id [Integer] Recipe id
|
44
|
+
#
|
45
|
+
# @!macro request_options
|
46
|
+
#
|
47
|
+
# @!macro response
|
48
|
+
def recipe(id, **options)
|
49
|
+
api_request "#{base_url(:game_data)}/recipe/#{id}", **default_options.merge(options)
|
50
|
+
end
|
51
|
+
|
52
|
+
##
|
53
|
+
# Fetch media for a recipe using its *ids*
|
54
|
+
#
|
55
|
+
# @param id [Integer] Recipe id
|
56
|
+
#
|
57
|
+
# @!macro request_options
|
58
|
+
#
|
59
|
+
# @!macro response
|
60
|
+
def recipe_media(id, **options)
|
61
|
+
api_request "#{base_url(:media)}/recipe/#{id}", **default_options.merge(options)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Wow
|
5
|
+
##
|
6
|
+
# This class allows access to World of Warcraft PvP seasons
|
7
|
+
#
|
8
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-game-data-api
|
9
|
+
#
|
10
|
+
# You can get an instance of this class using the default region as follows:
|
11
|
+
# api_instance = BlizzardApi::Wow.pvp_season
|
12
|
+
class PvpRegion < Wow::GenericDataEndpoint
|
13
|
+
setup 'pvp-region', :dynamic, CACHE_TRIMESTER
|
14
|
+
|
15
|
+
##
|
16
|
+
# Returns a index of pvp seasons within the region
|
17
|
+
#
|
18
|
+
# @param [Integer] region_id Region ID
|
19
|
+
#
|
20
|
+
# @!macro request_options
|
21
|
+
# @option options [Boolean] :classic1x If set to true, this method will call the classic era version
|
22
|
+
#
|
23
|
+
# @!macro response
|
24
|
+
def seasons(region_id, **options)
|
25
|
+
api_request "#{endpoint_uri}/#{region_id}/pvp-season/index", **default_options.merge(options)
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# Returns a index of pvp seasons within the region
|
30
|
+
#
|
31
|
+
# @param [Integer] region_id Region ID
|
32
|
+
# @param [Integer] season_id Season ID
|
33
|
+
#
|
34
|
+
# @!macro request_options
|
35
|
+
# @option options [Boolean] :classic1x If set to true, this method will call the classic era version
|
36
|
+
#
|
37
|
+
# @!macro response
|
38
|
+
def season(region_id, season_id, **options)
|
39
|
+
api_request "#{endpoint_uri}/#{region_id}/pvp-season/#{season_id}", **default_options.merge(options)
|
40
|
+
end
|
41
|
+
|
42
|
+
##
|
43
|
+
# Returns a index of pvp leaderboard for a season
|
44
|
+
#
|
45
|
+
# @param [Integer] region_id Region ID
|
46
|
+
# @param [Integer] season_id Season ID
|
47
|
+
#
|
48
|
+
# @!macro request_options
|
49
|
+
# @option options [Boolean] :classic1x If set to true, this method will call the classic era version
|
50
|
+
#
|
51
|
+
# @!macro response
|
52
|
+
def leaderboards(region_id, season_id, **options)
|
53
|
+
api_request "#{endpoint_uri}/#{region_id}/pvp-season/#{season_id}/pvp-leaderboard/index", **default_options.merge(options)
|
54
|
+
end
|
55
|
+
|
56
|
+
##
|
57
|
+
# Returns the leaderboard for a given season and bracket
|
58
|
+
#
|
59
|
+
# @param [Integer] region_id Region ID
|
60
|
+
# @param [Integer] season_id Season ID
|
61
|
+
# @param [String] brackets Brackets
|
62
|
+
#
|
63
|
+
# @!macro request_options
|
64
|
+
# @option options [Boolean] :classic1x If set to true, this method will call the classic era version
|
65
|
+
#
|
66
|
+
# @!macro response
|
67
|
+
def leaderboard(region_id, season_id, brackets, **options)
|
68
|
+
api_request "#{endpoint_uri}/#{region_id}/pvp-season/#{season_id}/pvp-leaderboard/#{brackets}", **default_options.merge(options)
|
69
|
+
end
|
70
|
+
|
71
|
+
##
|
72
|
+
# Returns a list of pvp rewards for a season
|
73
|
+
#
|
74
|
+
# @!macro request_options
|
75
|
+
#
|
76
|
+
# @!macro response
|
77
|
+
def rewards(region_id, season_id, **options)
|
78
|
+
api_request "#{endpoint_uri}/#{region_id}/pvp-season/#{season_id}/pvp-reward/index", **default_options.merge(options)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Wow
|
5
|
+
##
|
6
|
+
# This class allows access to World of Warcraft PvP seasons
|
7
|
+
#
|
8
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-game-data-api
|
9
|
+
#
|
10
|
+
# You can get an instance of this class using the default region as follows:
|
11
|
+
# api_instance = BlizzardApi::Wow.pvp_season
|
12
|
+
class PvpSeason < Wow::GenericDataEndpoint
|
13
|
+
setup 'pvp-season', :dynamic, CACHE_TRIMESTER
|
14
|
+
|
15
|
+
##
|
16
|
+
# Returns a index of pvp leaderboard for a season
|
17
|
+
#
|
18
|
+
# @param [Integer] season_id Season ID
|
19
|
+
#
|
20
|
+
# @!macro request_options
|
21
|
+
# @option options [Boolean] :classic1x If set to true, this method will call the classic era version
|
22
|
+
#
|
23
|
+
# @!macro response
|
24
|
+
def leaderboards(season_id, **options)
|
25
|
+
api_request "#{endpoint_uri}/#{season_id}/pvp-leaderboard/index", **default_options.merge(options)
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# Returns the leaderboard for a given season and bracket
|
30
|
+
#
|
31
|
+
# @param [Integer] season_id Season ID
|
32
|
+
# @param [String] brackets Brackets
|
33
|
+
#
|
34
|
+
# @!macro request_options
|
35
|
+
# @option options [Boolean] :classic1x If set to true, this method will call the classic era version
|
36
|
+
#
|
37
|
+
# @!macro response
|
38
|
+
def leaderboard(season_id, brackets, **options)
|
39
|
+
api_request "#{endpoint_uri}/#{season_id}/pvp-leaderboard/#{brackets}", **default_options.merge(options)
|
40
|
+
end
|
41
|
+
|
42
|
+
##
|
43
|
+
# Returns a list of pvp rewards for a season
|
44
|
+
#
|
45
|
+
# @!macro request_options
|
46
|
+
#
|
47
|
+
# @!macro response
|
48
|
+
def rewards(season_id, **options)
|
49
|
+
api_request "#{endpoint_uri}/#{season_id}/pvp-reward/index", **default_options.merge(options)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Wow
|
5
|
+
##
|
6
|
+
# This class allows access to World of Warcraft power types
|
7
|
+
#
|
8
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-game-data-api
|
9
|
+
#
|
10
|
+
# You can get an instance of this class using the default region as follows:
|
11
|
+
# api_instance = BlizzardApi::Wow.pvp_tier
|
12
|
+
class PvpTier < Wow::GenericDataEndpoint
|
13
|
+
setup 'pvp-tier', :static, CACHE_TRIMESTER
|
14
|
+
|
15
|
+
##
|
16
|
+
# Returns media assets for a pvp tier
|
17
|
+
#
|
18
|
+
# @!macro request_options
|
19
|
+
#
|
20
|
+
# @!macro response
|
21
|
+
def tier_media(id, **options)
|
22
|
+
api_request "#{base_url(:media)}/#{self.class.endpoint}/#{id}", **default_options.merge(options)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|