blizzard_api 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/lib/blizzard_api/configuration.rb +1 -1
- data/lib/blizzard_api/request.rb +20 -4
- data/lib/blizzard_api/starcraft.rb +1 -1
- data/lib/blizzard_api/starcraft/community/legacy.rb +3 -4
- data/lib/blizzard_api/version.rb +1 -1
- data/lib/blizzard_api/wow/game_data/auction.rb +19 -1
- data/lib/blizzard_api/wow/game_data/creature.rb +7 -1
- data/lib/blizzard_api/wow/game_data/guild_crest.rb +2 -0
- data/lib/blizzard_api/wow/game_data/item.rb +4 -0
- data/lib/blizzard_api/wow/game_data/journal.rb +1 -1
- data/lib/blizzard_api/wow/game_data/playable_class.rb +2 -0
- data/lib/blizzard_api/wow/game_data/pvp_season.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 685ed4874fe22bf7c07093ae2865d2776763649d55db19bc358c94da9147486b
|
4
|
+
data.tar.gz: f499dbaa688ed302d84f06e91a586b7ee117c224703b5cdff1b65f893c8ddc00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e29618d647f7c1f5ed875600cc95cb458ba54e9714d9e06cf0119d3ce530e26d5de6b9874b57a80af09a6cc01fba8a9f1e2b30c44570c53a784c01caa07bdb8
|
7
|
+
data.tar.gz: d7b5f790f4027e267fb701786ccfc130d33cddbc1a2da62606ad863d6b5773bb88c02a3c0c066f3555d9fd2b88230fe5ff1825bb0bee82365946842f7bfc95d7
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -50,7 +50,7 @@ module BlizzardApi
|
|
50
50
|
# How many threads to use for WoW game data `complete` payloads. Defaults to 4.
|
51
51
|
# Should be set to the amount of available cores on the system.
|
52
52
|
# @return [Integer] Concurrency
|
53
|
-
|
53
|
+
attr_writer :concurrency
|
54
54
|
|
55
55
|
##
|
56
56
|
# @!attribute access_token
|
data/lib/blizzard_api/request.rb
CHANGED
@@ -9,7 +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.
|
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.
|
13
14
|
|
14
15
|
##
|
15
16
|
# @!macro [new] regions
|
@@ -84,16 +85,31 @@ module BlizzardApi
|
|
84
85
|
format BASE_URLS[scope], region, @game
|
85
86
|
end
|
86
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
|
+
|
87
102
|
##
|
88
103
|
# Returns a valid namespace string for consuming the api endpoints
|
89
104
|
#
|
90
105
|
# @param [Hash] options A hash containing the namespace key
|
91
106
|
def endpoint_namespace(options)
|
107
|
+
version = endpoint_version(options)
|
92
108
|
case options[:namespace]
|
93
109
|
when :dynamic
|
94
|
-
|
110
|
+
"dynamic-#{version}#{region}"
|
95
111
|
when :static
|
96
|
-
|
112
|
+
"static-#{version}#{region}"
|
97
113
|
when :profile
|
98
114
|
"profile-#{region}"
|
99
115
|
else
|
@@ -137,7 +153,7 @@ module BlizzardApi
|
|
137
153
|
|
138
154
|
def api_request(uri, **query_string)
|
139
155
|
# List of request options
|
140
|
-
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]
|
141
157
|
|
142
158
|
# Separates request options from api fields and options. Any user-defined option will be treated as api field.
|
143
159
|
options = query_string.select { |k, _v| query_string.delete(k) || true if options_key.include? k }
|
@@ -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
|
#
|
@@ -49,7 +48,7 @@ module BlizzardApi
|
|
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
|
#
|
@@ -61,7 +60,7 @@ module BlizzardApi
|
|
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
|
#
|
@@ -72,7 +71,7 @@ module BlizzardApi
|
|
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
|
#
|
data/lib/blizzard_api/version.rb
CHANGED
@@ -10,15 +10,33 @@ module BlizzardApi
|
|
10
10
|
# You can get an instance of this class using the default region as follows:
|
11
11
|
# api_instance = BlizzardApi::Wow.auction
|
12
12
|
class Auction < Wow::Request
|
13
|
+
##
|
14
|
+
# Return all auction houses for the specified connected realm. Classic only.
|
15
|
+
#
|
16
|
+
# @param connected_realm_id [Integer] A valid connected realm id
|
17
|
+
# @!macro request_options
|
18
|
+
#
|
19
|
+
# @!macro response
|
20
|
+
def index(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/index", **opts
|
23
|
+
end
|
24
|
+
|
13
25
|
##
|
14
26
|
# Return all active auctions for the specified connected realm
|
15
27
|
#
|
16
28
|
# @param connected_realm_id [Integer] A valid connected realm id
|
17
29
|
# @!macro request_options
|
30
|
+
# @option options [Boolean] :classic1x If set to true, this method will call the classic era version
|
18
31
|
#
|
19
32
|
# @!macro response
|
20
|
-
def get(connected_realm_id, **options)
|
33
|
+
def get(connected_realm_id, auction_house_id = nil, **options)
|
21
34
|
opts = { ttl: CACHE_HOUR, namespace: :dynamic }.merge(options)
|
35
|
+
|
36
|
+
unless auction_house_id.nil?
|
37
|
+
return api_request "#{base_url(:game_data)}/connected-realm/#{connected_realm_id}/auctions/#{auction_house_id}", **opts
|
38
|
+
end
|
39
|
+
|
22
40
|
api_request "#{base_url(:game_data)}/connected-realm/#{connected_realm_id}/auctions", **opts
|
23
41
|
end
|
24
42
|
end
|
@@ -13,7 +13,7 @@ module BlizzardApi
|
|
13
13
|
include BlizzardApi::Wow::Searchable
|
14
14
|
|
15
15
|
def index
|
16
|
-
raise BlizzardApi::ApiException, 'Creatures endpoint doesn\'t have
|
16
|
+
raise BlizzardApi::ApiException, 'Creatures endpoint doesn\'t have an index method'
|
17
17
|
end
|
18
18
|
|
19
19
|
def complete
|
@@ -25,6 +25,7 @@ module BlizzardApi
|
|
25
25
|
#
|
26
26
|
# @!macro request_options
|
27
27
|
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
28
|
+
# @option options [Boolean] :classic1x If set to true, this method will call the classic era version
|
28
29
|
#
|
29
30
|
# @!macro response
|
30
31
|
def families(**options)
|
@@ -38,6 +39,7 @@ module BlizzardApi
|
|
38
39
|
#
|
39
40
|
# @!macro request_options
|
40
41
|
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
42
|
+
# @option options [Boolean] :classic1x If set to true, this method will call the classic era version
|
41
43
|
#
|
42
44
|
# @!macro response
|
43
45
|
def family(id, **options)
|
@@ -51,6 +53,7 @@ module BlizzardApi
|
|
51
53
|
#
|
52
54
|
# @!macro request_options
|
53
55
|
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
56
|
+
# @option options [Boolean] :classic1x If set to true, this method will call the classic era version
|
54
57
|
#
|
55
58
|
# @!macro response
|
56
59
|
def family_media(id, **options)
|
@@ -62,6 +65,7 @@ module BlizzardApi
|
|
62
65
|
#
|
63
66
|
# @!macro request_options
|
64
67
|
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
68
|
+
# @option options [Boolean] :classic1x If set to true, this method will call the classic era version
|
65
69
|
#
|
66
70
|
# @!macro response
|
67
71
|
def types(**options)
|
@@ -75,6 +79,7 @@ module BlizzardApi
|
|
75
79
|
#
|
76
80
|
# @!macro request_options
|
77
81
|
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
82
|
+
# @option options [Boolean] :classic1x If set to true, this method will call the classic era version
|
78
83
|
#
|
79
84
|
# @!macro response
|
80
85
|
def type(id, **options)
|
@@ -88,6 +93,7 @@ module BlizzardApi
|
|
88
93
|
#
|
89
94
|
# @!macro request_options
|
90
95
|
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
96
|
+
# @option options [Boolean] :classic1x If set to true, this method will call the classic era version
|
91
97
|
#
|
92
98
|
# @!macro response
|
93
99
|
def display_media(id, **options)
|
@@ -21,6 +21,7 @@ module BlizzardApi
|
|
21
21
|
#
|
22
22
|
# @!macro request_options
|
23
23
|
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
24
|
+
# @option options [Boolean] :classic1x If set to true, this method will call the classic era version
|
24
25
|
#
|
25
26
|
# @!macro response
|
26
27
|
def border_media(id, **options)
|
@@ -32,6 +33,7 @@ module BlizzardApi
|
|
32
33
|
#
|
33
34
|
# @param id [Integer] Emblem id
|
34
35
|
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
36
|
+
# @option options [Boolean] :classic1x If set to true, this method will call the classic era version
|
35
37
|
#
|
36
38
|
# @!macro request_options
|
37
39
|
#
|
@@ -33,6 +33,7 @@ module BlizzardApi
|
|
33
33
|
#
|
34
34
|
# @!macro request_options
|
35
35
|
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
36
|
+
# @option options [Boolean] :classic1x If set to true, this method will call the classic era version
|
36
37
|
#
|
37
38
|
# @!macro response
|
38
39
|
def classes(**options)
|
@@ -45,6 +46,7 @@ module BlizzardApi
|
|
45
46
|
# @param id [Integer] Item class id
|
46
47
|
# @!macro request_options
|
47
48
|
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
49
|
+
# @option options [Boolean] :classic1x If set to true, this method will call the classic era version
|
48
50
|
#
|
49
51
|
# @!macro response
|
50
52
|
def class(id, **options)
|
@@ -58,6 +60,7 @@ module BlizzardApi
|
|
58
60
|
# @param subclass_id [Integer] Item subclass id
|
59
61
|
# @!macro request_options
|
60
62
|
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
63
|
+
# @option options [Boolean] :classic1x If set to true, this method will call the classic era version
|
61
64
|
#
|
62
65
|
# @!macro response
|
63
66
|
def subclass(id, subclass_id, **options)
|
@@ -71,6 +74,7 @@ module BlizzardApi
|
|
71
74
|
#
|
72
75
|
# @!macro request_options
|
73
76
|
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
77
|
+
# @option options [Boolean] :classic1x If set to true, this method will call the classic era version
|
74
78
|
#
|
75
79
|
# @!macro response
|
76
80
|
def media(id, **options)
|
@@ -30,7 +30,7 @@ module BlizzardApi
|
|
30
30
|
# This method overrides the inherited default behavior to prevent high server load and fetch time
|
31
31
|
#
|
32
32
|
# @!macro response
|
33
|
-
def get(_id
|
33
|
+
def get(_id)
|
34
34
|
raise BlizzardApi::ApiException, 'This endpoint does not have a get method'
|
35
35
|
end
|
36
36
|
|
@@ -25,6 +25,7 @@ module BlizzardApi
|
|
25
25
|
# @!macro complete
|
26
26
|
#
|
27
27
|
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
28
|
+
# @option options [Boolean] :classic1x If set to true, this method will call the classic era version
|
28
29
|
def complete(**options)
|
29
30
|
index_data = index(**options)
|
30
31
|
[].tap do |classes|
|
@@ -43,6 +44,7 @@ module BlizzardApi
|
|
43
44
|
#
|
44
45
|
# @!macro request_options
|
45
46
|
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
47
|
+
# @option options [Boolean] :classic1x If set to true, this method will call the classic era version
|
46
48
|
#
|
47
49
|
# @!macro response
|
48
50
|
def get(id, **options)
|
@@ -14,6 +14,7 @@ module BlizzardApi
|
|
14
14
|
# Returns a index of pvp leaderboard for a season
|
15
15
|
#
|
16
16
|
# @!macro request_options
|
17
|
+
# @option options [Boolean] :classic1x If set to true, this method will call the classic era version
|
17
18
|
#
|
18
19
|
# @!macro response
|
19
20
|
def leaderboards(season_id, **options)
|
@@ -24,6 +25,7 @@ module BlizzardApi
|
|
24
25
|
# Returns the leaderboard for a given season and bracket
|
25
26
|
#
|
26
27
|
# @!macro request_options
|
28
|
+
# @option options [Boolean] :classic1x If set to true, this method will call the classic era version
|
27
29
|
#
|
28
30
|
# @!macro response
|
29
31
|
def leaderboard(season_id, brackets, **options)
|
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.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francis Schiavo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|