blizzard_api 0.3.1 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 45f2875f44a7d4af854565cd63f33286da88a5d0be8ef48bdda7ad3afa967787
4
- data.tar.gz: 561caa05b1ce6d7d4ffcd041e63ffa865b136fc6c556c32b6423eff08c48440d
3
+ metadata.gz: 0b9d57b5dea588a84d7b4d4a66f9885e42b66f3fc6e0be13eebca4b90fab564c
4
+ data.tar.gz: 9b97294d3acaeb1525cd5844519ba2a77e088975bf542184d6933d48123730c6
5
5
  SHA512:
6
- metadata.gz: 25c9fdc5b2263f7e556c494db66d15b56574ddd9a05694236d90ff25ed6edcf9702cdd8f83dd5977d3f6e4c67e2f0288e0eeb80e6c0f944e8a09fef51ae55662
7
- data.tar.gz: b80581204677d04b6cde838f9b9ca348787ffa2fb2d15706a4f43c86911eaf06e67d3b6c7a2806aa266dda71a9405c09db197239f10ece171e8c47e0da923b21
6
+ metadata.gz: db17c607f96ae46eebda6cfc550f297bd371898768a1b50da531818855d591baf7e5f0f76a63a2786d95f2010d9e3cc41977f7e8e35ef4b86db30ee2ecd1c26b
7
+ data.tar.gz: eaba5b7b425e781608a36cc9258085fc98f2da4268710ffa2b4c8c324ec129ac087327d94c33749840e6bac67fa81d24af58ad2d4ac8d504c8997ad4cad8dbf4
@@ -6,7 +6,7 @@ stages:
6
6
  test:
7
7
  stage: test
8
8
  script:
9
- - gem install bundler -v 1.17.3
9
+ - gem install bundler -v 2.1.2
10
10
  - bundle install
11
11
  - rubocop
12
12
  - rake
@@ -1,5 +1,11 @@
1
1
  Please view this file on the master branch, otherwise it may be outdated
2
2
 
3
+ **Version 0.3.2**
4
+
5
+ Added new WoW endpoints: https://us.forums.blizzard.com/en/blizzard/t/world-of-warcraft-api-update-visions-of-nzoth/3461
6
+
7
+ **Attention:** Removed compatibility with community endpoints for all migrated endpoints.
8
+
3
9
  **Version 0.3.1**
4
10
 
5
11
  https://us.forums.blizzard.com/en/blizzard/t/hearthstone-api-updates/2978
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- blizzard_api (0.3.0)
4
+ blizzard_api (0.3.2)
5
5
  redis (~> 4.1, >= 4.1.0)
6
6
 
7
7
  GEM
@@ -14,8 +14,8 @@ GEM
14
14
  parser (2.6.3.0)
15
15
  ast (~> 2.4.0)
16
16
  rainbow (3.0.0)
17
- rake (10.5.0)
18
- redis (4.1.2)
17
+ rake (13.0.1)
18
+ redis (4.1.3)
19
19
  rubocop (0.74.0)
20
20
  jaro_winkler (~> 1.5.1)
21
21
  parallel (~> 1.10)
@@ -32,7 +32,7 @@ PLATFORMS
32
32
  DEPENDENCIES
33
33
  blizzard_api!
34
34
  minitest (~> 5.0)
35
- rake (~> 10.0)
35
+ rake (~> 13.0)
36
36
  rubocop (~> 0.61)
37
37
 
38
38
  BUNDLED WITH
@@ -35,6 +35,6 @@ Gem::Specification.new do |spec|
35
35
  spec.add_runtime_dependency 'redis', '~> 4.1', '>= 4.1.0'
36
36
 
37
37
  spec.add_development_dependency 'minitest', '~> 5.0'
38
- spec.add_development_dependency 'rake', '~> 10.0'
38
+ spec.add_development_dependency 'rake', '~> 13.0'
39
39
  spec.add_development_dependency 'rubocop', '~> 0.61'
40
40
  end
@@ -50,7 +50,8 @@ module BlizzardApi
50
50
  game_data: 'https://%s.api.blizzard.com/data/%s',
51
51
  community: 'https://%s.api.blizzard.com/%s',
52
52
  profile: 'https://%s.api.blizzard.com/profile/%s',
53
- media: 'https://%s.api.blizzard.com/data/%s/media'
53
+ media: 'https://%s.api.blizzard.com/data/%s/media',
54
+ user_profile: 'https://%s.api.blizzard.com/profile/user/%s'
54
55
  }.freeze
55
56
 
56
57
  ##
@@ -2,5 +2,5 @@
2
2
 
3
3
  module BlizzardApi
4
4
  # Gem version
5
- VERSION = '0.3.1'
5
+ VERSION = '0.3.2'
6
6
  end
