blizzard_api 0.5.3 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) 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 +23 -1
  5. data/Gemfile.lock +16 -12
  6. data/README.md +57 -215
  7. data/blizzard_api.gemspec +2 -1
  8. data/lib/blizzard_api/configuration.rb +10 -34
  9. data/lib/blizzard_api/diablo/community/act.rb +4 -4
  10. data/lib/blizzard_api/diablo/community/artisan.rb +4 -4
  11. data/lib/blizzard_api/diablo/community/character.rb +4 -4
  12. data/lib/blizzard_api/diablo/community/follower.rb +2 -2
  13. data/lib/blizzard_api/diablo/community/item.rb +2 -2
  14. data/lib/blizzard_api/diablo/community/item_type.rb +4 -4
  15. data/lib/blizzard_api/diablo/community/profile.rb +4 -4
  16. data/lib/blizzard_api/diablo/game_data/generic_data_endpoint.rb +6 -6
  17. data/lib/blizzard_api/hearthstone/game_data/back.rb +2 -2
  18. data/lib/blizzard_api/hearthstone/game_data/card.rb +4 -4
  19. data/lib/blizzard_api/hearthstone/game_data/generic_data_endpoint.rb +4 -4
  20. data/lib/blizzard_api/request.rb +26 -9
  21. data/lib/blizzard_api/starcraft.rb +3 -3
  22. data/lib/blizzard_api/starcraft/community/account.rb +1 -1
  23. data/lib/blizzard_api/starcraft/community/ladder.rb +4 -4
  24. data/lib/blizzard_api/starcraft/community/legacy.rb +9 -10
  25. data/lib/blizzard_api/starcraft/community/profile.rb +10 -10
  26. data/lib/blizzard_api/starcraft/game_data/league.rb +2 -2
  27. data/lib/blizzard_api/version.rb +1 -1
  28. data/lib/blizzard_api/wow.rb +0 -7
  29. data/lib/blizzard_api/wow/game_data/achievement.rb +6 -6
  30. data/lib/blizzard_api/wow/game_data/auction.rb +20 -2
  31. data/lib/blizzard_api/wow/game_data/azerite_essence.rb +2 -2
  32. data/lib/blizzard_api/wow/game_data/covenant.rb +10 -10
  33. data/lib/blizzard_api/wow/game_data/creature.rb +19 -13
  34. data/lib/blizzard_api/wow/game_data/generic_data_endpoint.rb +23 -11
  35. data/lib/blizzard_api/wow/game_data/guild_crest.rb +6 -4
  36. data/lib/blizzard_api/wow/game_data/item.rb +16 -12
  37. data/lib/blizzard_api/wow/game_data/journal.rb +15 -15
  38. data/lib/blizzard_api/wow/game_data/modified_crafting.rb +8 -8
  39. data/lib/blizzard_api/wow/game_data/mythic_keystone.rb +12 -12
  40. data/lib/blizzard_api/wow/game_data/mythic_keystone_affix.rb +2 -2
  41. data/lib/blizzard_api/wow/game_data/mythic_keystone_leaderboard.rb +4 -4
  42. data/lib/blizzard_api/wow/game_data/mythic_raid_leaderboard.rb +2 -2
  43. data/lib/blizzard_api/wow/game_data/pet.rb +8 -8
  44. data/lib/blizzard_api/wow/game_data/playable_class.rb +14 -12
  45. data/lib/blizzard_api/wow/game_data/playable_specialization.rb +10 -10
  46. data/lib/blizzard_api/wow/game_data/profession.rb +8 -8
  47. data/lib/blizzard_api/wow/game_data/pvp_season.rb +8 -6
  48. data/lib/blizzard_api/wow/game_data/pvp_tier.rb +2 -2
  49. data/lib/blizzard_api/wow/game_data/quest.rb +12 -12
  50. data/lib/blizzard_api/wow/game_data/reputation.rb +8 -8
  51. data/lib/blizzard_api/wow/game_data/spell.rb +2 -2
  52. data/lib/blizzard_api/wow/game_data/talent.rb +4 -4
  53. data/lib/blizzard_api/wow/game_data/tech_talent.rb +6 -6
  54. data/lib/blizzard_api/wow/game_data/wow_token.rb +2 -2
  55. data/lib/blizzard_api/wow/profile/character_profile.rb +53 -53
  56. data/lib/blizzard_api/wow/profile/guild.rb +10 -10
  57. data/lib/blizzard_api/wow/profile/profile.rb +10 -10
  58. data/lib/blizzard_api/wow/search/search_request.rb +2 -2
  59. metadata +18 -4
