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,79 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Wow
|
5
|
+
##
|
6
|
+
# This class allows access to World of Warcraft quest 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.quest
|
12
|
+
class Quest < Wow::GenericDataEndpoint
|
13
|
+
setup 'quest', :static, CACHE_TRIMESTER
|
14
|
+
|
15
|
+
##
|
16
|
+
# Return a list of quest categories
|
17
|
+
#
|
18
|
+
# @!macro request_options
|
19
|
+
#
|
20
|
+
# @!macro response
|
21
|
+
def categories(**options)
|
22
|
+
api_request "#{endpoint_uri}/category/index", **default_options.merge(options)
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Return data about a quest category
|
27
|
+
#
|
28
|
+
# @param id [Integer] Quest category id
|
29
|
+
# @!macro request_options
|
30
|
+
#
|
31
|
+
# @!macro response
|
32
|
+
def category(id, **options)
|
33
|
+
api_request "#{endpoint_uri}/category/#{id}", **default_options.merge(options)
|
34
|
+
end
|
35
|
+
|
36
|
+
##
|
37
|
+
# Return a list of quest areas
|
38
|
+
#
|
39
|
+
# @!macro request_options
|
40
|
+
#
|
41
|
+
# @!macro response
|
42
|
+
def areas(**options)
|
43
|
+
api_request "#{endpoint_uri}/area/index", **default_options.merge(options)
|
44
|
+
end
|
45
|
+
|
46
|
+
##
|
47
|
+
# Return data about a quest area
|
48
|
+
#
|
49
|
+
# @param id [Integer] Quest category id
|
50
|
+
# @!macro request_options
|
51
|
+
#
|
52
|
+
# @!macro response
|
53
|
+
def area(id, **options)
|
54
|
+
api_request "#{endpoint_uri}/area/#{id}", **default_options.merge(options)
|
55
|
+
end
|
56
|
+
|
57
|
+
##
|
58
|
+
# Return a list of quest types
|
59
|
+
#
|
60
|
+
# @!macro request_options
|
61
|
+
#
|
62
|
+
# @!macro response
|
63
|
+
def types(**options)
|
64
|
+
api_request "#{endpoint_uri}/type/index", **default_options.merge(options)
|
65
|
+
end
|
66
|
+
|
67
|
+
##
|
68
|
+
# Return data about a quest type
|
69
|
+
#
|
70
|
+
# @param id [Integer] Quest type
|
71
|
+
# @!macro request_options
|
72
|
+
#
|
73
|
+
# @!macro response
|
74
|
+
def type(id, **options)
|
75
|
+
api_request "#{endpoint_uri}/type/#{id}", **default_options.merge(options)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Wow
|
5
|
+
##
|
6
|
+
# This class allows access to World of Warcraft realms
|
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.realm
|
12
|
+
class Realm < Wow::GenericDataEndpoint
|
13
|
+
include BlizzardApi::Wow::Searchable
|
14
|
+
|
15
|
+
setup 'realm', :dynamic, CACHE_TRIMESTER
|
16
|
+
end
|
17
|
+
end
|
18
|
+
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 regions
|
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.region
|
12
|
+
class Region < Wow::GenericDataEndpoint
|
13
|
+
setup 'region', :dynamic, CACHE_TRIMESTER
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Wow
|
5
|
+
##
|
6
|
+
# This class allows access to World of Warcraft reputation
|
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.reputation
|
12
|
+
class Reputation < Wow::GenericDataEndpoint
|
13
|
+
setup 'reputation', :static, CACHE_TRIMESTER
|
14
|
+
|
15
|
+
##
|
16
|
+
# This method overrides the inherited default behavior to prevent high server load and fetch time
|
17
|
+
#
|
18
|
+
# @!macro response
|
19
|
+
def index
|
20
|
+
raise BlizzardApi::ApiException, 'This endpoint does not have an index method'
|
21
|
+
end
|
22
|
+
|
23
|
+
##
|
24
|
+
# This method overrides the inherited default behavior to prevent high server load and fetch time
|
25
|
+
#
|
26
|
+
# @!macro response
|
27
|
+
def get
|
28
|
+
raise BlizzardApi::ApiException, 'This endpoint does not have a get method'
|
29
|
+
end
|
30
|
+
|
31
|
+
##
|
32
|
+
# Return a list of reputation factions
|
33
|
+
#
|
34
|
+
# @!macro request_options
|
35
|
+
#
|
36
|
+
# @!macro response
|
37
|
+
def factions(**options)
|
38
|
+
api_request "#{endpoint_uri('faction')}/index", **default_options.merge(options)
|
39
|
+
end
|
40
|
+
|
41
|
+
##
|
42
|
+
# Return data about a reputation faction
|
43
|
+
#
|
44
|
+
# @param id [Integer] Reputation faction id
|
45
|
+
# @!macro request_options
|
46
|
+
#
|
47
|
+
# @!macro response
|
48
|
+
def faction(id, **options)
|
49
|
+
api_request "#{endpoint_uri('faction')}/#{id}", **default_options.merge(options)
|
50
|
+
end
|
51
|
+
|
52
|
+
##
|
53
|
+
# Return a list of reputation tiers
|
54
|
+
#
|
55
|
+
# @!macro request_options
|
56
|
+
#
|
57
|
+
# @!macro response
|
58
|
+
def tiers(**options)
|
59
|
+
api_request "#{endpoint_uri('tiers')}/index", **default_options.merge(options)
|
60
|
+
end
|
61
|
+
|
62
|
+
##
|
63
|
+
# Return data about a reputation tier
|
64
|
+
#
|
65
|
+
# @param id [Integer] Reputation tier id
|
66
|
+
# @!macro request_options
|
67
|
+
#
|
68
|
+
# @!macro response
|
69
|
+
def tier(id, **options)
|
70
|
+
api_request "#{endpoint_uri('tiers')}/#{id}", **default_options.merge(options)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Wow
|
5
|
+
##
|
6
|
+
# This class allows access to World of Warcraft spell 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.spell
|
12
|
+
class Spell < Wow::GenericDataEndpoint
|
13
|
+
include BlizzardApi::Wow::Searchable
|
14
|
+
|
15
|
+
setup 'spell', :static, CACHE_TRIMESTER
|
16
|
+
|
17
|
+
##
|
18
|
+
# This method overrides the inherited default behavior to prevent high server load and fetch time
|
19
|
+
#
|
20
|
+
# @!macro response
|
21
|
+
def index
|
22
|
+
raise BlizzardApi::ApiException, 'This endpoint does not have an index method'
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Fetch media for a spell
|
27
|
+
#
|
28
|
+
# @param id [Integer] Spell id
|
29
|
+
#
|
30
|
+
# @!macro request_options
|
31
|
+
#
|
32
|
+
# @!macro response
|
33
|
+
def display_media(id, **options)
|
34
|
+
api_request "#{base_url(:media)}/spell/#{id}", **default_options.merge(options)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Wow
|
5
|
+
##
|
6
|
+
# This class allows access to World of Warcraft talent 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.talent
|
12
|
+
class Talent < Wow::GenericDataEndpoint
|
13
|
+
setup 'talent', :static, CACHE_TRIMESTER
|
14
|
+
|
15
|
+
##
|
16
|
+
# Fetch talent trees
|
17
|
+
#
|
18
|
+
# @!macro request_options
|
19
|
+
#
|
20
|
+
# @!macro response
|
21
|
+
def talent_trees(**options)
|
22
|
+
api_request "#{base_url(:game_data)}/talent-tree/index", **default_options.merge(options)
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Fetch a talent tree
|
27
|
+
#
|
28
|
+
# @param talent_tree_id [Integer] talent tree id
|
29
|
+
#
|
30
|
+
# @param spec_id [Integer] playable specialization id
|
31
|
+
#
|
32
|
+
# @!macro request_options
|
33
|
+
#
|
34
|
+
# @!macro response
|
35
|
+
def talent_tree(talent_tree_id, spec_id, **options)
|
36
|
+
api_request "#{base_url(:game_data)}/talent-tree/#{talent_tree_id}/playable-specialization/#{spec_id}",
|
37
|
+
**default_options.merge(options)
|
38
|
+
end
|
39
|
+
|
40
|
+
##
|
41
|
+
# Fetch a talent tree node
|
42
|
+
#
|
43
|
+
# @param talent_tree_id [Integer] talent tree id
|
44
|
+
#
|
45
|
+
# @!macro request_options
|
46
|
+
#
|
47
|
+
# @!macro response
|
48
|
+
def talent_tree_nodes(talent_tree_id, **options)
|
49
|
+
api_request "#{base_url(:game_data)}/talent-tree/#{talent_tree_id}", **default_options.merge(options)
|
50
|
+
end
|
51
|
+
|
52
|
+
##
|
53
|
+
# Fetch pvp talents
|
54
|
+
#
|
55
|
+
# @!macro request_options
|
56
|
+
#
|
57
|
+
# @!macro response
|
58
|
+
def pvp_talents(**options)
|
59
|
+
api_request "#{base_url(:game_data)}/pvp-talent/index", **default_options.merge(options)
|
60
|
+
end
|
61
|
+
|
62
|
+
##
|
63
|
+
# Fetch a pvp talent
|
64
|
+
#
|
65
|
+
# @param id [Integer] Pvp talent id
|
66
|
+
#
|
67
|
+
# @!macro request_options
|
68
|
+
#
|
69
|
+
# @!macro response
|
70
|
+
def pvp_talent(id, **options)
|
71
|
+
api_request "#{base_url(:game_data)}/pvp-talent/#{id}", **default_options.merge(options)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Wow
|
5
|
+
##
|
6
|
+
# This class allows access to World of Warcraft talent 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.talent
|
12
|
+
class TechTalent < Wow::GenericDataEndpoint
|
13
|
+
setup 'tech-talent', :static, CACHE_TRIMESTER
|
14
|
+
|
15
|
+
##
|
16
|
+
# Fetch tech talent trees
|
17
|
+
#
|
18
|
+
# @!macro request_options
|
19
|
+
#
|
20
|
+
# @!macro response
|
21
|
+
def tech_talent_trees(**options)
|
22
|
+
api_request "#{base_url(:game_data)}/tech-talent-tree/index", **default_options.merge(options)
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Fetch a tech talent tree
|
27
|
+
#
|
28
|
+
# @param id [Integer] Tech talent id
|
29
|
+
#
|
30
|
+
# @!macro request_options
|
31
|
+
#
|
32
|
+
# @!macro response
|
33
|
+
def tech_talent_tree(id, **options)
|
34
|
+
api_request "#{base_url(:game_data)}/tech-talent-tree/#{id}", **default_options.merge(options)
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# Fetch a tech talent media
|
39
|
+
#
|
40
|
+
# @param id [Integer] Tech talent id
|
41
|
+
#
|
42
|
+
# @!macro request_options
|
43
|
+
#
|
44
|
+
# @!macro response
|
45
|
+
def media(id, **options)
|
46
|
+
api_request "#{base_url(:media)}/tech-talent/#{id}", **default_options.merge(options)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
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 titles
|
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.title
|
12
|
+
class Title < Wow::GenericDataEndpoint
|
13
|
+
setup 'title', :static, CACHE_TRIMESTER
|
14
|
+
end
|
15
|
+
end
|
16
|
+
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 toys
|
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.toy
|
12
|
+
class Toy < Wow::GenericDataEndpoint
|
13
|
+
setup 'toy', :static, CACHE_TRIMESTER
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Wow
|
5
|
+
##
|
6
|
+
# This class allows access to World of Warcraft tokens
|
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.wow_token
|
12
|
+
class WowToken < GenericDataEndpoint
|
13
|
+
setup 'token', :dynamic, CACHE_HOUR
|
14
|
+
|
15
|
+
def get
|
16
|
+
raise BlizzardApi::ApiException, 'This endpoint does not have a index method'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Wow
|
5
|
+
##
|
6
|
+
# Simplifies the requests to Blizzard APIS
|
7
|
+
class AccountProfile < Request
|
8
|
+
##
|
9
|
+
# @param token [String] A token obtained using the authorization_code flow
|
10
|
+
def initialize(token, **options)
|
11
|
+
super(**options)
|
12
|
+
@token = token
|
13
|
+
end
|
14
|
+
|
15
|
+
##
|
16
|
+
# Returns the account summary for WoW
|
17
|
+
#
|
18
|
+
# @!macro request_options
|
19
|
+
#
|
20
|
+
# @!macro response
|
21
|
+
def get(**options)
|
22
|
+
api_request base_url(:user_profile).to_s, **default_options.merge(options)
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Returns data for protected characters
|
27
|
+
#
|
28
|
+
# @!macro request_options
|
29
|
+
#
|
30
|
+
# @!macro response
|
31
|
+
def protected_character(realm_id, character_id, **options)
|
32
|
+
api_request "#{base_url(:user_profile)}/protected-character/#{realm_id}-#{character_id}", **default_options.merge(options)
|
33
|
+
end
|
34
|
+
|
35
|
+
##
|
36
|
+
# Returns the collection index for the account
|
37
|
+
#
|
38
|
+
# @!macro request_options
|
39
|
+
#
|
40
|
+
# @!macro response
|
41
|
+
def collection(**options)
|
42
|
+
api_request "#{base_url(:user_profile)}/collections", **default_options.merge(options)
|
43
|
+
end
|
44
|
+
|
45
|
+
##
|
46
|
+
# Returns the mount collection index for the account
|
47
|
+
#
|
48
|
+
# @!macro request_options
|
49
|
+
#
|
50
|
+
# @!macro response
|
51
|
+
def mounts(**options)
|
52
|
+
api_request "#{base_url(:user_profile)}/collections/mounts", **default_options.merge(options)
|
53
|
+
end
|
54
|
+
|
55
|
+
##
|
56
|
+
# Returns the toy collection index for the account
|
57
|
+
#
|
58
|
+
# @!macro request_options
|
59
|
+
#
|
60
|
+
# @!macro response
|
61
|
+
def toys(**options)
|
62
|
+
api_request "#{base_url(:user_profile)}/collections/toys", **default_options.merge(options)
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# Returns the heirloom collection index for the account
|
67
|
+
#
|
68
|
+
# @!macro request_options
|
69
|
+
#
|
70
|
+
# @!macro response
|
71
|
+
def heirloom(**options)
|
72
|
+
api_request "#{base_url(:user_profile)}/collections/heirloom", **default_options.merge(options)
|
73
|
+
end
|
74
|
+
|
75
|
+
##
|
76
|
+
# Returns the pet collection index for the account
|
77
|
+
#
|
78
|
+
# @!macro request_options
|
79
|
+
#
|
80
|
+
# @!macro response
|
81
|
+
def pets(**options)
|
82
|
+
api_request "#{base_url(:user_profile)}/collections/pets", **default_options.merge(options)
|
83
|
+
end
|
84
|
+
|
85
|
+
protected
|
86
|
+
|
87
|
+
def default_options
|
88
|
+
{ ttl: CACHE_HOUR, namespace: :profile }
|
89
|
+
end
|
90
|
+
|
91
|
+
def api_request(_uri, **query_string)
|
92
|
+
query_string.merge! access_token: @token
|
93
|
+
super
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|