blizzard_api 0.5.6 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -1
  3. data/.rubocop.yml +1 -1
  4. data/CHANGELOG.md +18 -0
  5. data/Gemfile.lock +6 -2
  6. data/blizzard_api.gemspec +2 -1
  7. data/lib/blizzard_api/configuration.rb +10 -34
  8. data/lib/blizzard_api/diablo/community/act.rb +2 -2
  9. data/lib/blizzard_api/diablo/community/artisan.rb +2 -2
  10. data/lib/blizzard_api/diablo/community/character.rb +2 -2
  11. data/lib/blizzard_api/diablo/community/follower.rb +1 -1
  12. data/lib/blizzard_api/diablo/community/item.rb +1 -1
  13. data/lib/blizzard_api/diablo/community/item_type.rb +2 -2
  14. data/lib/blizzard_api/diablo/community/profile.rb +4 -4
  15. data/lib/blizzard_api/diablo/game_data/generic_data_endpoint.rb +3 -3
  16. data/lib/blizzard_api/hearthstone/game_data/back.rb +1 -1
  17. data/lib/blizzard_api/hearthstone/game_data/card.rb +2 -2
  18. data/lib/blizzard_api/hearthstone/game_data/generic_data_endpoint.rb +2 -2
  19. data/lib/blizzard_api/request.rb +24 -7
  20. data/lib/blizzard_api/starcraft.rb +1 -1
  21. data/lib/blizzard_api/starcraft/community/account.rb +1 -1
  22. data/lib/blizzard_api/starcraft/community/ladder.rb +2 -2
  23. data/lib/blizzard_api/starcraft/community/legacy.rb +3 -4
  24. data/lib/blizzard_api/starcraft/community/profile.rb +5 -5
  25. data/lib/blizzard_api/starcraft/game_data/league.rb +1 -1
  26. data/lib/blizzard_api/version.rb +1 -1
  27. data/lib/blizzard_api/wow/game_data/achievement.rb +3 -3
  28. data/lib/blizzard_api/wow/game_data/auction.rb +20 -2
  29. data/lib/blizzard_api/wow/game_data/azerite_essence.rb +1 -1
  30. data/lib/blizzard_api/wow/game_data/covenant.rb +5 -5
  31. data/lib/blizzard_api/wow/game_data/creature.rb +13 -7
  32. data/lib/blizzard_api/wow/game_data/generic_data_endpoint.rb +20 -8
  33. data/lib/blizzard_api/wow/game_data/guild_crest.rb +4 -2
  34. data/lib/blizzard_api/wow/game_data/item.rb +10 -6
  35. data/lib/blizzard_api/wow/game_data/journal.rb +8 -8
  36. data/lib/blizzard_api/wow/game_data/modified_crafting.rb +4 -4
  37. data/lib/blizzard_api/wow/game_data/mythic_keystone.rb +6 -6
  38. data/lib/blizzard_api/wow/game_data/mythic_keystone_affix.rb +1 -1
  39. data/lib/blizzard_api/wow/game_data/mythic_keystone_leaderboard.rb +2 -2
  40. data/lib/blizzard_api/wow/game_data/mythic_raid_leaderboard.rb +1 -1
  41. data/lib/blizzard_api/wow/game_data/pet.rb +4 -4
  42. data/lib/blizzard_api/wow/game_data/playable_class.rb +10 -8
  43. data/lib/blizzard_api/wow/game_data/playable_specialization.rb +8 -8
  44. data/lib/blizzard_api/wow/game_data/profession.rb +4 -4
  45. data/lib/blizzard_api/wow/game_data/pvp_season.rb +5 -3
  46. data/lib/blizzard_api/wow/game_data/pvp_tier.rb +1 -1
  47. data/lib/blizzard_api/wow/game_data/quest.rb +6 -6
  48. data/lib/blizzard_api/wow/game_data/reputation.rb +4 -4
  49. data/lib/blizzard_api/wow/game_data/spell.rb +1 -1
  50. data/lib/blizzard_api/wow/game_data/talent.rb +2 -2
  51. data/lib/blizzard_api/wow/game_data/tech_talent.rb +3 -3
  52. data/lib/blizzard_api/wow/game_data/wow_token.rb +1 -1
  53. data/lib/blizzard_api/wow/profile/character_profile.rb +27 -27
  54. data/lib/blizzard_api/wow/profile/guild.rb +5 -5
  55. data/lib/blizzard_api/wow/profile/profile.rb +6 -6
  56. data/lib/blizzard_api/wow/search/search_composer.rb +2 -2
  57. data/lib/blizzard_api/wow/search/search_request.rb +1 -1
  58. metadata +18 -4