@@ -16,8 +16,8 @@ module BlizzardApi
16
16
  # @!macro request_options
17
17
  #
18
18
  # @!macro response
19
- def index(options = {})
20
- api_request "#{base_url(:community)}/data/act", { ttl: CACHE_TRIMESTER }.merge(options)
19
+ def index(**options)
20
+ api_request "#{base_url(:community)}/data/act", **{ ttl: CACHE_TRIMESTER }.merge(options)
21
21
  end
22
22
 
23
23
  ##
@@ -27,8 +27,8 @@ module BlizzardApi
27
27
  # @!macro request_options
28
28
  #
29
29
  # @!macro response
30
- def get(id, options = {})
31
- api_request "#{base_url(:community)}/data/act/#{id}", { ttl: CACHE_TRIMESTER }.merge(options)
30
+ def get(id, **options)
31
+ api_request "#{base_url(:community)}/data/act/#{id}", **{ ttl: CACHE_TRIMESTER }.merge(options)
32
32
  end
33
33
  end
34
34
  end
@@ -17,8 +17,8 @@ module BlizzardApi
17
17
  # @!macro request_options
18
18
  #
19
19
  # @!macro response
20
- def get(artisan_slug, options = {})
21
- api_request "#{base_url(:community)}/data/artisan/#{artisan_slug}", { ttl: CACHE_TRIMESTER }.merge(options)
20
+ def get(artisan_slug, **options)
21
+ api_request "#{base_url(:community)}/data/artisan/#{artisan_slug}", **{ ttl: CACHE_TRIMESTER }.merge(options)
22
22
  end
23
23
 
24
24
  ##
@@ -29,9 +29,9 @@ module BlizzardApi
29
29
  # @!macro request_options
30
30
  #
31
31
  # @!macro response
32
- def recipe(artisan_slug, recipe_slug, options = {})
32
+ def recipe(artisan_slug, recipe_slug, **options)
33
33
  opts = { ttl: CACHE_TRIMESTER }.merge(options)
34
- api_request "#{base_url(:community)}/data/artisan/#{artisan_slug}/recipe/#{recipe_slug}", opts
34
+ api_request "#{base_url(:community)}/data/artisan/#{artisan_slug}/recipe/#{recipe_slug}", **opts
35
35
  end
36
36
  end
37
37
  end
@@ -17,8 +17,8 @@ module BlizzardApi
17
17
  # @!macro request_options
18
18
  #
19
19
  # @!macro response
20
- def get(class_slug, options = {})
21
- api_request "#{base_url(:community)}/data/hero/#{class_slug}", { ttl: CACHE_TRIMESTER }.merge(options)
20
+ def get(class_slug, **options)
21
+ api_request "#{base_url(:community)}/data/hero/#{class_slug}", **{ ttl: CACHE_TRIMESTER }.merge(options)
22
22
  end
23
23
 
24
24
  ##
@@ -29,9 +29,9 @@ module BlizzardApi
29
29
  # @!macro request_options
30
30
  #
31
31
  # @!macro response
32
- def skill(class_slug, skill_slug, options = {})
32
+ def skill(class_slug, skill_slug, **options)
33
33
  opts = { ttl: CACHE_TRIMESTER }.merge(options)