@@ -8,30 +8,33 @@ module BlizzardApi
8
8
 
9
9
  # WoW data api
10
10
  require_relative 'wow/game_data/achievement'
11
+ require_relative 'wow/game_data/auction'
12
+ require_relative 'wow/game_data/azerite_essence'
11
13
  require_relative 'wow/game_data/connected_realm'
12
14
  require_relative 'wow/game_data/creature'
13
- require_relative 'wow/game_data/guild'
14
15
  require_relative 'wow/game_data/guild_crest'
16
+ require_relative 'wow/game_data/item'
17
+ require_relative 'wow/game_data/journal'
18
+ require_relative 'wow/game_data/mount'
15
19
  require_relative 'wow/game_data/mythic_keystone_affix'
16
20
  require_relative 'wow/game_data/mythic_keystone'
17
21
  require_relative 'wow/game_data/mythic_raid_leaderboard'
18
- require_relative 'wow/game_data/mount'
19
22
  require_relative 'wow/game_data/mythic_keystone_leaderboard'
20
23
  require_relative 'wow/game_data/pet'
21
24
  require_relative 'wow/game_data/playable_class'
25
+ require_relative 'wow/game_data/playable_race'
22
26
  require_relative 'wow/game_data/playable_specialization'
23
27
  require_relative 'wow/game_data/power_type'
24
28
  require_relative 'wow/game_data/pvp_season'
25
29
  require_relative 'wow/game_data/pvp_tier'
30
+ require_relative 'wow/game_data/quest'
26
31
  require_relative 'wow/game_data/realm'
27
32
  require_relative 'wow/game_data/region'
28
- require_relative 'wow/game_data/wow_token'
29
- require_relative 'wow/game_data/race'
33
+ require_relative 'wow/game_data/reputation'
34
+ require_relative 'wow/game_data/spell'
35
+ require_relative 'wow/game_data/talent'
30
36
  require_relative 'wow/game_data/title'
31
- require_relative 'wow/game_data/item'
32
- require_relative 'wow/game_data/azerite_essence'
33
- require_relative 'wow/game_data/reputation_tier'
34
- require_relative 'wow/game_data/reputation_faction'
37
+ require_relative 'wow/game_data/wow_token'
35
38
 
36
39
  ##
37
40
  # @return {Achievement}
@@ -39,6 +42,18 @@ module BlizzardApi
39
42
  BlizzardApi::Wow::Achievement.new
40
43
  end
41
44
 
45
+ ##
46
+ # @return {Auction}
47
+ def self.auction
48
+ BlizzardApi::Wow::Auction.new
49
+ end
50
+
51
+ ##
52
+ # @return {AzeriteEssence}
53
+ def self.azerite_essence
54
+ BlizzardApi::Wow::AzeriteEssence.new
55
+ end
56
+
42
57
  ##
43
58
  # @return {ConnectedRealm}
44
59
  def self.connected_realm
@@ -51,18 +66,30 @@ module BlizzardApi
51
66
  BlizzardApi::Wow::Creature.new
52
67
  end
53
68
 
54
- ##
55
- # @return {Guild}
56
- def self.guild
57
- BlizzardApi::Wow::Guild.new
58
- end
59
-
60
69
  ##
61
70
  # @return {GuildCrest}
62
71
  def self.guild_crest
63
72
  BlizzardApi::Wow::GuildCrest.new
64
73
  end
65
74
 
75
+ ##
76
+ # @return {Item}
77
+ def self.item
78
+ BlizzardApi::Wow::Item.new
79
+ end
80
+
81
+ ##
82
+ # @return {Journal}
83
+ def self.journal
84
+ BlizzardApi::Wow::Journal.new
85
+ end
86
+
87
+ ##
88
+ # @return {Mount}
89
+ def self.mount
90
+ BlizzardApi::Wow::Mount.new
91
+ end
92
+
66
93
  ##
67
94
  # @return {MythicKeystoneAffix}
68
95
  def self.mythic_keystone_affix
@@ -81,12 +108,6 @@ module BlizzardApi
81
108
  BlizzardApi::Wow::MythicRaidLeaderboard.new
82
109
  end
83
110
 
84
- ##
85
- # @return {Mount}
86
- def self.mount
87
- BlizzardApi::Wow::Mount.new
88
- end
89
-
90
111
  ##
91
112
  # @return {MythicKeystoneLeaderboard}
92
113
  def self.mythic_keystone_leaderboard
@@ -105,6 +126,12 @@ module BlizzardApi
105
126
  BlizzardApi::Wow::PlayableClass.new
106
127
  end
107
128
 
129
+ ##
130
+ # @return {Race}
131
+ def self.playable_race
132
+ BlizzardApi::Wow::PlayableRace.new
133
+ end
134
+
108
135
  ##
