blizzard_api 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f04ee3226793f53388335a8ab735f6b3bc682babd278a4ff17ddfd061eda809
4
- data.tar.gz: 8105bf3473bcef5a5faf3bf185f5f2a441a3fbe517c1c9d9353cd38ea573de19
3
+ metadata.gz: 5a7115f7058b188e0130c206c24aad91ee0ffccfb1b5af117c7df1e1ad057576
4
+ data.tar.gz: 5673b1e4e632d76244c8315a217b9a4ee6a55555159bc0fbcf134a09d7a191e1
5
5
  SHA512:
6
- metadata.gz: 307437b03cfd6e05dcdeb709450cbcfc3262e9b96ec334a6ee83f0e5617b9b4c518267b39da28d4fd37581a0d22af555054a0936d20e991473c8ec2b31d4dd43
7
- data.tar.gz: 52ef45f2f7b93ef17a848ffc8b45559d3075d050fcd99de943cf3f3b6b0fe19157ffc33d77112abac3037c635258c55c474c72e57295490e6cbaad1a8541f7c7
6
+ metadata.gz: f779ae48590fe9fe5ecae0ab0004528a9600390c0f6862da2f52a9fd8f2c31351fa6945adfe5ee67a52df14437dee3d1da1e5a0df8bb5b6b6db1c402521ba2ec
7
+ data.tar.gz: 307e0b9549d87b2fee99c832854398948a37cf414acc8103b8e733532e1d4faab7f94c870e67959e42bea941d42c3f4a9435d92542becaac8d10b934a81d53e6
@@ -1,5 +1,11 @@
1
1
  Please view this file on the master branch, otherwise it may be outdated
2
2
 
3
+ **Version 0.3.5**
4
+
5
+ Fixed a bug for generating slugs for Korean
6
+
7
+ Removed deprecated WoW community endpoints.
8
+
3
9
  **Version 0.3.4**
4
10
 
5
11
  Fixed account endpoints
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- blizzard_api (0.3.2)
4
+ blizzard_api (0.3.5)
5
5
  redis (~> 4.1, >= 4.1.0)
6
6
 
7
7
  GEM
@@ -99,7 +99,7 @@ module BlizzardApi
99
99
  end
100
100
 
101
101
  def string_to_slug(string)
102
- string.downcase.strip.tr(' ', '-').gsub(/[^\w-]/, '')
102
+ CGI.escape(string.downcase.tr(' ', '-'))
103
103
  end
104
104
 
105
105
  def create_access_token
@@ -2,5 +2,5 @@
2
2
 
3
3
  module BlizzardApi
4
4
  # Gem version
5
- VERSION = '0.3.4'
5
+ VERSION = '0.3.5'
6
6
  end
@@ -204,13 +204,6 @@ module BlizzardApi
204
204
  BlizzardApi::Wow::WowToken.new
205
205
  end
206
206
 
207
- # Wow community api
208
- require_relative 'wow/community/boss'
209
- require_relative 'wow/community/challenge'
210
- require_relative 'wow/community/pvp'
211
- require_relative 'wow/community/recipe'
212
- require_relative 'wow/community/zone'
213
-
214
207
  ##
215
208
  # @return {Boss}
216
209
  def self.boss
@@ -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::Wow.mythic_keystone_affix
12
12
  class MythicKeystoneAffix < Wow::GenericDataEndpoint
13
-
14
13
  ##
15
14
  # Fetch media for one of the affixes listed by the {#index} using its *id*
16
15
  #
@@ -5,7 +5,7 @@ module BlizzardApi
5
5
  ##
6
6
  # This class allows access to World of Warcraft pet data
7
7
  #
8
- # @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
8
+ # @see https://develop.battle.net/documentation/world-of-warcraft/game-data-apis
9
9
  #
10
10
  # You can get an instance of this class using the default region as follows:
11
11
  # api_instance = BlizzardApi::Wow.pet
@@ -10,19 +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::Wow.realm
12
12
  class Realm < Wow::GenericDataEndpoint
13
- ##
14
- # This method is actually located at the community scope, but included here because of its relevance
15
- # @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
16
- #
17
- # @param realms [Array<String>] An optional list of realm-slugs to filter results
18
- # @!macro request_options
19
- #
20
- # @!macro response
21
- def status(realms = [], options = {})
22
- options[:realms] = realms.map(&:string_to_slug).join(',') if realms.count.positive?
23
- api_request "#{base_url(:community)}/realm/status", { ttl: CACHE_MINUTE }.merge(options)
24
- end
25
-
26
13
  protected
27
14
 
28
15
  def endpoint_setup
@@ -10,19 +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::Wow.region
12
12
  class Region < Wow::GenericDataEndpoint