34
- api_request "#{base_url(:community)}/data/hero/#{class_slug}/skill/#{skill_slug}", opts
34
+ api_request "#{base_url(:community)}/data/hero/#{class_slug}/skill/#{skill_slug}", **opts
35
35
  end
36
36
  end
37
37
  end
@@ -17,8 +17,8 @@ module BlizzardApi
17
17
  # @!macro request_options
18
18
  #
19
19
  # @!macro response
20
- def get(follower_slug, options = {})
21
- api_request "#{base_url(:community)}/data/follower/#{follower_slug}", { ttl: CACHE_TRIMESTER }.merge(options)
20
+ def get(follower_slug, **options)
21
+ api_request "#{base_url(:community)}/data/follower/#{follower_slug}", **{ ttl: CACHE_TRIMESTER }.merge(options)
22
22
  end
23
23
  end
24
24
  end
@@ -17,8 +17,8 @@ module BlizzardApi
17
17
  # @!macro request_options
18
18
  #
19
19
  # @!macro response
20
- def get(item_slug_and_id, options = {})
21
- api_request "#{base_url(:community)}/data/item/#{item_slug_and_id}", { ttl: CACHE_TRIMESTER }.merge(options)
20
+ def get(item_slug_and_id, **options)
21
+ api_request "#{base_url(:community)}/data/item/#{item_slug_and_id}", **{ ttl: CACHE_TRIMESTER }.merge(options)
22
22
  end
23
23
  end
24
24
  end
@@ -16,8 +16,8 @@ module BlizzardApi
16
16
  # @!macro request_options
17
17
  #
18
18
  # @!macro response
19
- def index(options = {})
20
- api_request "#{base_url(:community)}/data/item-type", { ttl: CACHE_TRIMESTER }.merge(options)
19
+ def index(**options)
20
+ api_request "#{base_url(:community)}/data/item-type", **{ ttl: CACHE_TRIMESTER }.merge(options)
21
21
  end
22
22
 
23
23
  ##
@@ -27,8 +27,8 @@ module BlizzardApi
27
27
  # @!macro request_options
28
28
  #
29
29
  # @!macro response
30
- def get(item_type_slug, options = {})
31
- api_request "#{base_url(:community)}/data/item-type/#{item_type_slug}", { ttl: CACHE_TRIMESTER }.merge(options)
30
+ def get(item_type_slug, **options)
31
+ api_request "#{base_url(:community)}/data/item-type/#{item_type_slug}", **{ ttl: CACHE_TRIMESTER }.merge(options)
32
32
  end
33
33
  end
34
34
  end
@@ -20,7 +20,7 @@ module BlizzardApi
20
20
  # @!macro response
21
21
  #
22
22
  # @see https://develop.battle.net/documentation/guides/using-oauth/authorization-code-flow
23
- def index(battletag, oauth_token, options = {})
23
+ def index(battletag, oauth_token, **options)
24
24
  opts = { access_token: oauth_token, ttl: CACHE_TRIMESTER }.merge(options)
25
25
  api_request "#{base_url(:community)}/profile/#{parse_battle_tag(battletag)}/", opts
26
26
  end
@@ -36,7 +36,7 @@ module BlizzardApi
36
36
  # @!macro response
37
37
  #
38
38
  # @see https://develop.battle.net/documentation/guides/using-oauth/authorization-code-flow
39
- def hero(battletag, oauth_token, hero_id, options = {})
39
+ def hero(battletag, oauth_token, hero_id, **options)
40
40
  opts = { access_token: oauth_token, ttl: CACHE_TRIMESTER }.merge(options)
41
41
  api_request "#{base_url(:community)}/profile/#{parse_battle_tag(battletag)}/hero/#{hero_id}", opts
42
42
  end
@@ -52,7 +52,7 @@ module BlizzardApi
52
52
  # @!macro response
