blizzard_api 0.3.0 → 0.3.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/CHANGELOG.md +9 -0
- data/Gemfile.lock +1 -1
- data/lib/blizzard_api/hearthstone.rb +7 -0
- data/lib/blizzard_api/hearthstone/game_data/back.rb +59 -0
- data/lib/blizzard_api/hearthstone/game_data/card.rb +20 -0
- data/lib/blizzard_api/hearthstone/game_data/deck.rb +1 -0
- data/lib/blizzard_api/hearthstone/game_data/generic_data_endpoint.rb +1 -1
- data/lib/blizzard_api/hearthstone/game_data/metadata.rb +1 -0
- data/lib/blizzard_api/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45f2875f44a7d4af854565cd63f33286da88a5d0be8ef48bdda7ad3afa967787
|
4
|
+
data.tar.gz: 561caa05b1ce6d7d4ffcd041e63ffa865b136fc6c556c32b6423eff08c48440d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25c9fdc5b2263f7e556c494db66d15b56574ddd9a05694236d90ff25ed6edcf9702cdd8f83dd5977d3f6e4c67e2f0288e0eeb80e6c0f944e8a09fef51ae55662
|
7
|
+
data.tar.gz: b80581204677d04b6cde838f9b9ca348787ffa2fb2d15706a4f43c86911eaf06e67d3b6c7a2806aa266dda71a9405c09db197239f10ece171e8c47e0da923b21
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
Please view this file on the master branch, otherwise it may be outdated
|
2
2
|
|
3
|
+
**Version 0.3.1**
|
4
|
+
|
5
|
+
https://us.forums.blizzard.com/en/blizzard/t/hearthstone-api-updates/2978
|
6
|
+
|
7
|
+
Hearthstone updates:
|
8
|
+
|
9
|
+
* Added the new Cardback endpoint
|
10
|
+
* Card endpoint now supports the new `gameMode` search option
|
11
|
+
|
3
12
|
**Version 0.3.0**
|
4
13
|
|
5
14
|
https://us.forums.blizzard.com/en/blizzard/t/starcraft-ii-community-api-update/2652
|
data/Gemfile.lock
CHANGED
@@ -8,6 +8,7 @@ module BlizzardApi
|
|
8
8
|
|
9
9
|
# Hearthstone data api
|
10
10
|
require_relative 'hearthstone/game_data/card'
|
11
|
+
require_relative 'hearthstone/game_data/back'
|
11
12
|
require_relative 'hearthstone/game_data/deck'
|
12
13
|
require_relative 'hearthstone/game_data/metadata'
|
13
14
|
|
@@ -17,6 +18,12 @@ module BlizzardApi
|
|
17
18
|
BlizzardApi::Hearthstone::Card.new
|
18
19
|
end
|
19
20
|
|
21
|
+
##
|
22
|
+
# @return {Back}
|
23
|
+
def self.back
|
24
|
+
BlizzardApi::Hearthstone::Back.new
|
25
|
+
end
|
26
|
+
|
20
27
|
##
|
21
28
|
# @return {Deck}
|
22
29
|
def self.deck
|
@@ -0,0 +1,59 @@
|
|
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
|
+
# @see https://develop.battle.net/documentation/hearthstone/guides/card-backs
|
10
|
+
#
|
11
|
+
# You can get an instance of this class using the default region as follows:
|
12
|
+
# api_instance = BlizzardApi::Hearthstone.card
|
13
|
+
class Back < Hearthstone::GenericDataEndpoint
|
14
|
+
# Valid options for card search
|
15
|
+
VALID_SEARCH_OPTIONS = %i[
|
16
|
+
cardBackCategory
|
17
|
+
textFilter
|
18
|
+
sort
|
19
|
+
order
|
20
|
+
].freeze
|
21
|
+
|
22
|
+
##
|
23
|
+
# Returns an up-to-date list of all card backs matching the search criteria. For more information about the
|
24
|
+
# search parameters, see the Card Backs Guide.
|
25
|
+
#
|
26
|
+
# @param search_options [Hash] Search options accepted by the endpoint
|
27
|
+
# @option search_options [String] :cardBackCategory A category of the card back. The category must match a valid category.
|
28
|
+
# @option search_options [String] :textFilter A text string used to filter cards.
|
29
|
+
# You must include a locale along with the textFilter parameter.
|
30
|
+
# @option search_options [String] :sort The field used to sort the results. Valid value include name.
|
31
|
+
# Results are sorted by date (desc) by default.
|
32
|
+
# @option search_options [String] :order The order in which to sort the results.
|
33
|
+
# Valid values are asc or desc. The default value is asc.
|
34
|
+
# @!macro request_options
|
35
|
+
# @option options [Boolean] :validate_fields If set to true, this method will throw an exception if nay search
|
36
|
+
# option is invalid
|
37
|
+
#
|
38
|
+
# @!macro response
|
39
|
+
def search(search_options = {}, options = {})
|
40
|
+
validate_search_options search_options if options.include? :validate_fields
|
41
|
+
|
42
|
+
api_request "#{base_url(:community)}/cardbacks", default_options.merge(options).merge(search_options)
|
43
|
+
end
|
44
|
+
|
45
|
+
protected
|
46
|
+
|
47
|
+
def validate_search_options(search_options)
|
48
|
+
search_options.each do |field|
|
49
|
+
raise ArgumentError, "Unrecognized search option #{field}" unless VALID_SEARCH_OPTIONS.include? field
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def endpoint_setup
|
54
|
+
@endpoint = 'cardbacks'
|
55
|
+
@ttl = CACHE_TRIMESTER
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -6,6 +6,7 @@ module BlizzardApi
|
|
6
6
|
# This class allows access to Hearthstone card data
|
7
7
|
#
|
8
8
|
# @see https://develop.battle.net/documentation/api-reference/hearthstone-game-data-api
|
9
|
+
# @see https://develop.battle.net/documentation/hearthstone/guides/card-search
|
9
10
|
#
|
10
11
|
# You can get an instance of this class using the default region as follows:
|
11
12
|
# api_instance = BlizzardApi::Hearthstone.card
|
@@ -23,6 +24,7 @@ module BlizzardApi
|
|
23
24
|
minionType
|
24
25
|
keyword
|
25
26
|
textFilter
|
27
|
+
gameMode
|
26
28
|
page
|
27
29
|
pageSize
|
28
30
|
sort
|
@@ -55,6 +57,8 @@ module BlizzardApi
|
|
55
57
|
# and so on). This value must match the keyword slugs found in metadata.
|
56
58
|
# @option search_options [String] :textFilter A text string used to filter cards.
|
57
59
|
# You must include a locale along with the textFilter parameter.
|
60
|
+
# @option search_options [String] :gameMode A recognized game mode (for example, battlegrounds or constructed).
|
61
|
+
# The default value is constructed. See the Game Modes Guide for more information.
|
58
62
|
# @option search_options [Integer] :page A page number.
|
59
63
|
# @option search_options [Integer] :pageSize The number of results to choose per page.
|
60
64
|
# A value will be selected automatically if you do not supply a pageSize or if the pageSize is higher than the
|
@@ -74,6 +78,22 @@ module BlizzardApi
|
|
74
78
|
api_request "#{base_url(:community)}/cards", default_options.merge(options).merge(search_options)
|
75
79
|
end
|
76
80
|
|
81
|
+
##
|
82
|
+
# Returns the card with an ID or slug that matches the one you specify. For more information, see the Card Search Guide.
|
83
|
+
#
|
84
|
+
# @see https://develop.battle.net/documentation/hearthstone/guides/card-search
|
85
|
+
# @see https://develop.battle.net/documentation/hearthstone/guides/game-modes
|
86
|
+
#
|
87
|
+
# @param id_or_slug [String] Card ID or slug
|
88
|
+
# @param game_mode [String] A recognized game mode (for example, battlegrounds or constructed).
|
89
|
+
# The default value is constructed. See the Game Modes Guide for more information.
|
90
|
+
# @!macro request_options
|
91
|
+
#
|
92
|
+
# @!macro response
|
93
|
+
def get(id_or_slug, game_mode = 'constructed', options = {})
|
94
|
+
super id_or_slug, { gameMode: game_mode }.merge(options)
|
95
|
+
end
|
96
|
+
|
77
97
|
protected
|
78
98
|
|
79
99
|
def validate_search_options(search_options)
|
@@ -6,6 +6,7 @@ module BlizzardApi
|
|
6
6
|
# This class allows access to Hearthstone deck data
|
7
7
|
#
|
8
8
|
# @see https://develop.battle.net/documentation/api-reference/hearthstone-game-data-api
|
9
|
+
# @see https://develop.battle.net/documentation/hearthstone/guides/decks
|
9
10
|
#
|
10
11
|
# You can get an instance of this class using the default region as follows:
|
11
12
|
# api_instance = BlizzardApi::Hearthstone.deck
|
@@ -27,7 +27,7 @@ module BlizzardApi
|
|
27
27
|
##
|
28
28
|
# Fetch all possible data for one of items listed by the {#index} using its *id*
|
29
29
|
#
|
30
|
-
# @param [Integer] id One of the IDs returned by the {#index}
|
30
|
+
# @param [Integer|String] id One of the IDs returned by the {#index}
|
31
31
|
# @!macro request_options
|
32
32
|
#
|
33
33
|
# @!macro response
|
@@ -6,6 +6,7 @@ module BlizzardApi
|
|
6
6
|
# This class allows access to Hearthstone metadata data
|
7
7
|
#
|
8
8
|
# @see https://develop.battle.net/documentation/api-reference/hearthstone-game-data-api
|
9
|
+
# https://develop.battle.net/documentation/hearthstone/guides/metadata
|
9
10
|
#
|
10
11
|
# You can get an instance of this class using the default region as follows:
|
11
12
|
# api_instance = BlizzardApi::Hearthstone.metadata
|
data/lib/blizzard_api/version.rb
CHANGED
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.3.
|
4
|
+
version: 0.3.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: 2020-01-
|
11
|
+
date: 2020-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -108,6 +108,7 @@ files:
|
|
108
108
|
- lib/blizzard_api/diablo/request.rb
|
109
109
|
- lib/blizzard_api/exception.rb
|
110
110
|
- lib/blizzard_api/hearthstone.rb
|
111
|
+
- lib/blizzard_api/hearthstone/game_data/back.rb
|
111
112
|
- lib/blizzard_api/hearthstone/game_data/card.rb
|
112
113
|
- lib/blizzard_api/hearthstone/game_data/deck.rb
|
113
114
|
- lib/blizzard_api/hearthstone/game_data/generic_data_endpoint.rb
|