@@ -33,7 +33,7 @@ module BlizzardApi
33
33
  #
34
34
  # @!macro response
35
35
  def factions(**options)
36
- api_request "#{endpoint_uri('faction')}/index", default_options.merge(options)
36
+ api_request "#{endpoint_uri('faction')}/index", **default_options.merge(options)
37
37
  end
38
38
 
39
39
  ##
@@ -44,7 +44,7 @@ module BlizzardApi
44
44
  #
45
45
  # @!macro response
46
46
  def faction(id, **options)
47
- api_request "#{endpoint_uri('faction')}/#{id}", default_options.merge(options)
47
+ api_request "#{endpoint_uri('faction')}/#{id}", **default_options.merge(options)
48
48
  end
49
49
 
50
50
  ##
@@ -54,7 +54,7 @@ module BlizzardApi
54
54
  #
55
55
  # @!macro response
56
56
  def tiers(**options)
57
- api_request "#{endpoint_uri('tiers')}/index", default_options.merge(options)
57
+ api_request "#{endpoint_uri('tiers')}/index", **default_options.merge(options)
58
58
  end
59
59
 
60
60
  ##
@@ -65,7 +65,7 @@ module BlizzardApi
65
65
  #
66
66
  # @!macro response
67
67
  def tier(id, **options)
68
- api_request "#{endpoint_uri('tiers')}/#{id}", default_options.merge(options)
68
+ api_request "#{endpoint_uri('tiers')}/#{id}", **default_options.merge(options)
69
69
  end
70
70
 
71
71
  protected
@@ -37,7 +37,7 @@ module BlizzardApi
37
37
  #
38
38
  # @!macro response
39
39
  def display_media(id, **options)
40
- api_request "#{base_url(:media)}/spell/#{id}", default_options.merge(options)
40
+ api_request "#{base_url(:media)}/spell/#{id}", **default_options.merge(options)
41
41
  end
42
42
 
43
43
  protected
@@ -17,7 +17,7 @@ module BlizzardApi
17
17
  #
18
18
  # @!macro response
19
19
  def pvp_talents(**options)
20
- api_request "#{base_url(:game_data)}/pvp-talent/index", default_options.merge(options)
20
+ api_request "#{base_url(:game_data)}/pvp-talent/index", **default_options.merge(options)
21
21
  end
22
22
 
23
23
  ##
@@ -29,7 +29,7 @@ module BlizzardApi
29
29
  #
30
30
  # @!macro response
31
31
  def pvp_talent(id, **options)
32
- api_request "#{base_url(:game_data)}/pvp-talent/#{id}", default_options.merge(options)
32
+ api_request "#{base_url(:game_data)}/pvp-talent/#{id}", **default_options.merge(options)
33
33
  end
34
34
 
35
35
  protected
@@ -17,7 +17,7 @@ module BlizzardApi
17
17
  #
18
18
  # @!macro response
19
19
  def tech_talent_trees(**options)
20
- api_request "#{base_url(:game_data)}/tech-talent-tree/index", default_options.merge(options)
20
+ api_request "#{base_url(:game_data)}/tech-talent-tree/index", **default_options.merge(options)
21
21
  end
22
22
 
23
23
  ##
@@ -29,7 +29,7 @@ module BlizzardApi
29
29
  #
30
30
  # @!macro response
31
31
  def tech_talent_tree(id, **options)
32
- api_request "#{base_url(:game_data)}/tech-talent-tree/#{id}", default_options.merge(options)
32
+ api_request "#{base_url(:game_data)}/tech-talent-tree/#{id}", **default_options.merge(options)
33
33
  end
34
34
 
35
35
  ##
@@ -41,7 +41,7 @@ module BlizzardApi
41
41
  #
42
42
  # @!macro response
43
43
  def media(id, **options)
44
- api_request "#{base_url(:media)}/tech-talent/#{id}", default_options.merge(options)
44
+ api_request "#{base_url(:media)}/tech-talent/#{id}", **default_options.merge(options)
45
45
  end
46
46
 
47
47
  protected
@@ -18,7 +18,7 @@ module BlizzardApi
18
18
  # @!macro response
19
19
  def get(**options)
20
20
  opts = { namespace: :dynamic, ttl: CACHE_HOUR }.merge(options)
21
- api_request "#{base_url(:game_data)}/token/index", opts
21
+ api_request "#{base_url(:game_data)}/token/index", **opts
22
22
  end
23
23
  end
24
24
  end
@@ -23,7 +23,7 @@ module BlizzardApi
23
23
  #