53
53
  #
54
54
  # @see https://develop.battle.net/documentation/guides/using-oauth/authorization-code-flow
55
- def hero_items(battletag, oauth_token, hero_id, options = {})
55
+ def hero_items(battletag, oauth_token, hero_id, **options)
56
56
  opts = { access_token: oauth_token, ttl: CACHE_TRIMESTER }.merge(options)
57
57
  api_request "#{base_url(:community)}/profile/#{parse_battle_tag(battletag)}/hero/#{hero_id}/items", opts
58
58
  end
@@ -68,7 +68,7 @@ module BlizzardApi
68
68
  # @!macro response
69
69
  #
70
70
  # @see https://develop.battle.net/documentation/guides/using-oauth/authorization-code-flow
71
- def hero_follower_items(battletag, oauth_token, hero_id, options = {})
71
+ def hero_follower_items(battletag, oauth_token, hero_id, **options)
72
72
  opts = { access_token: oauth_token, ttl: CACHE_TRIMESTER }.merge(options)
73
73
  api_request "#{base_url(:community)}/profile/#{parse_battle_tag(battletag)}/hero/#{hero_id}/follower-items", opts
74
74
  end
@@ -16,8 +16,8 @@ module BlizzardApi
16
16
  # @!macro request_options
17
17
  #
18
18
  # @!macro response
19
- def index(options = {})
20
- api_request "#{base_url(:game_data)}/#{@endpoint}/", default_options.merge(options)
19
+ def index(**options)
20
+ api_request "#{base_url(:game_data)}/#{@endpoint}/", **default_options.merge(options)
21
21
  end
22
22
 
23
23
  ##
@@ -27,8 +27,8 @@ module BlizzardApi
27
27
  # @!macro request_options
28
28
  #
29
29
  # @!macro response
30
- def get(id, options = {})
31
- api_request "#{base_url(:game_data)}/#{@endpoint}/#{id}", default_options.merge(options)
30
+ def get(id, **options)
31
+ api_request "#{base_url(:game_data)}/#{@endpoint}/#{id}", **default_options.merge(options)
32
32
  end
33
33
 
34
34
  ##
@@ -39,9 +39,9 @@ module BlizzardApi
39
39
  # @!macro request_options
40
40
  #
41
41
  # @!macro response
42
- def leaderboard(id, leaderboard_id, options = {})
42
+ def leaderboard(id, leaderboard_id, **options)
43
43
  opts = default_options.merge(options)
44
- api_request "#{base_url(:game_data)}/#{@endpoint}/#{id}/leaderboard/#{leaderboard_id}", opts
44
+ api_request "#{base_url(:game_data)}/#{@endpoint}/#{id}/leaderboard/#{leaderboard_id}", **opts
45
45
  end
46
46
 
47
47
  protected
@@ -36,10 +36,10 @@ module BlizzardApi
36
36
  # option is invalid
37
37
  #
38
38
  # @!macro response
39
- def search(search_options = {}, options = {})
39
+ def search(search_options = {}, **options)
40
40
  validate_search_options search_options if options.include? :validate_fields
41
41
 
42
- api_request "#{base_url(:community)}/cardbacks", default_options.merge(options).merge(search_options)
42
+ api_request "#{base_url(:community)}/cardbacks", **default_options.merge(options).merge(search_options)
43
43
  end
44
44
 
45
45
  protected
@@ -72,10 +72,10 @@ module BlizzardApi
72
72
  # option is invalid
73
73
  #
74
74
  # @!macro response
75
- def search(search_options = {}, options = {})
75
+ def search(search_options = {}, **options)
76
76
  validate_search_options search_options if options.include? :validate_fields
77
77
 
78
- api_request "#{base_url(:community)}/cards", default_options.merge(options).merge(search_options)
78
+ api_request "#{base_url(:community)}/cards", **default_options.merge(options).merge(search_options)
79
79
  end
80
80
 