13
- ##
14
- # Returns data about region battlegroups
15
- #
16
- # This method is actually located at the community API, but it is included here due to its relevance.
17
- # @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
18
- #
19
- # @!macro request_options
20
- #
21
- # @!macro response
22
- def battlegroups(options = {})
23
- api_request "#{base_url(:community)}/data/battlegroups/", { ttl: CACHE_TRIMESTER }.merge(options)
24
- end
25
-
26
13
  protected
27
14
 
28
15
  def endpoint_setup
@@ -10,21 +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::Wow.achievement
12
12
  class CharacterProfile < Wow::Request
13
- ##
14
- # Return a list containing all WoW characters of a BNet account
15
- #
16
- # @note This endpoint requires a user token obtained through the user authorization flow
17
- # @see https://develop.battle.net/documentation/guides/using-oauth/authorization-code-flow
18
- #
19
- # @param user_token [String] A token obtained by the authorization flow. See link below.
20
- # @!macro request_options
21
- #
22
- # @!macro response
23
- def get_user_characters(user_token, options = {})
24
- opts = { ttl: CACHE_HOUR, access_token: user_token }.merge(options)
25
- api_request "#{base_url(:community)}/user/characters", opts
26
- end
27
-
28
13
  ##
29
14
  # Return character achievements
30
15
  #
@@ -361,7 +346,7 @@ module BlizzardApi
361
346
  end
362
347
 
363
348
  def character_request(realm, character, options = {}, variant = nil)
364
- uri = "#{base_url(:profile)}/character/#{CGI.escape(realm.downcase)}/#{CGI.escape(character.downcase)}"
349
+ uri = "#{base_url(:profile)}/character/#{string_to_slug(realm)}/#{string_to_slug(character)}"
365
350
  uri += "/#{variant}" if variant
366
351
  api_request uri, default_options.merge(options)
367
352
  end
@@ -10,26 +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::Wow.guild
12
12
  class Guild < Wow::Request
13
- ##
14
- # Return a list with all possible rewards.
15
- #
16
- # @!macro request_options
17
- #
18
- # @!macro response
19
- def rewards(options = {})
20
- api_request "#{base_url(:community)}/data/guild/rewards", { ttl: CACHE_TRIMESTER }.merge(options)
21
- end
22
-
23
- ##
24
- # Return a list with all possible perks
25
- #
26
- # @!macro request_options
27
- #
28
- # @!macro response
29
- def perks(options = {})
30
- api_request "#{base_url(:community)}/data/guild/perks", { ttl: CACHE_TRIMESTER }.merge(options)
31
- end
32
-
33
13
  ##
34
14
  # Return data about the specified guild
35
15
  #
@@ -82,8 +62,8 @@ module BlizzardApi
82
62
  private
83
63
 
84
64
  def guild_request(realm, guild, options = {}, variant = nil)
85
- realm = CGI.escape string_to_slug(realm)
86
- guild = CGI.escape string_to_slug(guild)
65
+ realm = string_to_slug(realm)
66
+ guild = string_to_slug(guild)
87
67
  url = "#{base_url(:game_data)}/guild/#{realm}/#{guild}"
88
68
  url += "/#{variant}" if variant