24
24
  # @!macro response
25
25
  def get(realm, character, **options)
26
- character_request realm, character, options
26
+ character_request realm, character, **options
27
27
  end
28
28
 
29
29
  ##
@@ -37,7 +37,7 @@ module BlizzardApi
37
37
  #
38
38
  # @!macro response
39
39
  def achievements(realm, character, **options)
40
- character_request realm, character, 'achievements', options
40
+ character_request realm, character, 'achievements', **options
41
41
  end
42
42
 
43
43
  ##
@@ -51,7 +51,7 @@ module BlizzardApi
51
51
  #
52
52
  # @!macro response
53
53
  def achievement_statistics(realm, character, **options)
54
- character_request realm, character, 'achievements/statistics', options
54
+ character_request realm, character, 'achievements/statistics', **options
55
55
  end
56
56
 
57
57
  ##
@@ -65,7 +65,7 @@ module BlizzardApi
65
65
  #
66
66
  # @!macro response
67
67
  def appearance(realm, character, **options)
68
- character_request realm, character, 'appearance', options
68
+ character_request realm, character, 'appearance', **options
69
69
  end
70
70
 
71
71
  ##
@@ -79,7 +79,7 @@ module BlizzardApi
79
79
  #
80
80
  # @!macro response
81
81
  def collections(realm, character, **options)
82
- character_request realm, character, 'collections', options
82
+ character_request realm, character, 'collections', **options
83
83
  end
84
84
 
85
85
  ##
@@ -93,7 +93,7 @@ module BlizzardApi
93
93
  #
94
94
  # @!macro response
95
95
  def pets(realm, character, **options)
96
- character_request realm, character, 'collections/pets', options
96
+ character_request realm, character, 'collections/pets', **options
97
97
  end
98
98
 
99
99
  ##
@@ -107,7 +107,7 @@ module BlizzardApi
107
107
  #
108
108
  # @!macro response
109
109
  def mounts(realm, character, **options)
110
- character_request realm, character, 'collections/mounts', options
110
+ character_request realm, character, 'collections/mounts', **options
111
111
  end
112
112
 
113
113
  ##
@@ -121,7 +121,7 @@ module BlizzardApi
121
121
  #
122
122
  # @!macro response
123
123
  def encounters(realm, character, **options)
124
- character_request realm, character, 'encounters', options
124
+ character_request realm, character, 'encounters', **options
125
125
  end
126
126
 
127
127
  ##
@@ -135,7 +135,7 @@ module BlizzardApi
135
135
  #
136
136
  # @!macro response
137
137
  def dungeons(realm, character, **options)
138
- character_request realm, character, 'encounters/dungeons', options
138
+ character_request realm, character, 'encounters/dungeons', **options
139
139
  end
140
140
 
141
141
  ##
@@ -149,7 +149,7 @@ module BlizzardApi
149
149
  #
150
150
  # @!macro response
151
151
  def raids(realm, character, **options)
152
- character_request realm, character, 'encounters/raids', options
152
+ character_request realm, character, 'encounters/raids', **options
153
153
  end
154
154
 
155
155
  ##
@@ -163,7 +163,7 @@ module BlizzardApi
163
163
  #
164
164
  # @!macro response
165
165
  def equipment(realm, character, **options)
166
- character_request realm, character, 'equipment', options
166
+ character_request realm, character, 'equipment', **options
167
167
  end
168
168
 
169
169
  ##
@@ -177,7 +177,7 @@ module BlizzardApi
177
177
  #
178
178
  # @!macro response
179
179
  def hunter_pets(realm, character, **options)
180
- character_request realm, character, 'hunter-pets', options
180
+ character_request realm, character, 'hunter-pets', **options
181
181
  end
182
182
 
183
183
  ##
@@ -191,7 +191,7 @@ module BlizzardApi
191
191
  #
192
192
  # @!macro response
193
193
  def media(realm, character, **options)
194
- character_request realm, character, 'character-media', options
194
+ character_request realm, character, 'character-media', **options
195
195
  end
196
196
 
197
197
  ##
@@ -205,7 +205,7 @@ module BlizzardApi
205
205
  #
206
206
  # @!macro response
207
207
  def mythic_keystone_profile(realm, character, **options)
208
- character_request realm, character, 'mythic-keystone-profile', options
208
+ character_request realm, character, 'mythic-keystone-profile', **options
209
209
  end
210
210
 
211
211
  ##
@@ -220,7 +220,7 @@ module BlizzardApi
220
220
  #
221
221
  # @!macro response
222
222
  def mythic_keystone_seasons(realm, character, season = nil, **options)