81
81
  ##
@@ -90,8 +90,8 @@ module BlizzardApi
90
90
  # @!macro request_options
91
91
  #
92
92
  # @!macro response
93
- def get(id_or_slug, game_mode = 'constructed', options = {})
94
- super id_or_slug, { gameMode: game_mode }.merge(options)
93
+ def get(id_or_slug, game_mode = 'constructed', **options)
94
+ super id_or_slug, **{ gameMode: game_mode }.merge(options)
95
95
  end
96
96
 
97
97
  protected
@@ -20,8 +20,8 @@ module BlizzardApi
20
20
  # @!macro request_options
21
21
  #
22
22
  # @!macro response
23
- def index(options = {})
24
- api_request "#{base_url(:community)}/#{@endpoint}/", default_options.merge(options)
23
+ def index(**options)
24
+ api_request "#{base_url(:community)}/#{@endpoint}/", **default_options.merge(options)
25
25
  end
26
26
 
27
27
  ##
@@ -31,8 +31,8 @@ module BlizzardApi
31
31
  # @!macro request_options
32
32
  #
33
33
  # @!macro response
34
- def get(id, options = {})
35
- api_request "#{base_url(:community)}/#{@endpoint}/#{id}", default_options.merge(options)
34
+ def get(id, **options)
35
+ api_request "#{base_url(:community)}/#{@endpoint}/#{id}", **default_options.merge(options)
36
36
  end
37
37
 
38
38
  protected
@@ -9,6 +9,8 @@
9
9
  # @option options [Boolean] :ignore_cache If set to true the request will not use the cache
10
10
  # @option options [Integer] :ttl Override the default time (in seconds) a request should be cached
11
11
  # @option options [DateTime] :since Adds the If-modified-since headers. Will always ignore cache when set.
12
+ # @option options [Integer] :concurrency How many threads to use for complete sets of data.
13
+ # BEWARE: Might cause 429 responses, in this case lower the number.
12
14
 
13
15
  ##
14
16
  # @!macro [new] regions
@@ -83,16 +85,31 @@ module BlizzardApi
83
85
  format BASE_URLS[scope], region, @game
84
86
  end
85
87
 
88
+ ##
89
+ # Returns a valid version namespace
90
+ #
91
+ # @param [Hash] options A hash containing a valid namespace key
92
+ def endpoint_version(options)
93
+ if options.key? :classic
94
+ 'classic-'
95
+ elsif options.key? :classic1x
96
+ 'classic1x-'
97
+ else
98
+ ''
99
+ end
100
+ end
101
+
86
102
  ##
87
103
  # Returns a valid namespace string for consuming the api endpoints
88
104
  #
89
105
  # @param [Hash] options A hash containing the namespace key
90
106
  def endpoint_namespace(options)
107
+ version = endpoint_version(options)
91
108
  case options[:namespace]
92
109
  when :dynamic
93
- options.include?(:classic) ? "dynamic-classic-#{region}" : "dynamic-#{region}"
110
+ "dynamic-#{version}#{region}"
94
111
  when :static
95
- options.include?(:classic) ? "static-classic-#{region}" : "static-#{region}"
112
+ "static-#{version}#{region}"
96
113
  when :profile
97
114
  "profile-#{region}"
98
115
  else
@@ -115,7 +132,7 @@ module BlizzardApi
115
132
  BlizzardApi.access_token = JSON.parse(response.body)['access_token']
116
133
  end
117
134
 
118
- def request(url, options = {})
135
+ def request(url, **options)
119
136
  # Creates the whole url for request
120
137
  parsed_url = URI.parse(url)
121
138
 
@@ -124,7 +141,7 @@ module BlizzardApi
124
141
  # If data was found that means cache is enabled and valid
125
142
  return JSON.parse(data, symbolize_names: true) if data
126
143
 
127
- response = consume_api parsed_url, options
144
+ response = consume_api parsed_url, **options
128
145
 
