blizzard_api 0.2.3 → 0.2.4
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/.gitlab-ci.yml +1 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +11 -13
- data/README.md +13 -0
- data/blizzard_api.gemspec +1 -1
- data/lib/blizzard_api.rb +1 -0
- data/lib/blizzard_api/configuration.rb +2 -2
- data/lib/blizzard_api/diablo/request.rb +1 -1
- data/lib/blizzard_api/hearthstone.rb +32 -0
- data/lib/blizzard_api/hearthstone/game_data/card.rb +91 -0
- data/lib/blizzard_api/hearthstone/game_data/deck.rb +29 -0
- data/lib/blizzard_api/hearthstone/game_data/generic_data_endpoint.rb +49 -0
- data/lib/blizzard_api/hearthstone/game_data/metadata.rb +21 -0
- data/lib/blizzard_api/hearthstone/request.rb +15 -0
- data/lib/blizzard_api/version.rb +1 -1
- data/lib/blizzard_api/wow/profile/character_profile.rb +129 -23
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 770ab293148fe2410f404e46ffb5108121b47dcf9262dfc4e07c4b139dca3fab
|
4
|
+
data.tar.gz: c807938359f746c9a0d0ada0761726e268588f2a359b1c362c3acb24444dfa98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 429845f34610b72326cdca9b77b8408d49bb0852297d0282d8ee71ef0a2f0c4dfe4ea6dbf1c3d5ca31e562a343edde968178888d64e29ea7c8ec2d522eb1d6e7
|
7
|
+
data.tar.gz: d06edb2063dd4edd42b7f5ae18018355854884eb482ac94d3589f6abc3a04fa24d93e37f474d690daa225aa392c12baa5a36dc1ea9751c0afb2b2277b96d29a5
|
data/.gitlab-ci.yml
CHANGED
data/.travis.yml
CHANGED
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.4**
|
4
|
+
* Added new WoW profile endpoints: #2 https://us.battle.net/forums/en/bnet/topic/20772457051
|
5
|
+
* Added support for HearthStone: !1 (Thanks Bradyn Glines for implementing this)
|
6
|
+
|
3
7
|
**Version 0.2.3**
|
4
8
|
* Added new api endpoints listed here: https://us.battle.net/forums/en/bnet/topic/20772337044
|
5
9
|
|
data/Gemfile.lock
CHANGED
@@ -8,33 +8,31 @@ GEM
|
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
ast (2.4.0)
|
11
|
-
dotenv (2.
|
12
|
-
jaro_winkler (1.5.
|
11
|
+
dotenv (2.7.4)
|
12
|
+
jaro_winkler (1.5.3)
|
13
13
|
minitest (5.11.3)
|
14
|
-
parallel (1.
|
15
|
-
parser (2.
|
14
|
+
parallel (1.17.0)
|
15
|
+
parser (2.6.3.0)
|
16
16
|
ast (~> 2.4.0)
|
17
|
-
powerpack (0.1.2)
|
18
17
|
rainbow (3.0.0)
|
19
18
|
rake (10.5.0)
|
20
|
-
redis (4.1.
|
21
|
-
rubocop (0.
|
19
|
+
redis (4.1.2)
|
20
|
+
rubocop (0.72.0)
|
22
21
|
jaro_winkler (~> 1.5.1)
|
23
22
|
parallel (~> 1.10)
|
24
|
-
parser (>= 2.
|
25
|
-
powerpack (~> 0.1)
|
23
|
+
parser (>= 2.6)
|
26
24
|
rainbow (>= 2.2.2, < 4.0)
|
27
25
|
ruby-progressbar (~> 1.7)
|
28
|
-
unicode-display_width (
|
29
|
-
ruby-progressbar (1.10.
|
30
|
-
unicode-display_width (1.
|
26
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
27
|
+
ruby-progressbar (1.10.1)
|
28
|
+
unicode-display_width (1.6.0)
|
31
29
|
|
32
30
|
PLATFORMS
|
33
31
|
ruby
|
34
32
|
|
35
33
|
DEPENDENCIES
|
36
34
|
blizzard_api!
|
37
|
-
bundler (~> 1.
|
35
|
+
bundler (~> 1.17.3)
|
38
36
|
dotenv (~> 2.5)
|
39
37
|
minitest (~> 5.0)
|
40
38
|
rake (~> 10.0)
|
data/README.md
CHANGED
@@ -16,6 +16,7 @@ This gem allow you to interface with the new blizzard api (2018) using the OAuth
|
|
16
16
|
- 4.1. [World of Warcraft endpoints](#41-world-of-warcraft-endpoints)
|
17
17
|
- 4.2. [Diablo III endpoints](#42-diablo-iii-endpoints)
|
18
18
|
- 4.3. [Starcraft II endpoints](#43-starcraft-ii-endpoints)
|
19
|
+
- 4.4. [Hearthstone endpoints](#44-hearthstone-endpoints)
|
19
20
|
|
20
21
|
## 1. Installation
|
21
22
|
|
@@ -266,6 +267,18 @@ Every endpoint requiring a *region_id* parameter will accepts either the integer
|
|
266
267
|
* BlizzardApi::Starcraft::Account
|
267
268
|
- player :account_id
|
268
269
|
|
270
|
+
### 4.4. Hearthstone endpoints
|
271
|
+
|
272
|
+
* BlizzardApi::Hearthstone::Card
|
273
|
+
- index
|
274
|
+
- get :id_or_slug
|
275
|
+
- search :search_options
|
276
|
+
* BlizzardApi::Hearthstone::Deck
|
277
|
+
- get :deck_code
|
278
|
+
* BlizzardApi::Hearthstone::Metadata
|
279
|
+
- index
|
280
|
+
- get :type
|
281
|
+
|
269
282
|
## Contributing
|
270
283
|
|
271
284
|
Bug reports and pull requests are welcome on Gitlab at https://gitlab.com/francisschiavo/blizzard_api/issues
|
data/blizzard_api.gemspec
CHANGED
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
|
|
34
34
|
|
35
35
|
spec.add_runtime_dependency 'redis', '~> 4.1', '>= 4.1.0'
|
36
36
|
|
37
|
-
spec.add_development_dependency 'bundler', '~> 1.
|
37
|
+
spec.add_development_dependency 'bundler', '~> 1.17.3'
|
38
38
|
spec.add_development_dependency 'dotenv', '~> 2.5'
|
39
39
|
spec.add_development_dependency 'minitest', '~> 5.0'
|
40
40
|
spec.add_development_dependency 'rake', '~> 10.0'
|
data/lib/blizzard_api.rb
CHANGED
@@ -68,7 +68,7 @@ module BlizzardApi
|
|
68
68
|
|
69
69
|
##
|
70
70
|
# @!attribute guild_emblem_directory
|
71
|
-
# Guild crest images directory. Some sub directories will be
|
71
|
+
# Guild crest images directory. Some sub directories will be created.
|
72
72
|
# @see https://develop.battle.net/access/clients
|
73
73
|
# @return [String] Guild crest directory
|
74
74
|
attr_accessor :wow_guild_crest_directory
|
@@ -93,7 +93,7 @@ module BlizzardApi
|
|
93
93
|
# @yield self
|
94
94
|
#
|
95
95
|
# @example
|
96
|
-
#
|
96
|
+
# BlizzardApi.configure do |config|
|
97
97
|
# config.app_id = ENV['BNET_APPLICATION_ID']
|
98
98
|
# config.app_secret = ENV['BNET_APPLICATION_SECRET']
|
99
99
|
# config.region = 'us'
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
# Hearthstone related classes
|
5
|
+
module Hearthstone
|
6
|
+
require_relative 'hearthstone/request'
|
7
|
+
require_relative 'hearthstone/game_data/generic_data_endpoint'
|
8
|
+
|
9
|
+
# Hearthstone data api
|
10
|
+
require_relative 'hearthstone/game_data/card'
|
11
|
+
require_relative 'hearthstone/game_data/deck'
|
12
|
+
require_relative 'hearthstone/game_data/metadata'
|
13
|
+
|
14
|
+
##
|
15
|
+
# @return {Card}
|
16
|
+
def self.card
|
17
|
+
BlizzardApi::Hearthstone::Card.new
|
18
|
+
end
|
19
|
+
|
20
|
+
##
|
21
|
+
# @return {Deck}
|
22
|
+
def self.deck
|
23
|
+
BlizzardApi::Hearthstone::Deck.new
|
24
|
+
end
|
25
|
+
|
26
|
+
##
|
27
|
+
# @return {Metadata}
|
28
|
+
def self.metadata
|
29
|
+
BlizzardApi::Hearthstone::Metadata.new
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Hearthstone
|
5
|
+
##
|
6
|
+
# This class allows access to Hearthstone card data
|
7
|
+
#
|
8
|
+
# @see https://develop.battle.net/documentation/api-reference/hearthstone-game-data-api
|
9
|
+
#
|
10
|
+
# You can get an instance of this class using the default region as follows:
|
11
|
+
# api_instance = BlizzardApi::Hearthstone.card
|
12
|
+
class Card < Hearthstone::GenericDataEndpoint
|
13
|
+
# Valid options for card search
|
14
|
+
VALID_SEARCH_OPTIONS = %i[
|
15
|
+
set
|
16
|
+
class
|
17
|
+
manaCost
|
18
|
+
attack
|
19
|
+
health
|
20
|
+
collectible
|
21
|
+
rarity
|
22
|
+
type
|
23
|
+
minionType
|
24
|
+
keyword
|
25
|
+
textFilter
|
26
|
+
page
|
27
|
+
pageSize
|
28
|
+
sort
|
29
|
+
order
|
30
|
+
].freeze
|
31
|
+
|
32
|
+
##
|
33
|
+
# Fetch all possible data for one of the items listed by the {#index} using its *id*
|
34
|
+
#
|
35
|
+
# @param search_options [Hash] Search options accepted by the endpoint
|
36
|
+
# @option search_options [String] :set The slug of the set the card belongs to.
|
37
|
+
# If you do not supply a value cards from all sets will be returned.
|
38
|
+
# @option search_options [String] :class The slug of the card's class.
|
39
|
+
# @option search_options [Integer] :manaCost The mana cost required to play the card.
|
40
|
+
# You can include multiple values in a comma-separated list of numeric values.
|
41
|
+
# @option search_options [Integer] :attack The attack power of the minion or weapon.
|
42
|
+
# You can include multiple values in a comma-separated list of numeric values.
|
43
|
+
# @option search_options [Integer] :health The health of a minion.
|
44
|
+
# You can include multiple values in a comma-separated list of numeric values.
|
45
|
+
# @option search_options [Float] :collectible Whether a card is collectible.
|
46
|
+
# A value of 1 indicates that collectible cards should be returned; 0 indicates uncollectible cards.
|
47
|
+
# To return all cards, use a value of '0,1'.
|
48
|
+
# @option search_options [String] :rarity The rarity of a card.
|
49
|
+
# This value must match the rarity slugs found in metadata.
|
50
|
+
# @option search_options [String] :type The type of card (for example, minion, spell, and so on).
|
51
|
+
# This value must match the type slugs found in metadata.
|
52
|
+
# @option search_options [String] :minionType The type of minion card (for example, beast, murloc, dragon, and
|
53
|
+
# so on). This value must match the minion type slugs found in metadata.
|
54
|
+
# @option search_options [String] :keyword A required keyword on the card (for example, battlecry, deathrattle,
|
55
|
+
# and so on). This value must match the keyword slugs found in metadata.
|
56
|
+
# @option search_options [String] :textFilter A text string used to filter cards.
|
57
|
+
# You must include a locale along with the textFilter parameter.
|
58
|
+
# @option search_options [Integer] :page A page number.
|
59
|
+
# @option search_options [Integer] :pageSize The number of results to choose per page.
|
60
|
+
# A value will be selected automatically if you do not supply a pageSize or if the pageSize is higher than the
|
61
|
+
# maximum allowed. @option search_options [String] :sort The field used to sort the results.
|
62
|
+
# Valid values include manaCost, attack, health, and name. Results are sorted by manaCost by default.
|
63
|
+
# Cards will also be sorted by class automatically in most cases.
|
64
|
+
# @option search_options [String] :order The order in which to sort the results.
|
65
|
+
# Valid values are asc or desc. The default value is asc.
|
66
|
+
# @!macro request_options
|
67
|
+
# @option options [Boolean] :validate_fields If set to true, this method will throw an exception if nay search
|
68
|
+
# option is invalid
|
69
|
+
#
|
70
|
+
# @!macro response
|
71
|
+
def search(search_options = {}, options = {})
|
72
|
+
validate_search_options search_options if options.include? :validate_fields
|
73
|
+
|
74
|
+
api_request "#{base_url(:community)}/cards", default_options.merge(options).merge(search_options)
|
75
|
+
end
|
76
|
+
|
77
|
+
protected
|
78
|
+
|
79
|
+
def validate_search_options(search_options)
|
80
|
+
search_options.each do |field|
|
81
|
+
raise ArgumentError, "Unrecognized search option #{field}" unless VALID_SEARCH_OPTIONS.include? field
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def endpoint_setup
|
86
|
+
@endpoint = 'cards'
|
87
|
+
@ttl = CACHE_TRIMESTER
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Hearthstone
|
5
|
+
##
|
6
|
+
# This class allows access to Hearthstone deck data
|
7
|
+
#
|
8
|
+
# @see https://develop.battle.net/documentation/api-reference/hearthstone-game-data-api
|
9
|
+
#
|
10
|
+
# You can get an instance of this class using the default region as follows:
|
11
|
+
# api_instance = BlizzardApi::Hearthstone.deck
|
12
|
+
class Deck < Hearthstone::GenericDataEndpoint
|
13
|
+
def index
|
14
|
+
raise ApiException, 'This endpoint does not have a index method'
|
15
|
+
end
|
16
|
+
|
17
|
+
protected
|
18
|
+
|
19
|
+
def endpoint_setup
|
20
|
+
@endpoint = 'deck'
|
21
|
+
@ttl = CACHE_TRIMESTER
|
22
|
+
end
|
23
|
+
|
24
|
+
def default_options
|
25
|
+
{ ttl: @ttl }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Hearthstone
|
5
|
+
# Generic endpoint to support most data requests with minor configurations
|
6
|
+
class GenericDataEndpoint < Hearthstone::Request
|
7
|
+
def initialize(region = nil)
|
8
|
+
super region
|
9
|
+
endpoint_setup
|
10
|
+
@ttl ||= CACHE_DAY
|
11
|
+
end
|
12
|
+
|
13
|
+
##
|
14
|
+
# Using :community base_url as that's where Blizzard's endpoint resides
|
15
|
+
# Also in the game_data folder as they have labeled it "Hearthstone Game Data APIs"
|
16
|
+
|
17
|
+
##
|
18
|
+
# Get information about the resource
|
19
|
+
#
|
20
|
+
# @!macro request_options
|
21
|
+
#
|
22
|
+
# @!macro response
|
23
|
+
def index(options = {})
|
24
|
+
api_request "#{base_url(:community)}/#{@endpoint}/", default_options.merge(options)
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Fetch all possible data for one of items listed by the {#index} using its *id*
|
29
|
+
#
|
30
|
+
# @param [Integer] id One of the IDs returned by the {#index}
|
31
|
+
# @!macro request_options
|
32
|
+
#
|
33
|
+
# @!macro response
|
34
|
+
def get(id, options = {})
|
35
|
+
api_request "#{base_url(:community)}/#{@endpoint}/#{id}", default_options.merge(options)
|
36
|
+
end
|
37
|
+
|
38
|
+
protected
|
39
|
+
|
40
|
+
def endpoint_setup
|
41
|
+
raise NotImplementedError
|
42
|
+
end
|
43
|
+
|
44
|
+
def default_options
|
45
|
+
{ ttl: @ttl }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Hearthstone
|
5
|
+
##
|
6
|
+
# This class allows access to Hearthstone metadata data
|
7
|
+
#
|
8
|
+
# @see https://develop.battle.net/documentation/api-reference/hearthstone-game-data-api
|
9
|
+
#
|
10
|
+
# You can get an instance of this class using the default region as follows:
|
11
|
+
# api_instance = BlizzardApi::Hearthstone.metadata
|
12
|
+
class Metadata < Hearthstone::GenericDataEndpoint
|
13
|
+
protected
|
14
|
+
|
15
|
+
def endpoint_setup
|
16
|
+
@endpoint = 'metadata'
|
17
|
+
@ttl = CACHE_TRIMESTER
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlizzardApi
|
4
|
+
module Hearthstone
|
5
|
+
# Hearthstone requests
|
6
|
+
class Request < BlizzardApi::Request
|
7
|
+
##
|
8
|
+
# @!macro regions
|
9
|
+
def initialize(region = nil)
|
10
|
+
super region
|
11
|
+
@game = 'hearthstone'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/blizzard_api/version.rb
CHANGED
@@ -11,62 +11,168 @@ module BlizzardApi
|
|
11
11
|
# api_instance = BlizzardApi::Wow.achievement
|
12
12
|
class CharacterProfile < Wow::Request
|
13
13
|
##
|
14
|
-
# Return
|
14
|
+
# Return character achievements
|
15
15
|
#
|
16
|
-
# @
|
17
|
-
# @see https://develop.battle.net/documentation/guides/using-oauth/authorization-code-flow
|
16
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
|
18
17
|
#
|
19
18
|
# @param realm [String] The character realm's slug
|
20
19
|
# @param character [String] The character name
|
21
|
-
# @param user_token [String] A token obtained by the authorization flow. See link below.
|
22
|
-
# @param season [Integer] Season ID if you want only a specific season or nil to include all.
|
23
20
|
# @!macro request_options
|
24
21
|
#
|
25
22
|
# @!macro response
|
26
|
-
def
|
27
|
-
|
28
|
-
url += "/season/#{season}" unless season.nil?
|
29
|
-
api_request url, default_options(user_token).merge(options)
|
23
|
+
def achievements(realm, character, options = {})
|
24
|
+
api_request "#{endpoint_uri(realm, character)}/achievements", default_options.merge(options)
|
30
25
|
end
|
31
26
|
|
32
27
|
##
|
33
|
-
# Return
|
28
|
+
# Return character appearance
|
29
|
+
#
|
30
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
|
31
|
+
#
|
32
|
+
# @param realm [String] The character realm's slug
|
33
|
+
# @param character [String] The character name
|
34
|
+
# @!macro request_options
|
35
|
+
#
|
36
|
+
# @!macro response
|
37
|
+
def appearance(realm, character, options = {})
|
38
|
+
api_request "#{endpoint_uri(realm, character)}/appearance", default_options.merge(options)
|
39
|
+
end
|
40
|
+
|
41
|
+
##
|
42
|
+
# Return character equipment
|
43
|
+
#
|
44
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
|
45
|
+
#
|
46
|
+
# @param realm [String] The character realm's slug
|
47
|
+
# @param character [String] The character name
|
48
|
+
# @!macro request_options
|
49
|
+
#
|
50
|
+
# @!macro response
|
51
|
+
def equipment(realm, character, options = {})
|
52
|
+
api_request "#{endpoint_uri(realm, character)}/equipment", default_options.merge(options)
|
53
|
+
end
|
54
|
+
|
55
|
+
##
|
56
|
+
# Return character media
|
34
57
|
#
|
35
|
-
# @
|
36
|
-
# @see https://develop.battle.net/documentation/guides/using-oauth/authorization-code-flow
|
58
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
|
37
59
|
#
|
38
60
|
# @param realm [String] The character realm's slug
|
39
61
|
# @param character [String] The character name
|
40
|
-
# @param user_token [String] A token obtained by the authorization flow. See link below.
|
41
62
|
# @!macro request_options
|
42
63
|
#
|
43
64
|
# @!macro response
|
44
|
-
def
|
45
|
-
api_request "#{endpoint_uri(realm, character)}/
|
65
|
+
def media(realm, character, options = {})
|
66
|
+
api_request "#{endpoint_uri(realm, character)}/character-media", default_options.merge(options)
|
46
67
|
end
|
47
68
|
|
48
69
|
##
|
49
70
|
# Return the pvp bracket of a character
|
50
71
|
#
|
51
|
-
# @
|
52
|
-
# @see https://develop.battle.net/documentation/guides/using-oauth/authorization-code-flow
|
72
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
|
53
73
|
#
|
54
74
|
# @param realm [String] The character realm's slug
|
55
75
|
# @param character [String] The character name
|
56
76
|
# @param bracket [String] Pvp bracket
|
57
|
-
# @param user_token [String] A token obtained by the authorization flow. See link below.
|
58
77
|
# @!macro request_options
|
59
78
|
#
|
60
79
|
# @!macro response
|
61
|
-
def pvp_bracket(realm, character, bracket,
|
62
|
-
api_request "#{endpoint_uri(realm, character)}/pvp-bracket/#{bracket}",
|
63
|
-
|
80
|
+
def pvp_bracket(realm, character, bracket, options = {})
|
81
|
+
api_request "#{endpoint_uri(realm, character)}/pvp-bracket/#{bracket}", default_options.merge(options)
|
82
|
+
end
|
83
|
+
|
84
|
+
##
|
85
|
+
# Return the pvp summary of a character
|
86
|
+
#
|
87
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
|
88
|
+
#
|
89
|
+
# @param realm [String] The character realm's slug
|
90
|
+
# @param character [String] The character name
|
91
|
+
# @!macro request_options
|
92
|
+
#
|
93
|
+
# @!macro response
|
94
|
+
def pvp_summary(realm, character, options = {})
|
95
|
+
api_request "#{endpoint_uri(realm, character)}/pvp-summary", default_options.merge(options)
|
96
|
+
end
|
97
|
+
|
98
|
+
##
|
99
|
+
# Return a character's specialization
|
100
|
+
#
|
101
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
|
102
|
+
#
|
103
|
+
# @param realm [String] The character realm's slug
|
104
|
+
# @param character [String] The character name
|
105
|
+
# @!macro request_options
|
106
|
+
#
|
107
|
+
# @!macro response
|
108
|
+
def specializations(realm, character, options = {})
|
109
|
+
api_request "#{endpoint_uri(realm, character)}/specializations", default_options.merge(options)
|
110
|
+
end
|
111
|
+
|
112
|
+
##
|
113
|
+
# Return a character's statistics
|
114
|
+
#
|
115
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
|
116
|
+
#
|
117
|
+
# @param realm [String] The character realm's slug
|
118
|
+
# @param character [String] The character name
|
119
|
+
# @!macro request_options
|
120
|
+
#
|
121
|
+
# @!macro response
|
122
|
+
def statistics(realm, character, options = {})
|
123
|
+
api_request "#{endpoint_uri(realm, character)}/statistics", default_options.merge(options)
|
124
|
+
end
|
125
|
+
|
126
|
+
##
|
127
|
+
# Return a character's titles
|
128
|
+
#
|
129
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
|
130
|
+
#
|
131
|
+
# @param realm [String] The character realm's slug
|
132
|
+
# @param character [String] The character name
|
133
|
+
# @!macro request_options
|
134
|
+
#
|
135
|
+
# @!macro response
|
136
|
+
def titles(realm, character, options = {})
|
137
|
+
api_request "#{endpoint_uri(realm, character)}/titles", default_options.merge(options)
|
138
|
+
end
|
139
|
+
|
140
|
+
##
|
141
|
+
# Return the mythic keystone profile of a character
|
142
|
+
#
|
143
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
|
144
|
+
#
|
145
|
+
# @param realm [String] The character realm's slug
|
146
|
+
# @param character [String] The character name
|
147
|
+
# @!macro request_options
|
148
|
+
#
|
149
|
+
# @!macro response
|
150
|
+
def keystone_profile(realm, character, options = {})
|
151
|
+
api_request "#{endpoint_uri(realm, character)}/mythic-keystone-profile", default_options.merge(options)
|
152
|
+
end
|
153
|
+
|
154
|
+
##
|
155
|
+
# Return the mythic keystone profile of a character
|
156
|
+
#
|
157
|
+
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
|
158
|
+
#
|
159
|
+
# @param realm [String] The character realm's slug
|
160
|
+
# @param character [String] The character name
|
161
|
+
# @param season [Integer] Season ID if you want only a specific season or nil to include all.
|
162
|
+
# @!macro request_options
|
163
|
+
#
|
164
|
+
# @!macro response
|
165
|
+
def keystone_season_details(realm, character, season = nil, options = {})
|
166
|
+
api_request api_request "#{endpoint_uri(realm, character)}/mythic-keystone-profile/season/#{season}",
|
167
|
+
default_options.merge(options)
|
64
168
|
end
|
65
169
|
|
66
170
|
private
|
67
171
|
|
68
|
-
def default_options(user_token)
|
69
|
-
{ ttl: CACHE_HOUR, namespace: endpoint_namespace(:profile)
|
172
|
+
def default_options(user_token = nil)
|
173
|
+
opts = { ttl: CACHE_HOUR, namespace: endpoint_namespace(:profile) }
|
174
|
+
opts.merge access_token: user_token if user_token
|
175
|
+
opts
|
70
176
|
end
|
71
177
|
|
72
178
|
def endpoint_uri(realm, character)
|
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.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: 2019-07-
|
11
|
+
date: 2019-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -36,14 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
39
|
+
version: 1.17.3
|
40
40
|
type: :development
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
46
|
+
version: 1.17.3
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: dotenv
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +136,12 @@ files:
|
|
136
136
|
- lib/blizzard_api/diablo/game_data/season.rb
|
137
137
|
- lib/blizzard_api/diablo/request.rb
|
138
138
|
- lib/blizzard_api/exception.rb
|
139
|
+
- lib/blizzard_api/hearthstone.rb
|
140
|
+
- lib/blizzard_api/hearthstone/game_data/card.rb
|
141
|
+
- lib/blizzard_api/hearthstone/game_data/deck.rb
|
142
|
+
- lib/blizzard_api/hearthstone/game_data/generic_data_endpoint.rb
|
143
|
+
- lib/blizzard_api/hearthstone/game_data/metadata.rb
|
144
|
+
- lib/blizzard_api/hearthstone/request.rb
|
139
145
|
- lib/blizzard_api/request.rb
|
140
146
|
- lib/blizzard_api/starcraft.rb
|
141
147
|
- lib/blizzard_api/starcraft/community/account.rb
|