223
- character_request realm, character, "mythic-keystone-profile/season/#{season}", options
223
+ character_request realm, character, "mythic-keystone-profile/season/#{season}", **options
224
224
  end
225
225
 
226
226
  ##
@@ -234,7 +234,7 @@ module BlizzardApi
234
234
  #
235
235
  # @!macro response
236
236
  def professions(realm, character, **options)
237
- character_request realm, character, 'professions', options
237
+ character_request realm, character, 'professions', **options
238
238
  end
239
239
 
240
240
  ##
@@ -249,7 +249,7 @@ module BlizzardApi
249
249
  #
250
250
  # @!macro response
251
251
  def status(realm, character, **options)
252
- character_request realm, character, 'status', options
252
+ character_request realm, character, 'status', **options
253
253
  end
254
254
 
255
255
  ##
@@ -264,7 +264,7 @@ module BlizzardApi
264
264
  #
265
265
  # @!macro response
266
266
  def pvp_bracket(realm, character, bracket, **options)
267
- character_request realm, character, "pvp-bracket/#{bracket}", options
267
+ character_request realm, character, "pvp-bracket/#{bracket}", **options
268
268
  end
269
269
 
270
270
  ##
@@ -278,7 +278,7 @@ module BlizzardApi
278
278
  #
279
279
  # @!macro response
280
280
  def pvp_summary(realm, character, **options)
281
- character_request realm, character, 'pvp-summary', options
281
+ character_request realm, character, 'pvp-summary', **options
282
282
  end
283
283
 
284
284
  ##
@@ -294,9 +294,9 @@ module BlizzardApi
294
294
  # @!macro response
295
295
  def quests(realm, character, **options)
296
296
  completed = options.delete(:completed) || false
297
- return character_request realm, character, 'quests/completed', options if completed
297
+ return character_request realm, character, 'quests/completed', **options if completed
298
298
 
299
- character_request realm, character, 'quests', options
299
+ character_request realm, character, 'quests', **options
300
300
  end
301
301
 
302
302
  ##
@@ -310,7 +310,7 @@ module BlizzardApi
310
310
  #
311
311
  # @!macro response
312
312
  def reputation(realm, character, **options)
313
- character_request realm, character, 'reputations', options
313
+ character_request realm, character, 'reputations', **options
314
314
  end
315
315
 
316
316
  ##
@@ -324,7 +324,7 @@ module BlizzardApi
324
324
  #
325
325
  # @!macro response
326
326
  def soulbinds(realm, character, **options)
327
- character_request realm, character, 'soulbinds', options
327
+ character_request realm, character, 'soulbinds', **options
328
328
  end
329
329
 
330
330
  ##
@@ -338,7 +338,7 @@ module BlizzardApi
338
338
  #
339
339
  # @!macro response
340
340
  def specializations(realm, character, **options)
341
- character_request realm, character, 'specializations', options
341
+ character_request realm, character, 'specializations', **options
342
342
  end
343
343
 
344
344
  ##
@@ -352,7 +352,7 @@ module BlizzardApi
352
352
  #
353
353
  # @!macro response
354
354
  def statistics(realm, character, **options)
355
- character_request realm, character, 'statistics', options
355
+ character_request realm, character, 'statistics', **options
356
356
  end
357
357
 
358
358
  ##
@@ -366,7 +366,7 @@ module BlizzardApi
366
366
  #
367
367
  # @!macro response
368
368
  def titles(realm, character, **options)
369
- character_request realm, character, 'titles', options
369
+ character_request realm, character, 'titles', **options
370
370
  end
371
371
 
372
372
  private
@@ -380,7 +380,7 @@ module BlizzardApi
380
380
  def character_request(realm, character, variant = nil, **options)
381
381
  uri = "#{base_url(:profile)}/character/#{string_to_slug(realm)}/#{string_to_slug(character)}"
382
382
  uri += "/#{variant}" if variant
383
- api_request uri, default_options.merge(options)
383
+ api_request uri, **default_options.merge(options)
384
384
  end
385
385
  end
386
386
  end
@@ -21,7 +21,7 @@ module BlizzardApi
21
21
  #
22
22
  # @!macro response
23
23
  def get(realm, guild, **options)
24
- guild_request(realm, guild, options)
24
+ guild_request(realm, guild, **options)
25
25
  end
26
26
 
27
27
  ##
@@ -34,7 +34,7 @@ module BlizzardApi
34
34
  #
35
35
  # @!macro response
36
36
  def roster(realm, guild, **options)
37
- guild_request realm, guild, 'roster', options
37
+ guild_request realm, guild, 'roster', **options
38
38
  end