109
136
  # @return {PlayableSpecialization}
110
137
  def self.playable_specialization
@@ -129,6 +156,12 @@ module BlizzardApi
129
156
  BlizzardApi::Wow::PvpTier.new
130
157
  end
131
158
 
159
+ ##
160
+ # @return {Quest}
161
+ def self.quest
162
+ BlizzardApi::Wow::Quest.new
163
+ end
164
+
132
165
  ##
133
166
  # @return {Realm}
134
167
  def self.realm
@@ -142,63 +175,42 @@ module BlizzardApi
142
175
  end
143
176
 
144
177
  ##
145
- # @return {WowToken}
146
- def self.wow_token
147
- BlizzardApi::Wow::WowToken.new
148
- end
149
-
150
- ##
151
- # @return {Race}
152
- def self.race
153
- BlizzardApi::Wow::Race.new
154
- end
155
-
156
- ##
157
- # @return {Title}
158
- def self.title
159
- BlizzardApi::Wow::Title.new
178
+ # @return {Reputation}
179
+ def self.reputation
180
+ BlizzardApi::Wow::Reputation.new
160
181
  end
161
182
 
162
183
  ##
163
- # @return {Item}
164
- def self.item
165
- BlizzardApi::Wow::Item.new
184
+ # @return {Spell}
185
+ def self.spell
186
+ BlizzardApi::Wow::Spell.new
166
187
  end
167
188
 
168
189
  ##
169
- # @return {AzeriteEssence}
170
- def self.azerite_essence
171
- BlizzardApi::Wow::AzeriteEssence.new
190
+ # @return {Talent}
191
+ def self.talent
192
+ BlizzardApi::Wow::Talent.new
172
193
  end
173
194
 
174
195
  ##
175
- # @return {ReputationTier}
176
- def self.reputation_tier
177
- BlizzardApi::Wow::ReputationTier.new
196
+ # @return {Title}
197
+ def self.title
198
+ BlizzardApi::Wow::Title.new
178
199
  end
179
200
 
180
201
  ##
181
- # @return {ReputationFaction}
182
- def self.reputation_faction
183
- BlizzardApi::Wow::ReputationFaction.new
202
+ # @return {WowToken}
203
+ def self.wow_token
204
+ BlizzardApi::Wow::WowToken.new
184
205
  end
185
206
 
186
207
  # Wow community api
187
- require_relative 'wow/community/auction'
188
208
  require_relative 'wow/community/boss'
189
209
  require_relative 'wow/community/challenge'
190
210
  require_relative 'wow/community/pvp'
191
- require_relative 'wow/community/quest'
192
211
  require_relative 'wow/community/recipe'
193
- require_relative 'wow/community/spell'
194
212
  require_relative 'wow/community/zone'
195
213
 
196
- ##
197
- # @return {Auction}
198
- def self.auction
199
- BlizzardApi::Wow::Auction.new
200
- end
201
-
202
214
  ##
203
215
  # @return {Boss}
204
216
  def self.boss
@@ -223,32 +235,38 @@ module BlizzardApi
223
235
  BlizzardApi::Wow::PvP.new
224
236
  end
225
237
 
226
- ##
227
- # @return {Quest}
228
- def self.quest
229
- BlizzardApi::Wow::Quest.new
230
- end
231
-
232
238
  ##
233
239
  # @return {Recipe}
234
240
  def self.recipe
235
241
  BlizzardApi::Wow::Recipe.new
236
242
  end
237
243
 
238
- ##
239
- # @return {Spell}
240
- def self.spell
241
- BlizzardApi::Wow::Spell.new
242
- end
243
-
244
244
  ##
245
245
  # @return {Zone}
246
246
  def self.zone
247
247
  BlizzardApi::Wow::Zone.new
248
248
  end
249
249
 
250
+ require_relative 'wow/profile/profile'
251
+ require_relative 'wow/profile/guild'
250
252
  require_relative 'wow/profile/character_profile'
251
253
 
254
+ ##
255
+ # @param token [String] A token obtained using the authorization_code flow
256
+ #
257
+ # @!macro request_options
258
+ #
259
+ # @return {Profile}
260
+ def self.profile(token)
261
+ BlizzardApi::Wow::Profile.new(token)
262
+ end
263
+
264
+ ##
265
+ # @return {Guild}
266
+ def self.guild
267
+ BlizzardApi::Wow::Guild.new
268
+ end
269
+
252
270
  ##
253
271
  # @return {CharacterProfile}
254
272
  def self.character_profile
@@ -10,22 +10,6 @@ module BlizzardApi
10
10
  # You can get an instance of this class using the default region as follows:
11
11
  # api_instance = BlizzardApi::Wow.achievement
12
12
  class Achievement < Wow::GenericDataEndpoint
13
- ##
14
- # Fetch all possible data for one of the items listed by the {#index} using its *id*
15
- #
16
- # @param id [Integer] One of the IDs returned by the {#index}
17
- #
18
- # @!macro request_options
19
- # @option options [Boolean] :use_community_endpoint If set to true, this method will call the community endpoint
20
- # instead of the data endpoint https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
21
- #
22
- # @!macro response
23
- def get(id, options = {})
24
- return super id, options unless options.include? :use_community_endpoint
25
-
26
- api_request "#{base_url(:community)}/achievement/#{id}", { ttl: CACHE_TRIMESTER }.merge(options)
27
- end
28
-
29
13
  ##
30
14
  # This method overrides the inherited default behavior to prevent high server load and fetch time
31
15
  #
@@ -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 auctions
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.auction
12
+ class Auction < Wow::Request
13
+ ##
14
+ # Return all active auctions for the specified connected realm
15
+ #
16
+ # @param connected_realm_id [Integer] A valid connected realm id
17
+ # @!macro request_options
18
+ #
19
+ # @!macro response
20
+ def get(connected_realm_id, options = {})
21
+ opts = { ttl: CACHE_HOUR, namespace: :dynamic }.merge(options)
22
+ api_request "#{base_url(:game_data)}/connected-realm/#{connected_realm_id}/auctions", opts
23
+ end
24
+ end
25
+ end
26
+ end
@@ -5,7 +5,7 @@ module BlizzardApi
5
5
  ##
6
6
  # This class allows access to World of Warcraft item data
7
7
  #
8
- # @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
8
+ # @see https://develop.battle.net/documentation/world-of-warcraft/game-data-apis
9
9
  #
10
10
  # You can get an instance of this class using the default region as follows:
11
11
  # api_instance = BlizzardApi::Wow.item
@@ -26,47 +26,14 @@ module BlizzardApi
26
26
  raise BlizzardApi::ApiException, 'This endpoint does not have a complete method'
27
27
  end
28
28
 
29
- ##
30
- # Return complete data of an item by id
31
- #
32
- # @param id [Integer] Item id
33
- # @!macro request_options
34
- # @option options [Boolean] :use_community_endpoint If set to true, this method will call the community endpoint
35
- # instead of the data endpoint https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
36
- # @option options [Boolean] :classic If set to true, this method will call the classic version
37
- #
38
- # @!macro response
39
- def get(id, options = {})
40
- return super id, options unless options.include? :use_community_endpoint
41
-
42
- api_request "#{base_url(:community)}/item/#{id}", { ttl: CACHE_TRIMESTER }.merge(options)
43
- end
44
-
45
- ##
46
- # Return complete data of an item set by id
47
- #
48
- # @param set_id [Integer] Item set id
49
- # @!macro request_options
50
- #
51
- # @!macro response
52
- def item_set(set_id, options = {})
53
- api_request "#{base_url(:community)}/item/set/#{set_id}", { ttl: CACHE_TRIMESTER }.merge(options)
54
- end
55
-
56
29
  ##
57
30
  # Return a list of item classes
58
31
  #
59
32
  # @!macro request_options
60
- # @option options [Boolean] :use_community_endpoint If set to true, this method will call the community endpoint
61
- # instead of the data endpoint https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
62
33
  # @option options [Boolean] :classic If set to true, this method will call the classic version
63
34
  #
64
35
  # @!macro response
65
36
  def classes(options = {})
66
- if options.include? :use_community_endpoint
67
- return api_request "#{base_url(:community)}/data/item/classes", { ttl: CACHE_TRIMESTER }.merge(options)
68
- end
69
-
70
37
  api_request "#{endpoint_uri('class')}/index", default_options.merge(options)
71
38
  end
72
39
 
@@ -108,6 +75,27 @@ module BlizzardApi
108
75
  api_request "#{base_url(:media)}/item/#{id}", default_options.merge(options)
109
76
  end
110
77
 
78
+ ##
79
+ # Return a list of item sets
80
+ #
81
+ # @!macro request_options
82
+ #
83
+ # @!macro response
84
+ def sets(options = {})
85
+ api_request "#{endpoint_uri('set')}/index", default_options.merge(options)
86
+ end
87
+
88
+ ##
89
+ # Return data about an item set
90
+ #
91
+ # @param id [Integer] Item set id
92
+ # @!macro request_options
93
+ #
94
+ # @!macro response
95
+ def set(id, options = {})
96
+ api_request "#{endpoint_uri('set')}/#{id}", default_options.merge(options)
97
+ end
98
+
111
99
  protected
112
100
 
113
101
  def endpoint_setup