blizzard_api 0.2.5 → 0.2.6
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/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/blizzard_api/request.rb +8 -5
- data/lib/blizzard_api/version.rb +1 -1
- data/lib/blizzard_api/wow/game_data/achievement.rb +1 -1
- data/lib/blizzard_api/wow/game_data/azerite_essence.rb +1 -1
- data/lib/blizzard_api/wow/game_data/connected_realm.rb +1 -1
- data/lib/blizzard_api/wow/game_data/creature.rb +7 -1
- data/lib/blizzard_api/wow/game_data/guild.rb +1 -1
- data/lib/blizzard_api/wow/game_data/guild_crest.rb +3 -1
- data/lib/blizzard_api/wow/game_data/item.rb +6 -1
- data/lib/blizzard_api/wow/game_data/mount.rb +1 -1
- data/lib/blizzard_api/wow/game_data/mythic_keystone.rb +1 -1
- data/lib/blizzard_api/wow/game_data/mythic_keystone_affix.rb +1 -1
- data/lib/blizzard_api/wow/game_data/mythic_keystone_leaderboard.rb +1 -1
- data/lib/blizzard_api/wow/game_data/mythic_raid_leaderboard.rb +1 -1
- data/lib/blizzard_api/wow/game_data/pet.rb +1 -1
- data/lib/blizzard_api/wow/game_data/playable_class.rb +7 -1
- data/lib/blizzard_api/wow/game_data/playable_specialization.rb +1 -1
- data/lib/blizzard_api/wow/game_data/power_type.rb +1 -1
- data/lib/blizzard_api/wow/game_data/pvp_season.rb +1 -1
- data/lib/blizzard_api/wow/game_data/pvp_tier.rb +1 -1
- data/lib/blizzard_api/wow/game_data/race.rb +2 -1
- data/lib/blizzard_api/wow/game_data/realm.rb +1 -1
- data/lib/blizzard_api/wow/game_data/region.rb +1 -1
- data/lib/blizzard_api/wow/game_data/title.rb +1 -1
- data/lib/blizzard_api/wow/game_data/wow_token.rb +1 -1
- data/lib/blizzard_api/wow/profile/character_profile.rb +1 -1
- 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: 25c1bd74a1092556badd39caaef17c28d9147e6bfbc5f5503885b908909bc80e
|
4
|
+
data.tar.gz: 9635f636213f46d088727e94c927848606570472ba50604b19c00aaf8b795776
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1c93eaeb0897efd8ff31944139d2e9d46fdab0f26983123fd5f2722b57d85a7feed2bf6fb1803965f9fd7120a4c9a490e79cf2b1e15051a33fe50c5bafabbc3
|
7
|
+
data.tar.gz: a675dd8aec9fea8676e8e938e8b201a2b2279118ac22f54f28503e09308962cfe5b1df092b3370e3c5969b55ae030851f163b58e1804a2b6f5a491a23b500268
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
Please view this file on the master branch, otherwise it may be outdated
|
2
2
|
|
3
|
+
**Version 0.2.6**
|
4
|
+
* Added namespace `static-classic` for wow classic support.
|
5
|
+
* Some WoW endpoints now support the `classic: true` option.
|
6
|
+
|
3
7
|
**Version 0.2.5**
|
4
8
|
* Added two unreleased endpoints for character profile(`raid_progression` and `collections`).
|
5
9
|
* Added new WoW profile endpoints
|
data/Gemfile.lock
CHANGED
data/lib/blizzard_api/request.rb
CHANGED
@@ -83,13 +83,13 @@ module BlizzardApi
|
|
83
83
|
##
|
84
84
|
# Returns a valid namespace string for consuming the api endpoints
|
85
85
|
#
|
86
|
-
# @param [
|
87
|
-
def endpoint_namespace(
|
88
|
-
case
|
86
|
+
# @param [Hash] options A hash containing the namespace key
|
87
|
+
def endpoint_namespace(options)
|
88
|
+
case options[:namespace]
|
89
89
|
when :dynamic
|
90
90
|
"dynamic-#{region}"
|
91
91
|
when :static
|
92
|
-
"static-#{region}"
|
92
|
+
options.include?(:classic) ? "static-classic-#{region}" : "static-#{region}"
|
93
93
|
when :profile
|
94
94
|
"profile-#{region}"
|
95
95
|
else
|
@@ -139,11 +139,14 @@ module BlizzardApi
|
|
139
139
|
|
140
140
|
def api_request(uri, query_string = {})
|
141
141
|
# List of request options
|
142
|
-
options_key = %i[ignore_cache ttl format access_token]
|
142
|
+
options_key = %i[ignore_cache ttl format access_token namespace classic]
|
143
143
|
|
144
144
|
# Separates request options from api fields and options. Any user-defined option will be treated as api field.
|
145
145
|
options = query_string.select { |k, _v| query_string.delete(k) || true if options_key.include? k }
|
146
146
|
|
147
|
+
# Namespace
|
148
|
+
query_string[:namespace] = endpoint_namespace(options) if options.include? :namespace
|
149
|
+
|
147
150
|
# In case uri already have query string parameters joins them with &
|
148
151
|
if query_string.size.positive?
|
149
152
|
query_string = URI.encode_www_form(query_string, false)
|
data/lib/blizzard_api/version.rb
CHANGED
@@ -22,6 +22,7 @@ module BlizzardApi
|
|
22
22
|
# Fetch all creature families
|
23
23
|
#
|
24
24
|
# @!macro request_options
|
25
|
+
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
25
26
|
#
|
26
27
|
# @!macro response
|
27
28
|
def families(options = {})
|
@@ -34,6 +35,7 @@ module BlizzardApi
|
|
34
35
|
# @param id [Integer] Creature family id
|
35
36
|
#
|
36
37
|
# @!macro request_options
|
38
|
+
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
37
39
|
#
|
38
40
|
# @!macro response
|
39
41
|
def family(id, options = {})
|
@@ -46,6 +48,7 @@ module BlizzardApi
|
|
46
48
|
# @param id [Integer] Creature family id
|
47
49
|
#
|
48
50
|
# @!macro request_options
|
51
|
+
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
49
52
|
#
|
50
53
|
# @!macro response
|
51
54
|
def family_media(id, options = {})
|
@@ -56,6 +59,7 @@ module BlizzardApi
|
|
56
59
|
# Fetch all creature types
|
57
60
|
#
|
58
61
|
# @!macro request_options
|
62
|
+
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
59
63
|
#
|
60
64
|
# @!macro response
|
61
65
|
def types(options = {})
|
@@ -68,6 +72,7 @@ module BlizzardApi
|
|
68
72
|
# @param id [Integer] Creature type id
|
69
73
|
#
|
70
74
|
# @!macro request_options
|
75
|
+
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
71
76
|
#
|
72
77
|
# @!macro response
|
73
78
|
def type(id, options = {})
|
@@ -80,6 +85,7 @@ module BlizzardApi
|
|
80
85
|
# @param id [Integer] Creature type id
|
81
86
|
#
|
82
87
|
# @!macro request_options
|
88
|
+
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
83
89
|
#
|
84
90
|
# @!macro response
|
85
91
|
def display_media(id, options = {})
|
@@ -90,7 +96,7 @@ module BlizzardApi
|
|
90
96
|
|
91
97
|
def endpoint_setup
|
92
98
|
@endpoint = 'creature'
|
93
|
-
@namespace =
|
99
|
+
@namespace = :static
|
94
100
|
@collection = 'achievements'
|
95
101
|
@ttl = CACHE_TRIMESTER
|
96
102
|
end
|
@@ -105,7 +105,7 @@ module BlizzardApi
|
|
105
105
|
guild = CGI.escape string_to_slug(guild)
|
106
106
|
url = "#{base_url(:game_data)}/guild/#{realm}/#{guild}"
|
107
107
|
url += "/#{variant}" if variant
|
108
|
-
api_request url, { ttl: CACHE_DAY, namespace:
|
108
|
+
api_request url, { ttl: CACHE_DAY, namespace: :profile }.merge(options)
|
109
109
|
end
|
110
110
|
end
|
111
111
|
end
|
@@ -20,6 +20,7 @@ module BlizzardApi
|
|
20
20
|
# @param id [Integer] Border id
|
21
21
|
#
|
22
22
|
# @!macro request_options
|
23
|
+
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
23
24
|
#
|
24
25
|
# @!macro response
|
25
26
|
def border_media(id, options = {})
|
@@ -30,6 +31,7 @@ module BlizzardApi
|
|
30
31
|
# Return guild embelm assets by its id
|
31
32
|
#
|
32
33
|
# @param id [Integer] Emblem id
|
34
|
+
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
33
35
|
#
|
34
36
|
# @!macro request_options
|
35
37
|
#
|
@@ -42,7 +44,7 @@ module BlizzardApi
|
|
42
44
|
|
43
45
|
def endpoint_setup
|
44
46
|
@endpoint = 'guild-crest'
|
45
|
-
@namespace =
|
47
|
+
@namespace = :static
|
46
48
|
@ttl = CACHE_TRIMESTER
|
47
49
|
end
|
48
50
|
end
|
@@ -33,6 +33,7 @@ module BlizzardApi
|
|
33
33
|
# @!macro request_options
|
34
34
|
# @option options [Boolean] :use_community_endpoint If set to true, this method will call the community endpoint
|
35
35
|
# instead of the data endpoint https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
|
36
|
+
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
36
37
|
#
|
37
38
|
# @!macro response
|
38
39
|
def get(id, options = {})
|
@@ -58,6 +59,7 @@ module BlizzardApi
|
|
58
59
|
# @!macro request_options
|
59
60
|
# @option options [Boolean] :use_community_endpoint If set to true, this method will call the community endpoint
|
60
61
|
# instead of the data endpoint https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
|
62
|
+
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
61
63
|
#
|
62
64
|
# @!macro response
|
63
65
|
def classes(options = {})
|
@@ -73,6 +75,7 @@ module BlizzardApi
|
|
73
75
|
#
|
74
76
|
# @param id [Integer] Item class id
|
75
77
|
# @!macro request_options
|
78
|
+
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
76
79
|
#
|
77
80
|
# @!macro response
|
78
81
|
def class(id, options = {})
|
@@ -85,6 +88,7 @@ module BlizzardApi
|
|
85
88
|
# @param id [Integer] Item class id
|
86
89
|
# @param subclass_id [Integer] Item subclass id
|
87
90
|
# @!macro request_options
|
91
|
+
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
88
92
|
#
|
89
93
|
# @!macro response
|
90
94
|
def subclass(id, subclass_id, options = {})
|
@@ -97,6 +101,7 @@ module BlizzardApi
|
|
97
101
|
# @param id [Integer] Item id
|
98
102
|
#
|
99
103
|
# @!macro request_options
|
104
|
+
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
100
105
|
#
|
101
106
|
# @!macro response
|
102
107
|
def media(id, options = {})
|
@@ -107,7 +112,7 @@ module BlizzardApi
|
|
107
112
|
|
108
113
|
def endpoint_setup
|
109
114
|
@endpoint = 'item'
|
110
|
-
@namespace =
|
115
|
+
@namespace = :static
|
111
116
|
@collection = 'items'
|
112
117
|
@ttl = CACHE_TRIMESTER
|
113
118
|
end
|
@@ -20,7 +20,7 @@ module BlizzardApi
|
|
20
20
|
#
|
21
21
|
# @!macro response
|
22
22
|
def get(raid, faction, options = {})
|
23
|
-
opts = options.merge(namespace:
|
23
|
+
opts = options.merge(namespace: :dynamic, ttl: CACHE_DAY)
|
24
24
|
api_request "#{base_url(:game_data)}/leaderboard/hall-of-fame/#{raid}/#{faction}", opts
|
25
25
|
end
|
26
26
|
end
|
@@ -16,6 +16,7 @@ module BlizzardApi
|
|
16
16
|
# @!macro request_options
|
17
17
|
# @option options [Boolean] :use_community_endpoint If set to true, this method will call the community endpoint
|
18
18
|
# instead of the data endpoint https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
|
19
|
+
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
19
20
|
#
|
20
21
|
# @!macro response
|
21
22
|
def index(options = {})
|
@@ -37,6 +38,8 @@ module BlizzardApi
|
|
37
38
|
|
38
39
|
##
|
39
40
|
# @!macro complete
|
41
|
+
#
|
42
|
+
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
40
43
|
def complete(options = {})
|
41
44
|
index_data = index options
|
42
45
|
[].tap do |classes|
|
@@ -54,6 +57,7 @@ module BlizzardApi
|
|
54
57
|
# @param id [Integer] Playable class id
|
55
58
|
#
|
56
59
|
# @!macro request_options
|
60
|
+
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
57
61
|
#
|
58
62
|
# @!macro response
|
59
63
|
def get(id, options = {})
|
@@ -66,12 +70,14 @@ module BlizzardApi
|
|
66
70
|
|
67
71
|
def endpoint_setup
|
68
72
|
@endpoint = 'playable-class'
|
69
|
-
@namespace =
|
73
|
+
@namespace = :static
|
70
74
|
@collection = 'classes'
|
71
75
|
@ttl = CACHE_TRIMESTER
|
72
76
|
end
|
73
77
|
|
74
78
|
def get_class_icon(media_url, options)
|
79
|
+
return if options.include? :classic
|
80
|
+
|
75
81
|
media_data = request media_url[:key][:href], options
|
76
82
|
%r{56/([a-z_]+).jpg}.match(media_data[:assets][0][:value].to_s)[1]
|
77
83
|
end
|
@@ -16,6 +16,7 @@ module BlizzardApi
|
|
16
16
|
# @!macro request_options
|
17
17
|
# @option options [Boolean] :use_community_endpoint If set to true, this method will call the community endpoint
|
18
18
|
# instead of the data endpoint https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
|
19
|
+
# @option options [Boolean] :classic If set to true, this method will call the classic version
|
19
20
|
#
|
20
21
|
# @!macro response
|
21
22
|
def index(options = {})
|
@@ -28,7 +29,7 @@ module BlizzardApi
|
|
28
29
|
|
29
30
|
def endpoint_setup
|
30
31
|
@endpoint = 'playable-race'
|
31
|
-
@namespace =
|
32
|
+
@namespace = :static
|
32
33
|
@collection = 'races'
|
33
34
|
@ttl = CACHE_TRIMESTER
|
34
35
|
end
|
@@ -17,7 +17,7 @@ module BlizzardApi
|
|
17
17
|
#
|
18
18
|
# @!macro response
|
19
19
|
def get(options = {})
|
20
|
-
opts = { namespace:
|
20
|
+
opts = { namespace: :dynamic, ttl: CACHE_HOUR }.merge(options)
|
21
21
|
api_request "#{base_url(:game_data)}/token/index", opts
|
22
22
|
end
|
23
23
|
end
|
@@ -274,7 +274,7 @@ module BlizzardApi
|
|
274
274
|
private
|
275
275
|
|
276
276
|
def default_options(user_token = nil)
|
277
|
-
opts = { ttl: CACHE_HOUR, namespace:
|
277
|
+
opts = { ttl: CACHE_HOUR, namespace: :profile }
|
278
278
|
opts.merge access_token: user_token if user_token
|
279
279
|
opts
|
280
280
|
end
|
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.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francis Schiavo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|