89
69
  api_request url, { ttl: CACHE_DAY, namespace: :profile }.merge(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.3.4
4
+ version: 0.3.5
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-03-05 00:00:00.000000000 Z
11
+ date: 2020-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -117,11 +117,6 @@ files:
117
117
  - lib/blizzard_api/request.rb
118
118
  - lib/blizzard_api/version.rb
119
119
  - lib/blizzard_api/wow.rb
120
- - lib/blizzard_api/wow/community/boss.rb
121
- - lib/blizzard_api/wow/community/challenge.rb
122
- - lib/blizzard_api/wow/community/pvp.rb
123
- - lib/blizzard_api/wow/community/recipe.rb
124
- - lib/blizzard_api/wow/community/zone.rb
125
120
  - lib/blizzard_api/wow/game_data/achievement.rb
126
121
  - lib/blizzard_api/wow/game_data/auction.rb
127
122
  - lib/blizzard_api/wow/game_data/azerite_essence.rb
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module BlizzardApi
4
- module Wow
5
- ##
6
- # This class allows access to World of Warcraft bosses
7
- #
8
- # @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
9
- #
10
- # @deprecated See https://us.forums.blizzard.com/en/blizzard/t/world-of-warcraft-community-api-migration/767
11
- #
12
- # You can get an instance of this class using the default region as follows:
13
- # api_instance = BlizzardApi::Wow.boss
14
- class Boss < Wow::Request
15
- ##
16
- # Return a list of every World of Warcraft boss currently in game
17
- #
18
- # @!macro request_options
19
- #
20
- # @!macro response
21
- def index(options = {})
22
- api_request "#{base_url(:community)}/boss/", { ttl: CACHE_TRIMESTER }.merge(options)
23
- end
24
-
25
- ##
26
- # Return detailed information about a boss by its ID
27
- #
28
- # @param id [Integer] Boss id
29
- # @!macro request_options
30
- #
31
- # @!macro response
32
- def get(id, options = {})
33
- api_request "#{base_url(:community)}/boss/#{id}", { ttl: CACHE_TRIMESTER }.merge(options)
34
- end
35
- end
36
- end
37
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module BlizzardApi
4
- module Wow
5
- ##
6
- # This class allows access to World of Warcraft challenges
7
- #
8
- # @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
9
- #
10
- # @deprecated See https://us.forums.blizzard.com/en/blizzard/t/world-of-warcraft-community-api-migration/767
11
- #
12
- # You can get an instance of this class using the default region as follows:
13
- # api_instance = BlizzardApi::Wow.challenge
14
- class Challenge < Wow::Request
15
- ##
16
- # Most recent challenge leaderboard for the specified realm
17
- #
18
- # @param name [String] Realm's slug
19
- # @!macro request_options
20
- #
21
- # @!macro response
22
- def realm_index(name, options = {})
23
- api_request "#{base_url(:community)}/challenge/#{name}", { ttl: CACHE_HOUR }.merge(options)
24
- end
25
-
26
- ##
27
- # Most recent challenge leaderboard for the entire region
28
- #
29
- # @!macro request_options
30
- #
31
- # @!macro response
32
- def region_index(options = {})
33
- api_request "#{base_url(:community)}/challenge/region", { ttl: CACHE_HOUR }.merge(options)
34
- end
35
- end
36
- end
37
- end
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module BlizzardApi
4
- module Wow
5
- ##
6
- # This class allows access to World of Warcraft PvP data
7
- #
8
- # @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
9
- #
10
- # @deprecated See https://us.forums.blizzard.com/en/blizzard/t/world-of-warcraft-community-api-migration/767
11
- #
12
- # You can get an instance of this class using the default region as follows:
13
- # api_instance = BlizzardApi::Wow.pvp
14
- class PvP < Wow::Request
15
- # Arena 2v2
16
- BRACKET_2V2 = '2v2'
17
- # Arena 3x3
18
- BRACKET_3V3 = '3v3'
19
- # Arena 5x5
20
- BRACKET_5V5 = '5v5'
21
- # Rated battlegrounds
22
- BRACKET_RBG = 'rbg'
23
-
24
- ##
25
- # Returns the current pvp leaderboard for the current region
26
- #
27
- # @param bracket [String] PvP leaderboard category. You can use the constants BRACKET_*
28
- # @!macro request_options
29
- #
30
- # @!macro response
31
- def get(bracket, options = {})
32
- api_request "#{base_url(:community)}/leaderboard/#{bracket}", { ttl: CACHE_DAY }.merge(options)
33
- end
34
- end
35
- end
36
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module BlizzardApi
4
- module Wow
5
- ##
6
- # This class allows access to World of Warcraft recipe data
7
- #
8
- # @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
9
- #
10
- # @deprecated See https://us.forums.blizzard.com/en/blizzard/t/world-of-warcraft-community-api-migration/767
11
- #
12
- # You can get an instance of this class using the default region as follows:
13
- # api_instance = BlizzardApi::Wow.recipe
14
- class Recipe < Wow::Request
15
- ##
16
- # Return information about a recipe by its id
17
- #
18
- # @param id [Integer] Recipe id
19
- # @!macro request_options
20
- #
21
- # @!macro response
22
- def get(id, options = {})
23
- api_request "#{base_url(:community)}/recipe/#{id}", { ttl: CACHE_TRIMESTER }.merge(options)
24
- end
25
- end
26
- end
27
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module BlizzardApi
4
- module Wow
5
- ##
6
- # This class allows access to World of Warcraft zone data
7
- #
8
- # @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
9
- #
10
- # @deprecated See https://us.forums.blizzard.com/en/blizzard/t/world-of-warcraft-community-api-migration/767
11
- #
12
- # You can get an instance of this class using the default region as follows:
13
- # api_instance = BlizzardApi::Wow.zone
14
- class Zone < Wow::Request
15
- ##
16
- # Return a list of all zones
17
- #
18
- # @!macro request_options
19
- #
20
- # @!macro response
21
- def index(options = {})
22
- api_request "#{base_url(:community)}/zone/", { ttl: CACHE_TRIMESTER }.merge(options)
23
- end
24
-
25
- ##
26
- # Return complete information about a zone by its id
27
- #
28
- # @param id [Integer] Zone id
29
- # @!macro request_options
30
- #
31
- # @!macro response
32
- def get(id, options = {})
33
- api_request "#{base_url(:community)}/zone/#{id}", { ttl: CACHE_TRIMESTER }.merge(options)
34
- end
35
- end
36
- end
37
- end