39
39
 
40
40
  ##
@@ -46,7 +46,7 @@ module BlizzardApi
46
46
  #
47
47
  # @!macro response
48
48
  def achievements(realm, guild, **options)
49
- guild_request realm, guild, 'achievements', options
49
+ guild_request realm, guild, 'achievements', **options
50
50
  end
51
51
 
52
52
  ##
@@ -58,7 +58,7 @@ module BlizzardApi
58
58
  #
59
59
  # @!macro response
60
60
  def activity(realm, guild, **options)
61
- guild_request realm, guild, 'activity', options
61
+ guild_request realm, guild, 'activity', **options
62
62
  end
63
63
 
64
64
  private
@@ -68,7 +68,7 @@ module BlizzardApi
68
68
  guild = string_to_slug(guild)
69
69
  url = "#{base_url(:game_data)}/guild/#{realm}/#{guild}"
70
70
  url += "/#{variant}" if variant
71
- api_request url, { ttl: CACHE_DAY, namespace: :profile }.merge(options)
71
+ api_request url, **{ ttl: CACHE_DAY, namespace: :profile }.merge(options)
72
72
  end
73
73
  end
74
74
  end
@@ -19,7 +19,7 @@ module BlizzardApi
19
19
  #
20
20
  # @!macro response
21
21
  def get(**options)
22
- api_request base_url(:user_profile).to_s, default_options.merge(options)
22
+ api_request base_url(:user_profile).to_s, **default_options.merge(options)
23
23
  end
24
24
 
25
25
  ##
@@ -29,7 +29,7 @@ module BlizzardApi
29
29
  #
30
30
  # @!macro response
31
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)
32
+ api_request "#{base_url(:user_profile)}/protected-character/#{realm_id}-#{character_id}", **default_options.merge(options)
33
33
  end
34
34
 
35
35
  ##
@@ -39,7 +39,7 @@ module BlizzardApi
39
39
  #
40
40
  # @!macro response
41
41
  def collection(**options)
42
- api_request "#{base_url(:user_profile)}/collections", default_options.merge(options)
42
+ api_request "#{base_url(:user_profile)}/collections", **default_options.merge(options)
43
43
  end
44
44
 
45
45
  ##
@@ -49,7 +49,7 @@ module BlizzardApi
49
49
  #
50
50
  # @!macro response
51
51
  def mounts(**options)
52
- api_request "#{base_url(:user_profile)}/collections/mounts", default_options.merge(options)
52
+ api_request "#{base_url(:user_profile)}/collections/mounts", **default_options.merge(options)
53
53
  end
54
54
 
55
55
  ##
@@ -59,7 +59,7 @@ module BlizzardApi
59
59
  #
60
60
  # @!macro response
61
61
  def pets(**options)
62
- api_request "#{base_url(:user_profile)}/collections/pets", default_options.merge(options)
62
+ api_request "#{base_url(:user_profile)}/collections/pets", **default_options.merge(options)
63
63
  end
64
64
 
65
65
  protected
@@ -68,7 +68,7 @@ module BlizzardApi
68
68
  { ttl: CACHE_HOUR, namespace: :profile }
69
69
  end
70
70
 
71
- def api_request(_uri, query_string = {})
71
+ def api_request(_uri, **query_string)
72
72
  query_string.merge! access_token: @token
73
73
  super
74
74
  end
@@ -27,7 +27,7 @@ module BlizzardApi
27
27
  #
28
28
  # @return {SearchComposer}
29
29
  def where(field, value)
30
- fields.push "#{field}=#{resolve_value(value)}"
30
+ fields.push "#{field}=#{URI.encode_www_form_component(resolve_value(value))}"
31
31
  self
32
32
  end
33
33
 
@@ -44,7 +44,7 @@ module BlizzardApi
44
44
  #
45
45
  # @return {SearchComposer}
46
46
  def where_not(field, value)
47
- fields.push "#{field}!=#{resolve_value(value)}"
47
+ fields.push "#{field}!=#{URI.encode_www_form_component(resolve_value(value))}"
48
48
  self
49
49
  end
50
50
 
@@ -17,7 +17,7 @@ module BlizzardApi
17
17
  search_options = SearchComposer.new(page, page_size)
18
18
  yield search_options if block_given?
19
19
 
20
- api_request "#{endpoint_uri(nil, :search)}?#{search_options.to_search_query}", default_options.merge(options)
20
+ api_request "#{endpoint_uri(nil, :search)}?#{search_options.to_search_query}", **default_options.merge(options)
21
21
  end
22
22
  end
23
23
  end