blizzard_api 0.4.0 → 0.5.3
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 +4 -4
- data/.github/workflows/ruby.yml +21 -0
- data/.rubocop.yml +2 -1
- data/CHANGELOG.md +65 -0
- data/Gemfile.lock +19 -14
- data/README.md +6 -3
- data/blizzard_api.gemspec +6 -4
- data/lib/blizzard_api/diablo/game_data/generic_data_endpoint.rb +2 -2
- data/lib/blizzard_api/diablo/request.rb +2 -2
- data/lib/blizzard_api/hearthstone/game_data/generic_data_endpoint.rb +2 -2
- data/lib/blizzard_api/hearthstone/request.rb +2 -2
- data/lib/blizzard_api/request.rb +45 -38
- data/lib/blizzard_api/starcraft.rb +7 -0
- data/lib/blizzard_api/starcraft/community/legacy.rb +88 -0
- data/lib/blizzard_api/starcraft/request.rb +2 -2
- data/lib/blizzard_api/version.rb +1 -1
- data/lib/blizzard_api/wow.rb +33 -0
- data/lib/blizzard_api/wow/game_data/azerite_essence.rb +2 -0
- data/lib/blizzard_api/wow/game_data/covenant.rb +79 -0
- data/lib/blizzard_api/wow/game_data/creature.rb +2 -0
- data/lib/blizzard_api/wow/game_data/generic_data_endpoint.rb +2 -2
- data/lib/blizzard_api/wow/game_data/item.rb +2 -0
- data/lib/blizzard_api/wow/game_data/journal.rb +15 -0
- data/lib/blizzard_api/wow/game_data/media.rb +37 -0
- data/lib/blizzard_api/wow/game_data/modified_crafting.rb +67 -0
- data/lib/blizzard_api/wow/game_data/mount.rb +2 -0
- data/lib/blizzard_api/wow/game_data/pet.rb +46 -0
- data/lib/blizzard_api/wow/game_data/spell.rb +2 -0
- data/lib/blizzard_api/wow/game_data/tech_talent.rb +57 -0
- data/lib/blizzard_api/wow/profile/character_profile.rb +19 -1
- data/lib/blizzard_api/wow/profile/guild.rb +2 -0
- data/lib/blizzard_api/wow/profile/profile.rb +2 -2
- data/lib/blizzard_api/wow/request.rb +2 -2
- data/lib/blizzard_api/wow/search/search_composer.rb +3 -3
- data/lib/blizzard_api/wow/search/search_request.rb +1 -1
- data/lib/blizzard_api/wow/slug.rb +12 -0
- metadata +16 -8
- data/.gitlab-ci.yml +0 -12
@@ -19,6 +19,7 @@ module BlizzardApi
|
|
19
19
|
require_relative 'starcraft/community/profile'
|
20
20
|
require_relative 'starcraft/community/ladder'
|
21
21
|
require_relative 'starcraft/community/account'
|
22
|
+
require_relative 'starcraft/community/legacy'
|
22
23
|
|
23
24
|
##
|
24
25
|
# @param region [String] API Region
|
@@ -40,5 +41,11 @@ module BlizzardApi
|
|
40
41
|
def self.account(region = BlizzardApi.region)
|
41
42
|
BlizzardApi::Starcraft::Account.new(region)
|
42
43
|
end
|
44
|
+
|
45
|
+
##
|
46
|
+
# @return {Legacy}
|
47
|
+
def self.legacy
|
48
|
+
BlizzardApi::Starcraft::Legacy.new
|
49
|
+
end
|
43
50
|
end
|
44
51
|
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Starcraft
|
5
|
+
##
|
6
|
+
# This class allows access to Starcraft II legacy data
|
7
|
+
#
|
8
|
+
# @see https://develop.battle.net/documentation/api-reference/starcraft-2-game-data-api
|
9
|
+
#
|
10
|
+
# You can get an instance of this class using the default region as follows:
|
11
|
+
# api_instance = BlizzardApi::Starcraft.legacy
|
12
|
+
class Legacy < Starcraft::Request
|
13
|
+
|
14
|
+
##
|
15
|
+
# Profile data
|
16
|
+
#
|
17
|
+
# @!macro sc2_regions
|
18
|
+
# @param [Integer] realm_id Realm ID
|
19
|
+
# @param [Integer] profile_id Profile ID
|
20
|
+
# @!macro request_options
|
21
|
+
def profile(region_id, realm_id, profile_id, options = {})
|
22
|
+
reg = resolve_region(region_id)
|
23
|
+
opts = { ttl: CACHE_DAY }.merge(options)
|
24
|
+
api_request "#{base_url(:community)}/legacy/profile/#{reg}/#{realm_id}/#{profile_id}", opts
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Ladders
|
29
|
+
#
|
30
|
+
# @!macro sc2_regions
|
31
|
+
# @param [Integer] realm_id Realm ID
|
32
|
+
# @param [Integer] profile_id Profile ID
|
33
|
+
# @!macro request_options
|
34
|
+
def ladders(region_id, realm_id, profile_id, options = {})
|
35
|
+
reg = resolve_region(region_id)
|
36
|
+
opts = { ttl: CACHE_DAY }.merge(options)
|
37
|
+
api_request "#{base_url(:community)}/legacy/profile/#{reg}/#{realm_id}/#{profile_id}/ladder ", opts
|
38
|
+
end
|
39
|
+
|
40
|
+
##
|
41
|
+
# Match History
|
42
|
+
#
|
43
|
+
# @!macro sc2_regions
|
44
|
+
# @param [Integer] realm_id Realm ID
|
45
|
+
# @param [Integer] profile_id Profile ID
|
46
|
+
# @!macro request_options
|
47
|
+
def match(region_id, realm_id, profile_id, options = {})
|
48
|
+
reg = resolve_region(region_id)
|
49
|
+
opts = { ttl: CACHE_DAY }.merge(options)
|
50
|
+
api_request "#{base_url(:community)}/legacy/profile/#{reg}/#{realm_id}/#{profile_id}/matches", opts
|
51
|
+
end
|
52
|
+
|
53
|
+
##
|
54
|
+
# Ladder
|
55
|
+
#
|
56
|
+
# @!macro sc2_regions
|
57
|
+
# @param [Integer] ladder_id Ladder ID
|
58
|
+
# @!macro request_options
|
59
|
+
def ladder(region_id, ladder_id, options = {})
|
60
|
+
reg = resolve_region(region_id)
|
61
|
+
opts = { ttl: CACHE_DAY }.merge(options)
|
62
|
+
api_request "#{base_url(:community)}/legacy/ladder/#{reg}/#{ladder_id}", opts
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# Achievement data
|
67
|
+
#
|
68
|
+
# @!macro sc2_regions
|
69
|
+
# @!macro request_options
|
70
|
+
def achievements(region_id, options = {})
|
71
|
+
reg = resolve_region(region_id)
|
72
|
+
opts = { ttl: CACHE_DAY }.merge(options)
|
73
|
+
api_request "#{base_url(:community)}/legacy/data/achievements/#{reg}", opts
|
74
|
+
end
|
75
|
+
|
76
|
+
##
|
77
|
+
# Rewards data
|
78
|
+
#
|
79
|
+
# @!macro sc2_regions
|
80
|
+
# @!macro request_options
|
81
|
+
def rewards(region_id, options = {})
|
82
|
+
reg = resolve_region(region_id)
|
83
|
+
opts = { ttl: CACHE_DAY }.merge(options)
|
84
|
+
api_request "#{base_url(:community)}/legacy/data/rewards/#{reg}", opts
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
data/lib/blizzard_api/version.rb
CHANGED
data/lib/blizzard_api/wow.rb
CHANGED
@@ -7,16 +7,20 @@ module BlizzardApi
|
|
7
7
|
require_relative 'wow/game_data/generic_data_endpoint'
|
8
8
|
require_relative 'wow/search/search_composer'
|
9
9
|
require_relative 'wow/search/search_request'
|
10
|
+
require_relative 'wow/slug'
|
10
11
|
|
11
12
|
# WoW data api
|
12
13
|
require_relative 'wow/game_data/achievement'
|
13
14
|
require_relative 'wow/game_data/auction'
|
14
15
|
require_relative 'wow/game_data/azerite_essence'
|
15
16
|
require_relative 'wow/game_data/connected_realm'
|
17
|
+
require_relative 'wow/game_data/covenant'
|
16
18
|
require_relative 'wow/game_data/creature'
|
17
19
|
require_relative 'wow/game_data/guild_crest'
|
18
20
|
require_relative 'wow/game_data/item'
|
19
21
|
require_relative 'wow/game_data/journal'
|
22
|
+
require_relative 'wow/game_data/media'
|
23
|
+
require_relative 'wow/game_data/modified_crafting'
|
20
24
|
require_relative 'wow/game_data/mount'
|
21
25
|
require_relative 'wow/game_data/mythic_keystone_affix'
|
22
26
|
require_relative 'wow/game_data/mythic_keystone'
|
@@ -36,6 +40,7 @@ module BlizzardApi
|
|
36
40
|
require_relative 'wow/game_data/reputation'
|
37
41
|
require_relative 'wow/game_data/spell'
|
38
42
|
require_relative 'wow/game_data/talent'
|
43
|
+
require_relative 'wow/game_data/tech_talent'
|
39
44
|
require_relative 'wow/game_data/title'
|
40
45
|
require_relative 'wow/game_data/wow_token'
|
41
46
|
|
@@ -67,6 +72,13 @@ module BlizzardApi
|
|
67
72
|
BlizzardApi::Wow::ConnectedRealm.new(region)
|
68
73
|
end
|
69
74
|
|
75
|
+
##
|
76
|
+
# @param region [String] API Region
|
77
|
+
# @return {Covenant}
|
78
|
+
def self.covenant(region = BlizzardApi.region)
|
79
|
+
BlizzardApi::Wow::Covenant.new(region)
|
80
|
+
end
|
81
|
+
|
70
82
|
##
|
71
83
|
# @param region [String] API Region
|
72
84
|
# @return {Creature}
|
@@ -95,6 +107,20 @@ module BlizzardApi
|
|
95
107
|
BlizzardApi::Wow::Journal.new(region)
|
96
108
|
end
|
97
109
|
|
110
|
+
##
|
111
|
+
# @param region [String] API Region
|
112
|
+
# @return {Media}
|
113
|
+
def self.media(region = BlizzardApi.region)
|
114
|
+
BlizzardApi::Wow::Media.new(region)
|
115
|
+
end
|
116
|
+
|
117
|
+
##
|
118
|
+
# @param region [String] API Region
|
119
|
+
# @return {ModifiedCrafting}
|
120
|
+
def self.modified_crafting(region = BlizzardApi.region)
|
121
|
+
BlizzardApi::Wow::ModifiedCrafting.new(region)
|
122
|
+
end
|
123
|
+
|
98
124
|
##
|
99
125
|
# @param region [String] API Region
|
100
126
|
# @return {Mount}
|
@@ -228,6 +254,13 @@ module BlizzardApi
|
|
228
254
|
BlizzardApi::Wow::Talent.new(region)
|
229
255
|
end
|
230
256
|
|
257
|
+
##
|
258
|
+
# @param region [String] API Region
|
259
|
+
# @return {TechTalent}
|
260
|
+
def self.tech_talent(region = BlizzardApi.region)
|
261
|
+
BlizzardApi::Wow::TechTalent.new(region)
|
262
|
+
end
|
263
|
+
|
231
264
|
##
|
232
265
|
# @param region [String] API Region
|
233
266
|
# @return {Title}
|
@@ -10,6 +10,8 @@ module BlizzardApi
|
|
10
10
|
# You can get an instance of this class using the default region as follows:
|
11
11
|
# api_instance = BlizzardApi::Wow.azerite_essence
|
12
12
|
class AzeriteEssence < Wow::GenericDataEndpoint
|
13
|
+
include BlizzardApi::Wow::Searchable
|
14
|
+
|
13
15
|
##
|
14
16
|
# Fetch media for one of the azerite essences listed by the {#index} using its *id*
|
15
17
|
#
|
@@ -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 azerite essences
|
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.azerite_essence
|
12
|
+
class Covenant < Wow::GenericDataEndpoint
|
13
|
+
##
|
14
|
+
# Fetch media for one of the covenants listed by the {#index} using its *id*
|
15
|
+
#
|
16
|
+
# @param id [Integer] Covenant id
|
17
|
+
#
|
18
|
+
# @!macro request_options
|
19
|
+
#
|
20
|
+
# @!macro response
|
21
|
+
def media(id, options = {})
|
22
|
+
api_request "#{base_url(:media)}/covenant/#{id}", default_options.merge(options)
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Fetch all soulbinds
|
27
|
+
#
|
28
|
+
# @!macro request_options
|
29
|
+
#
|
30
|
+
# @!macro response
|
31
|
+
def soulbinds(options = {})
|
32
|
+
api_request "#{base_url(:game_data)}/covenant/soulbind/index", default_options.merge(options)
|
33
|
+
end
|
34
|
+
|
35
|
+
##
|
36
|
+
# Fetch a soulbind by its id
|
37
|
+
#
|
38
|
+
# @param id Soulbind id
|
39
|
+
#
|
40
|
+
# @!macro request_options
|
41
|
+
#
|
42
|
+
# @!macro response
|
43
|
+
def soulbind(id, options = {})
|
44
|
+
api_request "#{base_url(:game_data)}/covenant/soulbind/#{id}", default_options.merge(options)
|
45
|
+
end
|
46
|
+
|
47
|
+
##
|
48
|
+
# Fetch all conduits
|
49
|
+
#
|
50
|
+
# @!macro request_options
|
51
|
+
#
|
52
|
+
# @!macro response
|
53
|
+
def conduits(options = {})
|
54
|
+
api_request "#{base_url(:game_data)}/covenant/conduit/index", default_options.merge(options)
|
55
|
+
end
|
56
|
+
|
57
|
+
##
|
58
|
+
# Fetch a conduit by its id
|
59
|
+
#
|
60
|
+
# @param id Conduit id
|
61
|
+
#
|
62
|
+
# @!macro request_options
|
63
|
+
#
|
64
|
+
# @!macro response
|
65
|
+
def conduit(id, options = {})
|
66
|
+
api_request "#{base_url(:game_data)}/covenant/conduit/#{id}", default_options.merge(options)
|
67
|
+
end
|
68
|
+
|
69
|
+
protected
|
70
|
+
|
71
|
+
def endpoint_setup
|
72
|
+
@endpoint = 'covenant'
|
73
|
+
@namespace = :static
|
74
|
+
@collection = 'covenants'
|
75
|
+
@ttl = CACHE_TRIMESTER
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -10,6 +10,8 @@ module BlizzardApi
|
|
10
10
|
# You can get an instance of this class using the default region as follows:
|
11
11
|
# api_instance = BlizzardApi::Wow.creature
|
12
12
|
class Creature < Wow::GenericDataEndpoint
|
13
|
+
include BlizzardApi::Wow::Searchable
|
14
|
+
|
13
15
|
def index
|
14
16
|
raise BlizzardApi::ApiException, 'Creatures endpoint doesn\'t have a index method'
|
15
17
|
end
|
@@ -10,6 +10,8 @@ module BlizzardApi
|
|
10
10
|
# You can get an instance of this class using the default region as follows:
|
11
11
|
# api_instance = BlizzardApi::Wow.item
|
12
12
|
class Item < Wow::GenericDataEndpoint
|
13
|
+
include BlizzardApi::Wow::Searchable
|
14
|
+
|
13
15
|
##
|
14
16
|
# This method overrides the inherited default behavior to prevent high server load and fetch time
|
15
17
|
#
|
@@ -97,6 +97,21 @@ module BlizzardApi
|
|
97
97
|
api_request "#{endpoint_uri('encounter')}/#{id}", default_options.merge(options)
|
98
98
|
end
|
99
99
|
|
100
|
+
##
|
101
|
+
# Fetch data base on search criteria
|
102
|
+
#
|
103
|
+
# @param page [Integer] Page o return
|
104
|
+
# @param page_size [Integer] Amount of items per page
|
105
|
+
#
|
106
|
+
# @!macro request_options
|
107
|
+
# @!macro response
|
108
|
+
def encounter_search(page = 1, page_size = 100, options = {})
|
109
|
+
search_options = SearchComposer.new(page, page_size)
|
110
|
+
yield search_options if block_given?
|
111
|
+
|
112
|
+
api_request "#{endpoint_uri('encounter', :search)}?#{search_options.to_search_query}", default_options.merge(options)
|
113
|
+
end
|
114
|
+
|
100
115
|
protected
|
101
116
|
|
102
117
|
def endpoint_setup
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Wow
|
5
|
+
##
|
6
|
+
# This class allows access to World of Warcraft mounts
|
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.mount
|
12
|
+
class Media < Wow::GenericDataEndpoint
|
13
|
+
include BlizzardApi::Wow::Searchable
|
14
|
+
|
15
|
+
def index(_options = nil)
|
16
|
+
raise BlizzardApi::ApiException, 'This endpoint does not have a index method'
|
17
|
+
end
|
18
|
+
|
19
|
+
def get(_options = nil)
|
20
|
+
raise BlizzardApi::ApiException, 'This endpoint does not have a get method'
|
21
|
+
end
|
22
|
+
|
23
|
+
def complete(_options = nil)
|
24
|
+
raise BlizzardApi::ApiException, 'This endpoint does not have a complete method'
|
25
|
+
end
|
26
|
+
|
27
|
+
protected
|
28
|
+
|
29
|
+
def endpoint_setup
|
30
|
+
@endpoint = 'media'
|
31
|
+
@namespace = :static
|
32
|
+
@collection = 'medias'
|
33
|
+
@ttl = CACHE_TRIMESTER
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,67 @@
|
|
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.modified_crafting
|
12
|
+
class ModifiedCrafting < Wow::GenericDataEndpoint
|
13
|
+
def complete
|
14
|
+
raise BlizzardApi::ApiException, 'This endpoint does not have a complete method.'
|
15
|
+
end
|
16
|
+
|
17
|
+
##
|
18
|
+
# Fetch modified crafting category index
|
19
|
+
#
|
20
|
+
# @!macro request_options
|
21
|
+
def categories(options = {})
|
22
|
+
api_request "#{base_url(:game_data)}/modified-crafting/category/index", default_options.merge(options)
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Fetch a modified crafting category
|
27
|
+
#
|
28
|
+
# @param id [Integer] Modified crafting category id
|
29
|
+
#
|
30
|
+
# @!macro request_options
|
31
|
+
#
|
32
|
+
# @!macro response
|
33
|
+
def category(id, options = {})
|
34
|
+
api_request "#{base_url(:game_data)}/modified-crafting/category/#{id}", default_options.merge(options)
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# Fetch modified crafting slot type index
|
39
|
+
#
|
40
|
+
# @!macro request_options
|
41
|
+
def slot_types(options = {})
|
42
|
+
api_request "#{base_url(:game_data)}/modified-crafting/reagent-slot-type/index", default_options.merge(options)
|
43
|
+
end
|
44
|
+
|
45
|
+
##
|
46
|
+
# Fetch a modified crafting slot type
|
47
|
+
#
|
48
|
+
# @param id [Integer] Modified crafting slot type id
|
49
|
+
#
|
50
|
+
# @!macro request_options
|
51
|
+
#
|
52
|
+
# @!macro response
|
53
|
+
def slot_type(id, options = {})
|
54
|
+
api_request "#{base_url(:game_data)}/modified-crafting/reagent-slot-type/#{id}", default_options.merge(options)
|
55
|
+
end
|
56
|
+
|
57
|
+
protected
|
58
|
+
|
59
|
+
def endpoint_setup
|
60
|
+
@endpoint = 'modified-crafting'
|
61
|
+
@namespace = :static
|
62
|
+
@collection = 'professions'
|
63
|
+
@ttl = CACHE_TRIMESTER
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|