blizzard_api 0.3.11 → 0.5.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 +4 -4
- data/.rubocop.yml +2 -1
- data/CHANGELOG.md +65 -0
- data/Gemfile.lock +23 -14
- data/README.md +45 -0
- data/blizzard_api.gemspec +2 -0
- data/lib/blizzard_api/diablo/community/item.rb +1 -1
- 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 +46 -38
- data/lib/blizzard_api/starcraft/request.rb +2 -2
- data/lib/blizzard_api/version.rb +1 -1
- data/lib/blizzard_api/wow.rb +35 -0
- data/lib/blizzard_api/wow/game_data/azerite_essence.rb +2 -0
- data/lib/blizzard_api/wow/game_data/connected_realm.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 +4 -4
- 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/realm.rb +2 -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 +97 -0
- data/lib/blizzard_api/wow/search/search_request.rb +24 -0
- data/lib/blizzard_api/wow/slug.rb +12 -0
- metadata +43 -8
data/lib/blizzard_api/version.rb
CHANGED
data/lib/blizzard_api/wow.rb
CHANGED
@@ -5,16 +5,22 @@ module BlizzardApi
|
|
5
5
|
module Wow
|
6
6
|
require_relative 'wow/request'
|
7
7
|
require_relative 'wow/game_data/generic_data_endpoint'
|
8
|
+
require_relative 'wow/search/search_composer'
|
9
|
+
require_relative 'wow/search/search_request'
|
10
|
+
require_relative 'wow/slug'
|
8
11
|
|
9
12
|
# WoW data api
|
10
13
|
require_relative 'wow/game_data/achievement'
|
11
14
|
require_relative 'wow/game_data/auction'
|
12
15
|
require_relative 'wow/game_data/azerite_essence'
|
13
16
|
require_relative 'wow/game_data/connected_realm'
|
17
|
+
require_relative 'wow/game_data/covenant'
|
14
18
|
require_relative 'wow/game_data/creature'
|
15
19
|
require_relative 'wow/game_data/guild_crest'
|
16
20
|
require_relative 'wow/game_data/item'
|
17
21
|
require_relative 'wow/game_data/journal'
|
22
|
+
require_relative 'wow/game_data/media'
|
23
|
+
require_relative 'wow/game_data/modified_crafting'
|
18
24
|
require_relative 'wow/game_data/mount'
|
19
25
|
require_relative 'wow/game_data/mythic_keystone_affix'
|
20
26
|
require_relative 'wow/game_data/mythic_keystone'
|
@@ -34,6 +40,7 @@ module BlizzardApi
|
|
34
40
|
require_relative 'wow/game_data/reputation'
|
35
41
|
require_relative 'wow/game_data/spell'
|
36
42
|
require_relative 'wow/game_data/talent'
|
43
|
+
require_relative 'wow/game_data/tech_talent'
|
37
44
|
require_relative 'wow/game_data/title'
|
38
45
|
require_relative 'wow/game_data/wow_token'
|
39
46
|
|
@@ -65,6 +72,13 @@ module BlizzardApi
|
|
65
72
|
BlizzardApi::Wow::ConnectedRealm.new(region)
|
66
73
|
end
|
67
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
|
+
|
68
82
|
##
|
69
83
|
# @param region [String] API Region
|
70
84
|
# @return {Creature}
|
@@ -93,6 +107,20 @@ module BlizzardApi
|
|
93
107
|
BlizzardApi::Wow::Journal.new(region)
|
94
108
|
end
|
95
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
|
+
|
96
124
|
##
|
97
125
|
# @param region [String] API Region
|
98
126
|
# @return {Mount}
|
@@ -226,6 +254,13 @@ module BlizzardApi
|
|
226
254
|
BlizzardApi::Wow::Talent.new(region)
|
227
255
|
end
|
228
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
|
+
|
229
264
|
##
|
230
265
|
# @param region [String] API Region
|
231
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
|
#
|
@@ -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.connected_realm
|
12
12
|
class ConnectedRealm < Wow::GenericDataEndpoint
|
13
|
+
include BlizzardApi::Wow::Searchable
|
14
|
+
|
13
15
|
protected
|
14
16
|
|
15
17
|
def endpoint_setup
|
@@ -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
|
@@ -7,8 +7,8 @@ module BlizzardApi
|
|
7
7
|
class GenericDataEndpoint < Wow::Request
|
8
8
|
##
|
9
9
|
# @!macro regions
|
10
|
-
def initialize(region = nil)
|
11
|
-
super region
|
10
|
+
def initialize(region = nil, mode = :regular)
|
11
|
+
super region, mode
|
12
12
|
endpoint_setup
|
13
13
|
@ttl ||= CACHE_DAY
|
14
14
|
end
|
@@ -48,9 +48,9 @@ module BlizzardApi
|
|
48
48
|
|
49
49
|
protected
|
50
50
|
|
51
|
-
def endpoint_uri(variant = nil)
|
51
|
+
def endpoint_uri(variant = nil, scope = :game_data)
|
52
52
|
endpoint = variant ? "#{@endpoint}-#{variant}" : @endpoint
|
53
|
-
"#{base_url(
|
53
|
+
"#{base_url(scope)}/#{endpoint}"
|
54
54
|
end
|
55
55
|
|
56
56
|
def endpoint_setup
|
@@ -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
|
@@ -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.mount
|
12
12
|
class Mount < Wow::GenericDataEndpoint
|
13
|
+
include BlizzardApi::Wow::Searchable
|
14
|
+
|
13
15
|
protected
|
14
16
|
|
15
17
|
def endpoint_setup
|
@@ -10,6 +10,52 @@ module BlizzardApi
|
|
10
10
|
# You can get an instance of this class using the default region as follows:
|
11
11
|
# api_instance = BlizzardApi::Wow.pet
|
12
12
|
class Pet < Wow::GenericDataEndpoint
|
13
|
+
##
|
14
|
+
# Fetch media for one of the pets listed by the {#index} using its *id*
|
15
|
+
#
|
16
|
+
# @param id [Integer] Pet id
|
17
|
+
#
|
18
|
+
# @!macro request_options
|
19
|
+
#
|
20
|
+
# @!macro response
|
21
|
+
def media(id, options = {})
|
22
|
+
api_request "#{base_url(:media)}/pet/#{id}", default_options.merge(options)
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Fetch all pet abilities
|
27
|
+
#
|
28
|
+
# @!macro request_options
|
29
|
+
#
|
30
|
+
# @!macro response
|
31
|
+
def abilities(options = {})
|
32
|
+
api_request "#{endpoint_uri('ability')}/index", default_options.merge(options)
|
33
|
+
end
|
34
|
+
|
35
|
+
##
|
36
|
+
# Fetch a pet ability
|
37
|
+
#
|
38
|
+
# @param id [Integer] Pet id
|
39
|
+
#
|
40
|
+
# @!macro request_options
|
41
|
+
#
|
42
|
+
# @!macro response
|
43
|
+
def ability(id, options = {})
|
44
|
+
api_request "#{endpoint_uri('ability')}/#{id}", default_options.merge(options)
|
45
|
+
end
|
46
|
+
|
47
|
+
##
|
48
|
+
# Fetch media for one of the pet abilities listed by the {#abilities} using its *id*
|
49
|
+
#
|
50
|
+
# @param id [Integer] Pet ability id
|
51
|
+
#
|
52
|
+
# @!macro request_options
|
53
|
+
#
|
54
|
+
# @!macro response
|
55
|
+
def ability_media(id, options = {})
|
56
|
+
api_request "#{base_url(:media)}/pet-ability/#{id}", default_options.merge(options)
|
57
|
+
end
|
58
|
+
|
13
59
|
protected
|
14
60
|
|
15
61
|
def endpoint_setup
|
@@ -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.realm
|
12
12
|
class Realm < Wow::GenericDataEndpoint
|
13
|
+
include BlizzardApi::Wow::Searchable
|
14
|
+
|
13
15
|
protected
|
14
16
|
|
15
17
|
def endpoint_setup
|
@@ -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.spell
|
12
12
|
class Spell < 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
|
#
|