129
146
  save_in_cache parsed_url.to_s, response.body, options[:ttl] || CACHE_DAY if using_cache? options
130
147
 
@@ -134,9 +151,9 @@ module BlizzardApi
134
151
  response_data
135
152
  end
136
153
 
137
- def api_request(uri, query_string = {})
154
+ def api_request(uri, **query_string)
138
155
  # List of request options
139
- options_key = %i[ignore_cache ttl format access_token namespace classic headers since]
156
+ options_key = %i[ignore_cache ttl format access_token namespace classic classic1x headers since]
140
157
 
141
158
  # Separates request options from api fields and options. Any user-defined option will be treated as api field.
142
159
  options = query_string.select { |k, _v| query_string.delete(k) || true if options_key.include? k }
@@ -150,7 +167,7 @@ module BlizzardApi
150
167
  uri = uri.include?('?') ? "#{uri}&#{query_string}" : "#{uri}?#{query_string}"
151
168
  end
152
169
 
153
- request uri, options
170
+ request uri, **options
154
171
  end
155
172
 
156
173
  private
@@ -163,7 +180,7 @@ module BlizzardApi
163
180
  !options.fetch(:ignore_cache, false)
164
181
  end
165
182
 
166
- def consume_api(url, options = {})
183
+ def consume_api(url, **options)
167
184
  # Creates a HTTP connection and request to ensure thread safety
168
185
  http = Net::HTTP.new(url.host, url.port)
169
186
  http.use_ssl = true
@@ -174,7 +191,7 @@ module BlizzardApi
174
191
  # Executes the request
175
192
  http.request(request).tap do |response|
176
193
  if mode.eql?(:regular) && ![200, 304].include?(response.code.to_i)
177
- raise BlizzardApi::ApiException.new 'Request failed', response.code.to_i
194
+ raise BlizzardApi::ApiException.new "Request failed with code '#{response.code}' details: #{response.to_hash}", response.code.to_i
178
195
  end
179
196
  end
180
197
  end
@@ -41,11 +41,11 @@ module BlizzardApi
41
41
  def self.account(region = BlizzardApi.region)
42
42
  BlizzardApi::Starcraft::Account.new(region)
43
43
  end
44
-
44
+
45
45
  ##
46
46
  # @return {Legacy}
47
- def self.legacy
48
- BlizzardApi::Starcraft::Legacy.new
47
+ def self.legacy(region = BlizzardApi.region)
48
+ BlizzardApi::Starcraft::Legacy.new(region)
49
49
  end
50
50
  end
51
51
  end
@@ -15,7 +15,7 @@ module BlizzardApi
15
15
  #
16
16
  # @param [Integer] account_id Account ID
17
17
  # @!macro request_options
18
- def player(account_id, options = {})
18
+ def player(account_id, **options)
19
19
  api_request "#{base_url(:community)}/player/#{account_id}", { ttl: CACHE_DAY }.merge(options)
20
20
  end
21
21
  end
@@ -15,9 +15,9 @@ module BlizzardApi
15
15
  #
16
16
  # @!macro sc2_regions
17
17
  # @!macro request_options
18
- def grandmaster(region_id, options = {})
18
+ def grandmaster(region_id, **options)
19
19
  reg = resolve_region(region_id)
20
- api_request "#{base_url(:community)}/ladder/grandmaster/#{reg}", { ttl: CACHE_DAY }.merge(options)
20
+ api_request "#{base_url(:community)}/ladder/grandmaster/#{reg}", **{ ttl: CACHE_DAY }.merge(options)
21
21
  end
22
22
 
23
23
  ##
@@ -25,9 +25,9 @@ module BlizzardApi
25
25
  #
26
26
  # @!macro sc2_regions
27
27
  # @!macro request_options
28
- def season(region_id, options = {})
28
+ def season(region_id, **options)
29
29
  reg = resolve_region(region_id)
