blizzard_api 0.4.1 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +21 -0
- data/.rubocop.yml +2 -1
- data/CHANGELOG.md +61 -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 +44 -37
- 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/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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 360667c9c66306b2c7557365d3d412b92eb9d64110526f34ebcfe77f47afff9b
|
4
|
+
data.tar.gz: eb1d4b42631e6fa56b11727ea2a437b77a6e89400b7848c65f5f197fda206c77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a85c0a3953367f8ce5ea531c82f67f78a67799ebcf5450196a6bc32ae9e7ccb23a75dd6b77c8721b5b9048c6c1046db1fea5f510e2fc01739c32960ce4dd49a
|
7
|
+
data.tar.gz: 8a6f610c43bf199170cf94f4075541213ed6ef90d80966790c5a5349e1362f24a176a780f4d49cb0720592268ad113a21e8275f1b6edb0c22960bab6425746a9
|
@@ -0,0 +1,21 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on: push
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
steps:
|
9
|
+
- uses: actions/checkout@v2
|
10
|
+
- name: Set up Ruby
|
11
|
+
uses: ruby/setup-ruby@21351ecc0a7c196081abca5dc55b08f085efe09a
|
12
|
+
with:
|
13
|
+
ruby-version: 2.6
|
14
|
+
- name: Install dependencies
|
15
|
+
run: bundle install
|
16
|
+
- name: Run tests
|
17
|
+
run: bundle exec rake
|
18
|
+
env:
|
19
|
+
BNET_APPLICATION_ID: ${{ secrets.BNET_APPLICATION_ID }}
|
20
|
+
BNET_APPLICATION_SECRET: ${{ secrets.BNET_APPLICATION_SECRET }}
|
21
|
+
USE_CACHE: false
|
data/.rubocop.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
inherit_from: .rubocop_todo.yml
|
2
2
|
|
3
|
-
|
3
|
+
Layout/LineLength:
|
4
4
|
Max: 140
|
5
5
|
|
6
6
|
Metrics/ModuleLength:
|
@@ -12,6 +12,7 @@ Metrics/AbcSize:
|
|
12
12
|
|
13
13
|
AllCops:
|
14
14
|
TargetRubyVersion: 2.5
|
15
|
+
NewCops: enable
|
15
16
|
Exclude:
|
16
17
|
- 'vendor/**/*'
|
17
18
|
- 'bin/**/*'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,66 @@
|
|
1
1
|
Please view this file on the master branch, otherwise it may be outdated
|
2
2
|
|
3
|
+
**Version 0.5.3**
|
4
|
+
|
5
|
+
Added missing legacy SC2 endpoints
|
6
|
+
|
7
|
+
See https://github.com/francis-schiavo/blizzard_api/pull/2
|
8
|
+
|
9
|
+
**Version 0.5.2**
|
10
|
+
|
11
|
+
Added new endpoints: https://us.forums.blizzard.com/en/blizzard/t/wow-shadowlands-api-update-covenenats-soulbinds-more/13385
|
12
|
+
|
13
|
+
**Version 0.5.1**
|
14
|
+
|
15
|
+
Added new endpoints: https://us.forums.blizzard.com/en/blizzard/t/wow-game-data-api-modified-crafting-support/12727
|
16
|
+
|
17
|
+
**Version 0.5.0**
|
18
|
+
|
19
|
+
This version brings a lot of internal changes to the way the gem works. While
|
20
|
+
there no breaking change is expected use it carefully.
|
21
|
+
|
22
|
+
## New features:
|
23
|
+
|
24
|
+
### Extended mode
|
25
|
+
|
26
|
+
When creating a request you can now specify **mode** as the last argument. Available modes:
|
27
|
+
* **regular**: No changes, should work as it always did.
|
28
|
+
* **extended**: All requests now return an array with two objects, the actual HTTPResponse object and the usual Hash.
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
api_client = BlizzardApi::Wow::Item.new 'us', :extended
|
32
|
+
response, item_data = api_client.get 35_000
|
33
|
+
|
34
|
+
puts response.code # 200
|
35
|
+
puts item_data[:name][:en_US] # Brutal Gladiator's Dragonhide Legguards
|
36
|
+
```
|
37
|
+
|
38
|
+
This is intended to expose the response code and headers.
|
39
|
+
|
40
|
+
**Important**: Extended mode completely disables the cache.
|
41
|
+
|
42
|
+
### Custom headers
|
43
|
+
|
44
|
+
You an now pass custom headers in the **options** hash.
|
45
|
+
|
46
|
+
There is also a new shorthand for the `If-Modified-Since` header.
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
# If-Modified-Since shorhand
|
50
|
+
auction_data = BlizzardApi::Wow.auction.get 1146, since: DateTime.parse('2099-01-01Z')
|
51
|
+
|
52
|
+
# Using custom headers
|
53
|
+
auction_data = BlizzardApi::Wow.auction.get 1146, headers: { 'If-Modified-Since' => 'Sun, 27 Sep 2020 02:17:03 GMT' }
|
54
|
+
```
|
55
|
+
|
56
|
+
**Important**
|
57
|
+
* Headers are not part of the cache key, use the option `ignore_cache: true` when needed.
|
58
|
+
* The `since` shorthand will always disable the cache.
|
59
|
+
|
60
|
+
**Version 0.4.2**
|
61
|
+
|
62
|
+
Added new retail and classic search endpoints described here: https://us.forums.blizzard.com/en/blizzard/t/world-of-warcraft-api-patch-notes-20200708/10310
|
63
|
+
|
3
64
|
**Version 0.4.1**
|
4
65
|
|
5
66
|
Added new retail and classic endpoints described here: https://us.forums.blizzard.com/en/blizzard/t/world-of-warcraft-api-patch-notes-20200609/8902
|
data/Gemfile.lock
CHANGED
@@ -1,31 +1,36 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
blizzard_api (0.
|
4
|
+
blizzard_api (0.5.3)
|
5
5
|
redis (~> 4.1, >= 4.1.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
ast (2.4.
|
11
|
-
dotenv (2.7.
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
ast (~> 2.4.0)
|
10
|
+
ast (2.4.1)
|
11
|
+
dotenv (2.7.6)
|
12
|
+
minitest (5.14.2)
|
13
|
+
parallel (1.20.1)
|
14
|
+
parser (2.7.2.0)
|
15
|
+
ast (~> 2.4.1)
|
17
16
|
rainbow (3.0.0)
|
18
17
|
rake (13.0.1)
|
19
|
-
redis (4.
|
20
|
-
|
21
|
-
|
18
|
+
redis (4.2.5)
|
19
|
+
regexp_parser (2.0.0)
|
20
|
+
rexml (3.2.4)
|
21
|
+
rubocop (0.93.1)
|
22
22
|
parallel (~> 1.10)
|
23
|
-
parser (>= 2.
|
23
|
+
parser (>= 2.7.1.5)
|
24
24
|
rainbow (>= 2.2.2, < 4.0)
|
25
|
+
regexp_parser (>= 1.8)
|
26
|
+
rexml
|
27
|
+
rubocop-ast (>= 0.6.0)
|
25
28
|
ruby-progressbar (~> 1.7)
|
26
|
-
unicode-display_width (>= 1.4.0, <
|
29
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
30
|
+
rubocop-ast (1.3.0)
|
31
|
+
parser (>= 2.7.1.5)
|
27
32
|
ruby-progressbar (1.10.1)
|
28
|
-
unicode-display_width (1.
|
33
|
+
unicode-display_width (1.7.0)
|
29
34
|
yard (0.9.25)
|
30
35
|
|
31
36
|
PLATFORMS
|
data/README.md
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
# Blizzard Api
|
2
2
|
|
3
|
-
[![pipeline status](https://gitlab.com/francisschiavo/blizzard_api/badges/master/pipeline.svg)](https://gitlab.com/francisschiavo/blizzard_api/commits/master)
|
4
3
|
[![Gem Version](https://badge.fury.io/rb/blizzard_api.svg)](https://badge.fury.io/rb/blizzard_api)
|
5
4
|
|
6
|
-
|
7
5
|
This gem allow you to interface with the new blizzard api (2018) using the OAuth2 protocol for every request.
|
8
6
|
|
9
7
|
**Important**: This gem does not support, nor will support China endpoints.
|
@@ -145,6 +143,7 @@ end
|
|
145
143
|
- types
|
146
144
|
- type :id
|
147
145
|
- display_media :id
|
146
|
+
- search
|
148
147
|
* Blizzard::Wow::Guild
|
149
148
|
- rewards
|
150
149
|
- perks
|
@@ -211,6 +210,7 @@ end
|
|
211
210
|
- get :id
|
212
211
|
- complete
|
213
212
|
- status :realms
|
213
|
+
- search
|
214
214
|
* Blizzard::Wow::Region
|
215
215
|
- index
|
216
216
|
- get :id
|
@@ -231,10 +231,12 @@ end
|
|
231
231
|
- class :id
|
232
232
|
- subclass :class_id, :subclass_id
|
233
233
|
- media :id
|
234
|
+
- search
|
234
235
|
* Blizzard::Wow::AzeriteEssence
|
235
236
|
- index
|
236
237
|
- get :id
|
237
238
|
- media :id
|
239
|
+
- search
|
238
240
|
* Blizzard::Wow::ReputationTier
|
239
241
|
- index
|
240
242
|
- get :id
|
@@ -262,6 +264,7 @@ end
|
|
262
264
|
- get :id
|
263
265
|
* Blizzard::Wow::Spell
|
264
266
|
- get :id
|
267
|
+
- search
|
265
268
|
* Blizzard::Wow::Zone
|
266
269
|
- index
|
267
270
|
- get :id
|
@@ -346,7 +349,7 @@ Every endpoint requiring a *region_id* parameter will accepts either the integer
|
|
346
349
|
|
347
350
|
## Contributing
|
348
351
|
|
349
|
-
Bug reports and pull requests are welcome on
|
352
|
+
Bug reports and pull requests are welcome on Github at https://github.com/francis-schiavo/blizzard_api/issues
|
350
353
|
|
351
354
|
## License
|
352
355
|
|
data/blizzard_api.gemspec
CHANGED
@@ -9,10 +9,10 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.name = 'blizzard_api'
|
10
10
|
spec.version = BlizzardApi::VERSION
|
11
11
|
spec.authors = ['Francis Schiavo']
|
12
|
-
spec.email = ['francis
|
12
|
+
spec.email = ['francis@schiavo.dev']
|
13
13
|
spec.summary = 'Unofficial Ruby client for Blizzard Entertainment API'
|
14
14
|
spec.description = 'This is a simple interface to obtain data from Blizzard API'
|
15
|
-
spec.homepage = 'https://
|
15
|
+
spec.homepage = 'https://github.com/francis-schiavo/blizzard_api'
|
16
16
|
spec.license = 'MIT'
|
17
17
|
|
18
18
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
@@ -20,8 +20,10 @@ Gem::Specification.new do |spec|
|
|
20
20
|
raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.' unless spec.respond_to?(:metadata)
|
21
21
|
|
22
22
|
spec.metadata['homepage_uri'] = spec.homepage
|
23
|
-
spec.metadata['source_code_uri'] = 'https://
|
24
|
-
spec.metadata['
|
23
|
+
spec.metadata['source_code_uri'] = 'https://github.com/francis-schiavo/blizzard_api'
|
24
|
+
spec.metadata['bug_tracker_uri'] = 'https://github.com/francis-schiavo/blizzard_api/issues'
|
25
|
+
spec.metadata['changelog_uri'] = 'https://github.com/francis-schiavo/blizzard_api/blob/master/CHANGELOG.md'
|
26
|
+
spec.metadata['documentation_uri'] = 'https://rubydoc.info/gems/blizzard_api'
|
25
27
|
|
26
28
|
# Specify which files should be added to the gem when it is released.
|
27
29
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -4,8 +4,8 @@ module BlizzardApi
|
|
4
4
|
module Diablo
|
5
5
|
# Generic endpoint to support most data requests with minor configurations
|
6
6
|
class GenericDataEndpoint < Diablo::Request
|
7
|
-
def initialize(region = nil)
|
8
|
-
super region
|
7
|
+
def initialize(region = nil, mode = :regular)
|
8
|
+
super region, mode
|
9
9
|
endpoint_setup
|
10
10
|
@ttl ||= CACHE_DAY
|
11
11
|
end
|
@@ -4,8 +4,8 @@ module BlizzardApi
|
|
4
4
|
module Hearthstone
|
5
5
|
# Generic endpoint to support most data requests with minor configurations
|
6
6
|
class GenericDataEndpoint < Hearthstone::Request
|
7
|
-
def initialize(region = nil)
|
8
|
-
super region
|
7
|
+
def initialize(region = nil, mode = :regular)
|
8
|
+
super region, mode
|
9
9
|
endpoint_setup
|
10
10
|
@ttl ||= CACHE_DAY
|
11
11
|
end
|
data/lib/blizzard_api/request.rb
CHANGED
@@ -8,6 +8,7 @@
|
|
8
8
|
# @option options [String] :access_token Overrides the access_token for a single call
|
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
|
+
# @option options [DateTime] :since Adds the If-modified-since headers. Will always ignore cache when set.
|
11
12
|
|
12
13
|
##
|
13
14
|
# @!macro [new] regions
|
@@ -16,7 +17,7 @@
|
|
16
17
|
|
17
18
|
##
|
18
19
|
# @!macro [new] response
|
19
|
-
# @return [
|
20
|
+
# @return [Hash] API Response. The actual type of the returned object depends on the *format* option
|
20
21
|
# in the configuration module
|
21
22
|
|
22
23
|
##
|
@@ -31,18 +32,12 @@ module BlizzardApi
|
|
31
32
|
##
|
32
33
|
# Simplifies the requests to Blizzard APIS
|
33
34
|
class Request
|
34
|
-
# One minute cache
|
35
|
-
CACHE_MINUTE = 60
|
36
35
|
# One hour cache
|
37
|
-
CACHE_HOUR =
|
36
|
+
CACHE_HOUR = 3600
|
38
37
|
# One day cache
|
39
38
|
CACHE_DAY = 24 * CACHE_HOUR
|
40
|
-
# One week cache
|
41
|
-
CACHE_WEEK = CACHE_DAY * 7
|
42
|
-
# One (commercial) month cache
|
43
|
-
CACHE_MONTH = CACHE_DAY * 30
|
44
39
|
# Three (commercial) months cache
|
45
|
-
CACHE_TRIMESTER =
|
40
|
+
CACHE_TRIMESTER = CACHE_DAY * 90
|
46
41
|
|
47
42
|
# Common endpoints
|
48
43
|
BASE_URLS = {
|
@@ -59,13 +54,20 @@ module BlizzardApi
|
|
59
54
|
# @return [String] Api region
|
60
55
|
attr_accessor :region
|
61
56
|
|
57
|
+
##
|
58
|
+
# @!attribute mode
|
59
|
+
# @return [:regular, :extended]
|
60
|
+
attr_accessor :mode
|
61
|
+
|
62
62
|
##
|
63
63
|
# @!macro regions
|
64
|
-
def initialize(region = nil)
|
64
|
+
def initialize(region = nil, mode = :regular)
|
65
65
|
self.region = region || BlizzardApi.region
|
66
66
|
@redis = Redis.new(host: BlizzardApi.redis_host, port: BlizzardApi.redis_port) if BlizzardApi.use_cache
|
67
67
|
# Use the shared access_token, or create one if it doesn't exists. This avoids unnecessary calls to create tokens.
|
68
68
|
@access_token = BlizzardApi.access_token || create_access_token
|
69
|
+
# Mode
|
70
|
+
@mode = mode
|
69
71
|
end
|
70
72
|
|
71
73
|
require 'net/http'
|
@@ -98,10 +100,6 @@ module BlizzardApi
|
|
98
100
|
end
|
99
101
|
end
|
100
102
|
|
101
|
-
def string_to_slug(string)
|
102
|
-
CGI.escape(string.downcase.tr(' ', '-'))
|
103
|
-
end
|
104
|
-
|
105
103
|
def create_access_token
|
106
104
|
uri = URI.parse("https://#{BlizzardApi.region}.battle.net/oauth/token")
|
107
105
|
|
@@ -121,26 +119,24 @@ module BlizzardApi
|
|
121
119
|
# Creates the whole url for request
|
122
120
|
parsed_url = URI.parse(url)
|
123
121
|
|
124
|
-
data = options
|
122
|
+
data = using_cache?(options) ? find_in_cache(parsed_url.to_s) : nil
|
123
|
+
|
125
124
|
# If data was found that means cache is enabled and valid
|
126
|
-
return
|
125
|
+
return JSON.parse(data, symbolize_names: true) if data
|
127
126
|
|
128
|
-
|
129
|
-
@access_token = options[:access_token] if options.include? :access_token
|
127
|
+
response = consume_api parsed_url, options
|
130
128
|
|
131
|
-
response
|
129
|
+
save_in_cache parsed_url.to_s, response.body, options[:ttl] || CACHE_DAY if using_cache? options
|
132
130
|
|
133
|
-
|
134
|
-
|
135
|
-
save_in_cache parsed_url.to_s, response.body, ttl
|
136
|
-
end
|
131
|
+
response_data = response.code.to_i.eql?(304) ? nil : JSON.parse(response.body, symbolize_names: true)
|
132
|
+
return [response, response_data] if mode.eql? :extended
|
137
133
|
|
138
|
-
|
134
|
+
response_data
|
139
135
|
end
|
140
136
|
|
141
137
|
def api_request(uri, query_string = {})
|
142
138
|
# List of request options
|
143
|
-
options_key = %i[ignore_cache ttl format access_token namespace classic]
|
139
|
+
options_key = %i[ignore_cache ttl format access_token namespace classic headers since]
|
144
140
|
|
145
141
|
# Separates request options from api fields and options. Any user-defined option will be treated as api field.
|
146
142
|
options = query_string.select { |k, _v| query_string.delete(k) || true if options_key.include? k }
|
@@ -159,35 +155,46 @@ module BlizzardApi
|
|
159
155
|
|
160
156
|
private
|
161
157
|
|
162
|
-
|
158
|
+
##
|
159
|
+
# @param options [Hash] Request options
|
160
|
+
def using_cache?(options)
|
161
|
+
return false if mode.eql?(:extended) || options.key?(:since)
|
162
|
+
|
163
|
+
!options.fetch(:ignore_cache, false)
|
164
|
+
end
|
165
|
+
|
166
|
+
def consume_api(url, options = {})
|
163
167
|
# Creates a HTTP connection and request to ensure thread safety
|
164
168
|
http = Net::HTTP.new(url.host, url.port)
|
165
169
|
http.use_ssl = true
|
166
170
|
request = Net::HTTP::Get.new(url)
|
167
171
|
|
168
|
-
|
169
|
-
request['Authorization'] = "Bearer #{@access_token}"
|
172
|
+
add_headers request, options
|
170
173
|
|
171
174
|
# Executes the request
|
172
175
|
http.request(request).tap do |response|
|
173
|
-
|
176
|
+
if mode.eql?(:regular) && ![200, 304].include?(response.code.to_i)
|
177
|
+
raise BlizzardApi::ApiException.new 'Request failed', response.code.to_i
|
178
|
+
end
|
174
179
|
end
|
175
180
|
end
|
176
181
|
|
177
|
-
def
|
178
|
-
|
182
|
+
def add_headers(request, options)
|
183
|
+
# Blizzard API documentation states the preferred way to send the access_token is using Bearer token on header
|
184
|
+
request['Authorization'] = "Bearer #{options.fetch(:access_token, @access_token)}"
|
185
|
+
# Format If-modified-since option
|
186
|
+
request['If-Modified-Since'] = options[:since].httpdate if options.key? :since
|
187
|
+
options[:headers]&.each { |header, content| request[header] = content }
|
188
|
+
end
|
179
189
|
|
180
|
-
|
190
|
+
def save_in_cache(resource_url, data, ttl)
|
191
|
+
@redis.setex resource_url, ttl, data if BlizzardApi.use_cache
|
181
192
|
end
|
182
193
|
|
183
194
|
def find_in_cache(resource_url)
|
184
195
|
return false unless BlizzardApi.use_cache
|
185
196
|
|
186
|
-
@redis.get resource_url if @redis.exists resource_url
|
187
|
-
end
|
188
|
-
|
189
|
-
def format_response(data)
|
190
|
-
JSON.parse(data, symbolize_names: true)
|
197
|
+
@redis.get resource_url if @redis.exists? resource_url
|
191
198
|
end
|
192
199
|
end
|
193
200
|
end
|
@@ -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(region = BlizzardApi.region)
|
48
|
+
BlizzardApi::Starcraft::Legacy.new(region)
|
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
|
@@ -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,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
|
#
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Wow
|
5
|
+
##
|
6
|
+
# This class allows access to World of Warcraft talent data
|
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.talent
|
12
|
+
class TechTalent < Wow::GenericDataEndpoint
|
13
|
+
##
|
14
|
+
# Fetch tech talent trees
|
15
|
+
#
|
16
|
+
# @!macro request_options
|
17
|
+
#
|
18
|
+
# @!macro response
|
19
|
+
def tech_talent_trees(options = {})
|
20
|
+
api_request "#{base_url(:game_data)}/tech-talent-tree/index", default_options.merge(options)
|
21
|
+
end
|
22
|
+
|
23
|
+
##
|
24
|
+
# Fetch a tech talent tree
|
25
|
+
#
|
26
|
+
# @param id [Integer] Tech talent id
|
27
|
+
#
|
28
|
+
# @!macro request_options
|
29
|
+
#
|
30
|
+
# @!macro response
|
31
|
+
def tech_talent_tree(id, options = {})
|
32
|
+
api_request "#{base_url(:game_data)}/tech-talent-tree/#{id}", default_options.merge(options)
|
33
|
+
end
|
34
|
+
|
35
|
+
##
|
36
|
+
# Fetch a tech talent media
|
37
|
+
#
|
38
|
+
# @param id [Integer] Tech talent id
|
39
|
+
#
|
40
|
+
# @!macro request_options
|
41
|
+
#
|
42
|
+
# @!macro response
|
43
|
+
def media(id, options = {})
|
44
|
+
api_request "#{base_url(:media)}/tech-talent/#{id}", default_options.merge(options)
|
45
|
+
end
|
46
|
+
|
47
|
+
protected
|
48
|
+
|
49
|
+
def endpoint_setup
|
50
|
+
@endpoint = 'tech-talent'
|
51
|
+
@namespace = :static
|
52
|
+
@collection = 'tech-talents'
|
53
|
+
@ttl = CACHE_TRIMESTER
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
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.achievement
|
12
12
|
class CharacterProfile < Wow::Request
|
13
|
+
include BlizzardApi::Wow::Slug
|
14
|
+
|
13
15
|
##
|
14
16
|
# Return character achievements
|
15
17
|
#
|
@@ -287,9 +289,11 @@ module BlizzardApi
|
|
287
289
|
# @param realm [String] The character realm's slug
|
288
290
|
# @param character [String] The character name
|
289
291
|
# @!macro request_options
|
292
|
+
# @option options [Boolean] :completed Should return completed quests
|
290
293
|
#
|
291
294
|
# @!macro response
|
292
|
-
def quests(realm, character,
|
295
|
+
def quests(realm, character, options = {})
|
296
|
+
completed = options.delete(:completed) || false
|
293
297
|
return character_request realm, character, options, 'quests/completed' if completed
|
294
298
|
|
295
299
|
character_request realm, character, options, 'quests'
|
@@ -309,6 +313,20 @@ module BlizzardApi
|
|
309
313
|
character_request realm, character, options, 'reputations'
|
310
314
|
end
|
311
315
|
|
316
|
+
##
|
317
|
+
# Return a character's soulbinds
|
318
|
+
#
|
319
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
|
320
|
+
#
|
321
|
+
# @param realm [String] The character realm's slug
|
322
|
+
# @param character [String] The character name
|
323
|
+
# @!macro request_options
|
324
|
+
#
|
325
|
+
# @!macro response
|
326
|
+
def soulbinds(realm, character, options = {})
|
327
|
+
character_request realm, character, options, 'soulbinds'
|
328
|
+
end
|
329
|
+
|
312
330
|
##
|
313
331
|
# Return a character's specialization
|
314
332
|
#
|
@@ -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.guild
|
12
12
|
class Guild < Wow::Request
|
13
|
+
include BlizzardApi::Wow::Slug
|
14
|
+
|
13
15
|
##
|
14
16
|
# Return data about the specified guild
|
15
17
|
#
|
@@ -7,8 +7,8 @@ module BlizzardApi
|
|
7
7
|
class AccountProfile < Request
|
8
8
|
##
|
9
9
|
# @param token [String] A token obtained using the authorization_code flow
|
10
|
-
def initialize(token, region = nil)
|
11
|
-
super region
|
10
|
+
def initialize(token, region = nil, mode = :regular)
|
11
|
+
super region, mode
|
12
12
|
@token = token
|
13
13
|
end
|
14
14
|
|
@@ -20,7 +20,7 @@ module BlizzardApi
|
|
20
20
|
# The second argument takes a simple value, an array of values or a hash for range searches.
|
21
21
|
#
|
22
22
|
# @param field [String] Field name
|
23
|
-
# @param value [String|Integer|Hash|Array<Integer
|
23
|
+
# @param value [String|Integer|Hash|Array<Integer>|Array<String>]
|
24
24
|
# @option value [Integer] :min Range start
|
25
25
|
# @option value [Integer] :max Range end
|
26
26
|
# @option value [Integer] :mode Range mode (:inclusive|:exclusive)
|
@@ -37,7 +37,7 @@ module BlizzardApi
|
|
37
37
|
# The second argument takes a simple value, an array of values or a hash for range searches.
|
38
38
|
#
|
39
39
|
# @param field [String] Field name
|
40
|
-
# @param value [String|Integer|Hash|Array<Integer
|
40
|
+
# @param value [String|Integer|Hash|Array<Integer>|Array<String>]
|
41
41
|
# @option value [Integer] :min Range start
|
42
42
|
# @option value [Integer] :max Range end
|
43
43
|
# @option value [Integer] :mode Range mode (:inclusive|:exclusive)
|
@@ -68,7 +68,7 @@ module BlizzardApi
|
|
68
68
|
# @return {String}
|
69
69
|
def to_search_query
|
70
70
|
query_string = "_page=#{page}&_pageSize=#{page_size}"
|
71
|
-
query_string +=
|
71
|
+
query_string += "&#{fields.join('&')}" unless fields.size.zero?
|
72
72
|
query_string += "&orderby=#{order.join(',')}" unless order.size.zero?
|
73
73
|
query_string
|
74
74
|
end
|
@@ -6,7 +6,7 @@ module BlizzardApi
|
|
6
6
|
# Added search support to an endpoint
|
7
7
|
module Searchable
|
8
8
|
##
|
9
|
-
# Fetch data
|
9
|
+
# Fetch data based on search criteria
|
10
10
|
#
|
11
11
|
# @param page [Integer] Page o return
|
12
12
|
# @param page_size [Integer] Amount of items per page
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blizzard_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francis Schiavo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -102,13 +102,13 @@ dependencies:
|
|
102
102
|
version: '0'
|
103
103
|
description: This is a simple interface to obtain data from Blizzard API
|
104
104
|
email:
|
105
|
-
- francis
|
105
|
+
- francis@schiavo.dev
|
106
106
|
executables: []
|
107
107
|
extensions: []
|
108
108
|
extra_rdoc_files: []
|
109
109
|
files:
|
110
|
+
- ".github/workflows/ruby.yml"
|
110
111
|
- ".gitignore"
|
111
|
-
- ".gitlab-ci.yml"
|
112
112
|
- ".rubocop.yml"
|
113
113
|
- ".rubocop_todo.yml"
|
114
114
|
- CHANGELOG.md
|
@@ -146,6 +146,7 @@ files:
|
|
146
146
|
- lib/blizzard_api/starcraft.rb
|
147
147
|
- lib/blizzard_api/starcraft/community/account.rb
|
148
148
|
- lib/blizzard_api/starcraft/community/ladder.rb
|
149
|
+
- lib/blizzard_api/starcraft/community/legacy.rb
|
149
150
|
- lib/blizzard_api/starcraft/community/profile.rb
|
150
151
|
- lib/blizzard_api/starcraft/game_data/league.rb
|
151
152
|
- lib/blizzard_api/starcraft/request.rb
|
@@ -155,11 +156,14 @@ files:
|
|
155
156
|
- lib/blizzard_api/wow/game_data/auction.rb
|
156
157
|
- lib/blizzard_api/wow/game_data/azerite_essence.rb
|
157
158
|
- lib/blizzard_api/wow/game_data/connected_realm.rb
|
159
|
+
- lib/blizzard_api/wow/game_data/covenant.rb
|
158
160
|
- lib/blizzard_api/wow/game_data/creature.rb
|
159
161
|
- lib/blizzard_api/wow/game_data/generic_data_endpoint.rb
|
160
162
|
- lib/blizzard_api/wow/game_data/guild_crest.rb
|
161
163
|
- lib/blizzard_api/wow/game_data/item.rb
|
162
164
|
- lib/blizzard_api/wow/game_data/journal.rb
|
165
|
+
- lib/blizzard_api/wow/game_data/media.rb
|
166
|
+
- lib/blizzard_api/wow/game_data/modified_crafting.rb
|
163
167
|
- lib/blizzard_api/wow/game_data/mount.rb
|
164
168
|
- lib/blizzard_api/wow/game_data/mythic_keystone.rb
|
165
169
|
- lib/blizzard_api/wow/game_data/mythic_keystone_affix.rb
|
@@ -179,6 +183,7 @@ files:
|
|
179
183
|
- lib/blizzard_api/wow/game_data/reputation.rb
|
180
184
|
- lib/blizzard_api/wow/game_data/spell.rb
|
181
185
|
- lib/blizzard_api/wow/game_data/talent.rb
|
186
|
+
- lib/blizzard_api/wow/game_data/tech_talent.rb
|
182
187
|
- lib/blizzard_api/wow/game_data/title.rb
|
183
188
|
- lib/blizzard_api/wow/game_data/wow_token.rb
|
184
189
|
- lib/blizzard_api/wow/profile/character_profile.rb
|
@@ -187,13 +192,16 @@ files:
|
|
187
192
|
- lib/blizzard_api/wow/request.rb
|
188
193
|
- lib/blizzard_api/wow/search/search_composer.rb
|
189
194
|
- lib/blizzard_api/wow/search/search_request.rb
|
190
|
-
|
195
|
+
- lib/blizzard_api/wow/slug.rb
|
196
|
+
homepage: https://github.com/francis-schiavo/blizzard_api
|
191
197
|
licenses:
|
192
198
|
- MIT
|
193
199
|
metadata:
|
194
|
-
homepage_uri: https://
|
195
|
-
source_code_uri: https://
|
196
|
-
|
200
|
+
homepage_uri: https://github.com/francis-schiavo/blizzard_api
|
201
|
+
source_code_uri: https://github.com/francis-schiavo/blizzard_api
|
202
|
+
bug_tracker_uri: https://github.com/francis-schiavo/blizzard_api/issues
|
203
|
+
changelog_uri: https://github.com/francis-schiavo/blizzard_api/blob/master/CHANGELOG.md
|
204
|
+
documentation_uri: https://rubydoc.info/gems/blizzard_api
|
197
205
|
post_install_message:
|
198
206
|
rdoc_options: []
|
199
207
|
require_paths:
|