30
- api_request "#{base_url(:community)}/ladder/season/#{reg}", { ttl: CACHE_DAY }.merge(options)
30
+ api_request "#{base_url(:community)}/ladder/season/#{reg}", **{ ttl: CACHE_DAY }.merge(options)
31
31
  end
32
32
  end
33
33
  end
@@ -10,7 +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::Starcraft.legacy
12
12
  class Legacy < Starcraft::Request
13
-
14
13
  ##
15
14
  # Profile data
16
15
  #
@@ -18,7 +17,7 @@ module BlizzardApi
18
17
  # @param [Integer] realm_id Realm ID
19
18
  # @param [Integer] profile_id Profile ID
20
19
  # @!macro request_options
21
- def profile(region_id, realm_id, profile_id, options = {})
20
+ def profile(region_id, realm_id, profile_id, **options)
22
21
  reg = resolve_region(region_id)
23
22
  opts = { ttl: CACHE_DAY }.merge(options)
24
23
  api_request "#{base_url(:community)}/legacy/profile/#{reg}/#{realm_id}/#{profile_id}", opts
@@ -31,7 +30,7 @@ module BlizzardApi
31
30
  # @param [Integer] realm_id Realm ID
32
31
  # @param [Integer] profile_id Profile ID
33
32
  # @!macro request_options
34
- def ladders(region_id, realm_id, profile_id, options = {})
33
+ def ladders(region_id, realm_id, profile_id, **options)
35
34
  reg = resolve_region(region_id)
36
35
  opts = { ttl: CACHE_DAY }.merge(options)
37
36
  api_request "#{base_url(:community)}/legacy/profile/#{reg}/#{realm_id}/#{profile_id}/ladder ", opts
@@ -44,41 +43,41 @@ module BlizzardApi
44
43
  # @param [Integer] realm_id Realm ID
45
44
  # @param [Integer] profile_id Profile ID
46
45
  # @!macro request_options
47
- def match(region_id, realm_id, profile_id, options = {})
46
+ def match(region_id, realm_id, profile_id, **options)
48
47
  reg = resolve_region(region_id)
49
48
  opts = { ttl: CACHE_DAY }.merge(options)
50
49
  api_request "#{base_url(:community)}/legacy/profile/#{reg}/#{realm_id}/#{profile_id}/matches", opts
51
50
  end
52
-
51
+
53
52
  ##
54
53
  # Ladder
55
54
  #
56
55
  # @!macro sc2_regions
57
56
  # @param [Integer] ladder_id Ladder ID
58
57
  # @!macro request_options
59
- def ladder(region_id, ladder_id, options = {})
58
+ def ladder(region_id, ladder_id, **options)
60
59
  reg = resolve_region(region_id)
61
60
  opts = { ttl: CACHE_DAY }.merge(options)
62
61
  api_request "#{base_url(:community)}/legacy/ladder/#{reg}/#{ladder_id}", opts
63
62
  end
64
-
63
+
65
64
  ##
66
65
  # Achievement data
67
66
  #
68
67
  # @!macro sc2_regions
69
68
  # @!macro request_options
70
- def achievements(region_id, options = {})
69
+ def achievements(region_id, **options)
71
70
  reg = resolve_region(region_id)
72
71
  opts = { ttl: CACHE_DAY }.merge(options)
73
72
  api_request "#{base_url(:community)}/legacy/data/achievements/#{reg}", opts
74
73
  end
75
-
74
+
76
75
  ##
77
76
  # Rewards data
78
77
  #
79
78
  # @!macro sc2_regions
80
79
  # @!macro request_options
81
- def rewards(region_id, options = {})
80
+ def rewards(region_id, **options)
82
81
  reg = resolve_region(region_id)
83
82
  opts = { ttl: CACHE_DAY }.merge(options)
84
83
  api_request "#{base_url(:community)}/legacy/data/rewards/#{reg}", opts