blizzard_api 0.6.3 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -0
  3. data/Gemfile.lock +12 -14
  4. data/blizzard_api.gemspec +0 -1
  5. data/lib/blizzard_api/api_response.rb +24 -0
  6. data/lib/blizzard_api/api_standards.rb +55 -0
  7. data/lib/blizzard_api/configuration.rb +20 -17
  8. data/lib/blizzard_api/diablo/game_data/generic_data_endpoint.rb +2 -2
  9. data/lib/blizzard_api/diablo/request.rb +3 -3
  10. data/lib/blizzard_api/diablo.rb +33 -27
  11. data/lib/blizzard_api/hearthstone/game_data/generic_data_endpoint.rb +2 -2
  12. data/lib/blizzard_api/hearthstone/request.rb +3 -3
  13. data/lib/blizzard_api/hearthstone.rb +18 -12
  14. data/lib/blizzard_api/request.rb +45 -83
  15. data/lib/blizzard_api/starcraft/community/legacy.rb +6 -6
  16. data/lib/blizzard_api/starcraft/request.rb +3 -3
  17. data/lib/blizzard_api/starcraft.rb +20 -14
  18. data/lib/blizzard_api/token_manager.rb +49 -0
  19. data/lib/blizzard_api/version.rb +1 -1
  20. data/lib/blizzard_api/wow/game_data/achievement.rb +1 -16
  21. data/lib/blizzard_api/wow/game_data/azerite_essence.rb +2 -9
  22. data/lib/blizzard_api/wow/game_data/connected_realm.rb +1 -8
  23. data/lib/blizzard_api/wow/game_data/covenant.rb +2 -9
  24. data/lib/blizzard_api/wow/game_data/creature.rb +2 -13
  25. data/lib/blizzard_api/wow/game_data/generic_data_endpoint.rb +10 -37
  26. data/lib/blizzard_api/wow/game_data/guild_crest.rb +4 -10
  27. data/lib/blizzard_api/wow/game_data/item.rb +3 -18
  28. data/lib/blizzard_api/wow/game_data/journal.rb +2 -17
  29. data/lib/blizzard_api/wow/game_data/media.rb +2 -13
  30. data/lib/blizzard_api/wow/game_data/modified_crafting.rb +1 -12
  31. data/lib/blizzard_api/wow/game_data/mount.rb +1 -8
  32. data/lib/blizzard_api/wow/game_data/mythic_keystone.rb +2 -13
  33. data/lib/blizzard_api/wow/game_data/mythic_keystone_affix.rb +2 -9
  34. data/lib/blizzard_api/wow/game_data/pet.rb +2 -9
  35. data/lib/blizzard_api/wow/game_data/playable_class.rb +2 -48
  36. data/lib/blizzard_api/wow/game_data/playable_race.rb +1 -8
  37. data/lib/blizzard_api/wow/game_data/playable_specialization.rb +1 -18
  38. data/lib/blizzard_api/wow/game_data/power_type.rb +1 -8
  39. data/lib/blizzard_api/wow/game_data/profession.rb +2 -9
  40. data/lib/blizzard_api/wow/game_data/pvp_region.rb +82 -0
  41. data/lib/blizzard_api/wow/game_data/pvp_season.rb +7 -9
  42. data/lib/blizzard_api/wow/game_data/pvp_tier.rb +3 -10
  43. data/lib/blizzard_api/wow/game_data/quest.rb +2 -9
  44. data/lib/blizzard_api/wow/game_data/realm.rb +1 -8
  45. data/lib/blizzard_api/wow/game_data/region.rb +1 -8
  46. data/lib/blizzard_api/wow/game_data/reputation.rb +2 -9
  47. data/lib/blizzard_api/wow/game_data/spell.rb +2 -17
  48. data/lib/blizzard_api/wow/game_data/talent.rb +2 -9
  49. data/lib/blizzard_api/wow/game_data/tech_talent.rb +2 -9
  50. data/lib/blizzard_api/wow/game_data/title.rb +1 -16
  51. data/lib/blizzard_api/wow/profile/profile.rb +2 -2
  52. data/lib/blizzard_api/wow/request.rb +3 -3
  53. data/lib/blizzard_api/wow.rb +122 -108
  54. data/lib/blizzard_api.rb +10 -0
  55. metadata +6 -16
@@ -12,6 +12,8 @@ module BlizzardApi
12
12
  class Item < Wow::GenericDataEndpoint
13
13
  include BlizzardApi::Wow::Searchable
14
14
 
15
+ setup 'item', :static, CACHE_TRIMESTER
16
+
15
17
  ##
16
18
  # This method overrides the inherited default behavior to prevent high server load and fetch time
17
19
  #
@@ -20,14 +22,6 @@ module BlizzardApi
20
22
  raise BlizzardApi::ApiException, 'This endpoint does not have a index method'
21
23
  end
22
24
 
23
- ##
24
- # This method overrides the inherited default behavior to prevent high server load and fetch time
25
- #
26
- # @!macro response
27
- def complete
28
- raise BlizzardApi::ApiException, 'This endpoint does not have a complete method'
29
- end
30
-
31
25
  ##
32
26
  # Return a list of item classes
33
27
  #
@@ -49,7 +43,7 @@ module BlizzardApi
49
43
  # @option options [Boolean] :classic1x If set to true, this method will call the classic era version
50
44
  #
51
45
  # @!macro response
52
- def class(id, **options)
46
+ def item_class(id, **options)
53
47
  api_request "#{endpoint_uri('class')}/#{id}", **default_options.merge(options)
54
48
  end
55
49
 
@@ -101,15 +95,6 @@ module BlizzardApi
101
95
  def set(id, **options)
102
96
  api_request "#{endpoint_uri('set')}/#{id}", **default_options.merge(options)
103
97
  end
104
-
105
- protected
106
-
107
- def endpoint_setup
108
- @endpoint = 'item'
109
- @namespace = :static
110
- @collection = 'items'
111
- @ttl = CACHE_TRIMESTER
112
- end
113
98
  end
114
99
  end
115
100
  end
@@ -10,6 +10,8 @@ module BlizzardApi
10
10
  # You can get an instance of this class using the default region as follows:
11
11
  # api_instance = BlizzardApi::Wow.journal
12
12
  class Journal < Wow::GenericDataEndpoint
13
+ setup 'journal', :static, CACHE_TRIMESTER
14
+
13
15
  ##
14
16
  # This method overrides the inherited default behavior to prevent high server load and fetch time
15
17
  #
@@ -18,14 +20,6 @@ module BlizzardApi
18
20
  raise BlizzardApi::ApiException, 'This endpoint does not have a index method'
19
21
  end
20
22
 
21
- ##
22
- # This method overrides the inherited default behavior to prevent high server load and fetch time
23
- #
24
- # @!macro response
25
- def complete
26
- raise BlizzardApi::ApiException, 'This endpoint does not have a complete method'
27
- end
28
-
29
23
  ##
30
24
  # This method overrides the inherited default behavior to prevent high server load and fetch time
31
25
  #
@@ -111,15 +105,6 @@ module BlizzardApi
111
105
 
112
106
  api_request "#{endpoint_uri('encounter', :search)}?#{search_options.to_search_query}", **default_options.merge(options)
113
107
  end
114
-
115
- protected
116
-
117
- def endpoint_setup
118
- @endpoint = 'journal'
119
- @namespace = :static
120
- @collection = 'journals'
121
- @ttl = CACHE_TRIMESTER
122
- end
123
108
  end
124
109
  end
125
110
  end
@@ -12,6 +12,8 @@ module BlizzardApi
12
12
  class Media < Wow::GenericDataEndpoint
13
13
  include BlizzardApi::Wow::Searchable
14
14
 
15
+ setup 'media', :static, CACHE_TRIMESTER
16
+
15
17
  def index(_options = nil)
16
18
  raise BlizzardApi::ApiException, 'This endpoint does not have a index method'
17
19
  end
@@ -19,19 +21,6 @@ module BlizzardApi
19
21
  def get(_options = nil)
20
22
  raise BlizzardApi::ApiException, 'This endpoint does not have a get method'
21
23
  end
22
-
23
- def complete(_options = nil)
24
- raise BlizzardApi::ApiException, 'This endpoint does not have a complete method'
25
- end
26
-
27
- protected
28
-
29
- def endpoint_setup
30
- @endpoint = 'media'
31
- @namespace = :static
32
- @collection = 'medias'
33
- @ttl = CACHE_TRIMESTER
34
- end
35
24
  end
36
25
  end
37
26
  end
@@ -10,9 +10,7 @@ module BlizzardApi
10
10
  # You can get an instance of this class using the default region as follows:
11
11
  # api_instance = BlizzardApi::Wow.modified_crafting
12
12
  class ModifiedCrafting < Wow::GenericDataEndpoint
13
- def complete
14
- raise BlizzardApi::ApiException, 'This endpoint does not have a complete method.'
15
- end
13
+ setup 'modified-crafting', :static, CACHE_TRIMESTER
16
14
 
17
15
  ##
18
16
  # Fetch modified crafting category index
@@ -53,15 +51,6 @@ module BlizzardApi
53
51
  def slot_type(id, **options)
54
52
  api_request "#{base_url(:game_data)}/modified-crafting/reagent-slot-type/#{id}", **default_options.merge(options)
55
53
  end
56
-
57
- protected
58
-
59
- def endpoint_setup
60
- @endpoint = 'modified-crafting'
61
- @namespace = :static
62
- @collection = 'professions'
63
- @ttl = CACHE_TRIMESTER
64
- end
65
54
  end
66
55
  end
67
56
  end
@@ -12,14 +12,7 @@ module BlizzardApi
12
12
  class Mount < Wow::GenericDataEndpoint
13
13
  include BlizzardApi::Wow::Searchable
14
14
 
15
- protected
16
-
17
- def endpoint_setup
18
- @endpoint = 'mount'
19
- @namespace = :static
20
- @collection = 'mounts'
21
- @ttl = CACHE_TRIMESTER
22
- end
15
+ setup 'mount', :static, CACHE_TRIMESTER
23
16
  end
24
17
  end
25
18
  end
@@ -10,14 +10,12 @@ 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
12
12
  class MythicKeystone < Wow::GenericDataEndpoint
13
+ setup 'mythic-keystone', :dynamic, CACHE_TRIMESTER
14
+
13
15
  def get
14
16
  raise BlizzardApi::ApiException, 'Mythic keystone endpoint does not have a get method'
15
17
  end
16
18
 
17
- def complete
18
- raise BlizzardApi::ApiException, 'There are too many creatures to fetch complete data'
19
- end
20
-
21
19
  ##
22
20
  # Fetch all mythic keystone dungeons
23
21
  #
@@ -83,15 +81,6 @@ module BlizzardApi
83
81
  def season(id, **options)
84
82
  api_request "#{endpoint_uri}/season/#{id}", **default_options.merge(options)
85
83
  end
86
-
87
- protected
88
-
89
- def endpoint_setup
90
- @endpoint = 'mythic-keystone'
91
- @namespace = :dynamic
92
- @collection = 'mythic-keystones'
93
- @ttl = CACHE_TRIMESTER
94
- end
95
84
  end
96
85
  end
97
86
  end
@@ -10,6 +10,8 @@ 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
+ setup 'keystone-affix', :static, CACHE_TRIMESTER
14
+
13
15
  ##
14
16
  # Fetch media for one of the affixes listed by the {#index} using its *id*
15
17
  #
@@ -21,15 +23,6 @@ module BlizzardApi
21
23
  def media(id, **options)
22
24
  api_request "#{base_url(:media)}/keystone-affix/#{id}", **default_options.merge(options)
23
25
  end
24
-
25
- protected
26
-
27
- def endpoint_setup
28
- @endpoint = 'keystone-affix'
29
- @namespace = :static
30
- @collection = 'affixes'
31
- @ttl = CACHE_TRIMESTER
32
- end
33
26
  end
34
27
  end
35
28
  end
@@ -10,6 +10,8 @@ module BlizzardApi
10
10
  # You can get an instance of this class using the default region as follows:
11
11
  # api_instance = BlizzardApi::Wow.pet
12
12
  class Pet < Wow::GenericDataEndpoint
13
+ setup 'pet', :static, CACHE_TRIMESTER
14
+
13
15
  ##
14
16
  # Fetch media for one of the pets listed by the {#index} using its *id*
15
17
  #
@@ -55,15 +57,6 @@ module BlizzardApi
55
57
  def ability_media(id, **options)
56
58
  api_request "#{base_url(:media)}/pet-ability/#{id}", **default_options.merge(options)
57
59
  end
58
-
59
- protected
60
-
61
- def endpoint_setup
62
- @endpoint = 'pet'
63
- @namespace = :static
64
- @collection = 'pets'
65
- @ttl = CACHE_TRIMESTER
66
- end
67
60
  end
68
61
  end
69
62
  end
@@ -10,6 +10,8 @@ module BlizzardApi
10
10
  # You can get an instance of this class using the default region as follows:
11
11
  # api_instance = BlizzardApi::Wow.playable_class
12
12
  class PlayableClass < Wow::GenericDataEndpoint
13
+ setup 'playable-class', :static, CACHE_TRIMESTER
14
+
13
15
  ##
14
16
  # Returns the PvP talent slots data of a specific class
15
17
  #
@@ -21,38 +23,6 @@ module BlizzardApi
21
23
  api_request "#{endpoint_uri}/#{id}/pvp-talent-slots", **default_options.merge(options)
22
24
  end
23
25
 
24
- ##
25
- # @!macro complete
26
- #
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
29
- def complete(**options)
30
- index_data = index(**options)
31
- [].tap do |classes|
32
- index_data[:classes].each do |pclass|
33
- class_id = %r{playable-class/([0-9]+)}.match(pclass[:key].to_s)[1]
34
- class_data = get class_id, **options
35
- classes.push class_data
36
- end
37
- end
38
- end
39
-
40
- ##
41
- # Return playable class data by its id
42
- #
43
- # @param id [Integer] Playable class id
44
- #
45
- # @!macro request_options
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
48
- #
49
- # @!macro response
50
- def get(id, **options)
51
- data = api_request "#{endpoint_uri}/#{id}", **default_options.merge(options)
52
- data[:icon] = get_class_icon data[:media], **options
53
- data
54
- end
55
-
56
26
  ##
57
27
  # Fetch media for one of the playable classes listed by the {#index} using its *id*
58
28
  #
@@ -64,22 +34,6 @@ module BlizzardApi
64
34
  def media(id, **options)
65
35
  api_request "#{base_url(:media)}/playable-class/#{id}", **default_options.merge(options)
66
36
  end
67
-
68
- protected
69
-
70
- def endpoint_setup
71
- @endpoint = 'playable-class'
72
- @namespace = :static
73
- @collection = 'classes'
74
- @ttl = CACHE_TRIMESTER
75
- end
76
-
77
- def get_class_icon(media_url, **options)
78
- return if options.include? :classic
79
-
80
- media_data = request media_url[:key][:href], **options
81
- %r{56/([a-z_]+).jpg}.match(media_data[:assets][0][:value].to_s)[1]
82
- end
83
37
  end
84
38
  end
85
39
  end
@@ -10,14 +10,7 @@ module BlizzardApi
10
10
  # You can get an instance of this class using the default region as follows:
11
11
  # race = BlizzardApi::Wow.playable_race
12
12
  class PlayableRace < Wow::GenericDataEndpoint
13
- protected
14
-
15
- def endpoint_setup
16
- @endpoint = 'playable-race'
17
- @namespace = :static
18
- @collection = 'races'
19
- @ttl = CACHE_TRIMESTER
20
- end
13
+ setup 'playable-race', :static, CACHE_TRIMESTER
21
14
  end
22
15
  end
23
16
  end
@@ -10,15 +10,7 @@ module BlizzardApi
10
10
  # You can get an instance of this class using the default region as follows:
11
11
  # spec = BlizzardApi::Wow.playable_specialization
12
12
  class PlayableSpecialization < Wow::GenericDataEndpoint
13
- ##
14
- # @!macro complete
15
- def complete(**options)
16
- index_data = index(**options)
17
- {}.tap do |response_data|
18
- response_data[:character_specializations] = character_data(index_data, options)
19
- response_data[:pet_specializations] = pet_data(index_data, options)
20
- end
21
- end
13
+ setup 'playable-specialization', :static, CACHE_TRIMESTER
22
14
 
23
15
  ##
24
16
  # Fetch media for one of the playable specializations listed by the {#index} using its *id*
@@ -32,15 +24,6 @@ module BlizzardApi
32
24
  api_request "#{base_url(:media)}/playable-specialization/#{id}", **default_options.merge(options)
33
25
  end
34
26
 
35
- protected
36
-
37
- def endpoint_setup
38
- @endpoint = 'playable-specialization'
39
- @namespace = :static
40
- @collection = 'playable_specialization'
41
- @ttl = CACHE_TRIMESTER
42
- end
43
-
44
27
  private
45
28
 
46
29
  def character_data(index_data, options)
@@ -10,14 +10,7 @@ module BlizzardApi
10
10
  # You can get an instance of this class using the default region as follows:
11
11
  # api_instance = BlizzardApi::Wow.power_type
12
12
  class PowerType < Wow::GenericDataEndpoint
13
- protected
14
-
15
- def endpoint_setup
16
- @endpoint = 'power-type'
17
- @namespace = :static
18
- @collection = 'power_types'
19
- @ttl = CACHE_TRIMESTER
20
- end
13
+ setup 'power-type', :static, CACHE_TRIMESTER
21
14
  end
22
15
  end
23
16
  end
@@ -10,6 +10,8 @@ module BlizzardApi
10
10
  # You can get an instance of this class using the default region as follows:
11
11
  # api_instance = BlizzardApi::Wow.profession
12
12
  class Profession < Wow::GenericDataEndpoint
13
+ setup 'profession', :static, CACHE_TRIMESTER
14
+
13
15
  ##
14
16
  # Fetch media for a profession using its *id*
15
17
  #
@@ -58,15 +60,6 @@ module BlizzardApi
58
60
  def recipe_media(id, **options)
59
61
  api_request "#{base_url(:media)}/recipe/#{id}", **default_options.merge(options)
60
62
  end
61
-
62
- protected
63
-
64
- def endpoint_setup
65
- @endpoint = 'profession'
66
- @namespace = :static
67
- @collection = 'professions'
68
- @ttl = CACHE_TRIMESTER
69
- end
70
63
  end
71
64
  end
72
65
  end
@@ -0,0 +1,82 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BlizzardApi
4
+ module Wow
5
+ ##
6
+ # This class allows access to World of Warcraft PvP seasons
7
+ #
8
+ # @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-game-data-api
9
+ #
10
+ # You can get an instance of this class using the default region as follows:
11
+ # api_instance = BlizzardApi::Wow.pvp_season
12
+ class PvpRegion < Wow::GenericDataEndpoint
13
+ setup 'pvp-region', :dynamic, CACHE_TRIMESTER
14
+
15
+ ##
16
+ # Returns a index of pvp seasons within the region
17
+ #
18
+ # @param [Integer] region_id Region ID
19
+ #
20
+ # @!macro request_options
21
+ # @option options [Boolean] :classic1x If set to true, this method will call the classic era version
22
+ #
23
+ # @!macro response
24
+ def seasons(region_id, **options)
25
+ api_request "#{endpoint_uri}/#{region_id}/pvp-season/index", **default_options.merge(options)
26
+ end
27
+
28
+ ##
29
+ # Returns a index of pvp seasons within the region
30
+ #
31
+ # @param [Integer] region_id Region ID
32
+ # @param [Integer] season_id Season ID
33
+ #
34
+ # @!macro request_options
35
+ # @option options [Boolean] :classic1x If set to true, this method will call the classic era version
36
+ #
37
+ # @!macro response
38
+ def season(region_id, season_id, **options)
39
+ api_request "#{endpoint_uri}/#{region_id}/pvp-season/#{season_id}", **default_options.merge(options)
40
+ end
41
+
42
+ ##
43
+ # Returns a index of pvp leaderboard for a season
44
+ #
45
+ # @param [Integer] region_id Region ID
46
+ # @param [Integer] season_id Season ID
47
+ #
48
+ # @!macro request_options
49
+ # @option options [Boolean] :classic1x If set to true, this method will call the classic era version
50
+ #
51
+ # @!macro response
52
+ def leaderboards(region_id, season_id, **options)
53
+ api_request "#{endpoint_uri}/#{region_id}/pvp-season/#{season_id}/pvp-leaderboard/index", **default_options.merge(options)
54
+ end
55
+
56
+ ##
57
+ # Returns the leaderboard for a given season and bracket
58
+ #
59
+ # @param [Integer] region_id Region ID
60
+ # @param [Integer] season_id Season ID
61
+ # @param [String] brackets Brackets
62
+ #
63
+ # @!macro request_options
64
+ # @option options [Boolean] :classic1x If set to true, this method will call the classic era version
65
+ #
66
+ # @!macro response
67
+ def leaderboard(region_id, season_id, brackets, **options)
68
+ api_request "#{endpoint_uri}/#{region_id}/pvp-season/#{season_id}/pvp-leaderboard/#{brackets}", **default_options.merge(options)
69
+ end
70
+
71
+ ##
72
+ # Returns a list of pvp rewards for a season
73
+ #
74
+ # @!macro request_options
75
+ #
76
+ # @!macro response
77
+ def rewards(region_id, season_id, **options)
78
+ api_request "#{endpoint_uri}/#{region_id}/pvp-season/#{season_id}/pvp-reward/index", **default_options.merge(options)
79
+ end
80
+ end
81
+ end
82
+ end
@@ -10,9 +10,13 @@ module BlizzardApi
10
10
  # You can get an instance of this class using the default region as follows:
11
11
  # api_instance = BlizzardApi::Wow.pvp_season
12
12
  class PvpSeason < Wow::GenericDataEndpoint
13
+ setup 'pvp-season', :dynamic, CACHE_TRIMESTER
14
+
13
15
  ##
14
16
  # Returns a index of pvp leaderboard for a season
15
17
  #
18
+ # @param [Integer] season_id Season ID
19
+ #
16
20
  # @!macro request_options
17
21
  # @option options [Boolean] :classic1x If set to true, this method will call the classic era version
18
22
  #
@@ -24,6 +28,9 @@ module BlizzardApi
24
28
  ##
25
29
  # Returns the leaderboard for a given season and bracket
26
30
  #
31
+ # @param [Integer] season_id Season ID
32
+ # @param [String] brackets Brackets
33
+ #
27
34
  # @!macro request_options
28
35
  # @option options [Boolean] :classic1x If set to true, this method will call the classic era version
29
36
  #
@@ -41,15 +48,6 @@ module BlizzardApi
41
48
  def rewards(season_id, **options)
42
49
  api_request "#{endpoint_uri}/#{season_id}/pvp-reward/index", **default_options.merge(options)
43
50
  end
44
-
45
- protected
46
-
47
- def endpoint_setup
48
- @endpoint = 'pvp-season'
49
- @namespace = :dynamic
50
- @collection = 'power_types'
51
- @ttl = CACHE_TRIMESTER
52
- end
53
51
  end
54
52
  end
55
53
  end
@@ -10,6 +10,8 @@ module BlizzardApi
10
10
  # You can get an instance of this class using the default region as follows:
11
11
  # api_instance = BlizzardApi::Wow.pvp_tier
12
12
  class PvpTier < Wow::GenericDataEndpoint
13
+ setup 'pvp-tier', :static, CACHE_TRIMESTER
14
+
13
15
  ##
14
16
  # Returns media assets for a pvp tier
15
17
  #
@@ -17,16 +19,7 @@ module BlizzardApi
17
19
  #
18
20
  # @!macro response
19
21
  def tier_media(id, **options)
20
- api_request "#{base_url(:media)}/#{@endpoint}/#{id}", **default_options.merge(options)
21
- end
22
-
23
- protected
24
-
25
- def endpoint_setup
26
- @endpoint = 'pvp-tier'
27
- @namespace = :static
28
- @collection = 'tiers'
29
- @ttl = CACHE_TRIMESTER
22
+ api_request "#{base_url(:media)}/#{self.class.endpoint}/#{id}", **default_options.merge(options)
30
23
  end
31
24
  end
32
25
  end
@@ -10,6 +10,8 @@ module BlizzardApi
10
10
  # You can get an instance of this class using the default region as follows:
11
11
  # api_instance = BlizzardApi::Wow.quest
12
12
  class Quest < Wow::GenericDataEndpoint
13
+ setup 'quest', :static, CACHE_TRIMESTER
14
+
13
15
  ##
14
16
  # Return a list of quest categories
15
17
  #
@@ -72,15 +74,6 @@ module BlizzardApi
72
74
  def type(id, **options)
73
75
  api_request "#{endpoint_uri}/type/#{id}", **default_options.merge(options)
74
76
  end
75
-
76
- protected
77
-
78
- def endpoint_setup
79
- @endpoint = 'quest'
80
- @namespace = :static
81
- @collection = 'quests'
82
- @ttl = CACHE_TRIMESTER
83
- end
84
77
  end
85
78
  end
86
79
  end
@@ -12,14 +12,7 @@ module BlizzardApi
12
12
  class Realm < Wow::GenericDataEndpoint
13
13
  include BlizzardApi::Wow::Searchable
14
14
 
15
- protected
16
-
17
- def endpoint_setup
18
- @endpoint = 'realm'
19
- @namespace = :dynamic
20
- @collection = 'realms'
21
- @ttl = CACHE_TRIMESTER
22
- end
15
+ setup 'realm', :dynamic, CACHE_TRIMESTER
23
16
  end
24
17
  end
25
18
  end
@@ -10,14 +10,7 @@ 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
- protected
14
-
15
- def endpoint_setup
16
- @endpoint = 'region'
17
- @namespace = :dynamic
18
- @collection = 'regions'
19
- @ttl = CACHE_TRIMESTER
20
- end
13
+ setup 'region', :dynamic, CACHE_TRIMESTER
21
14
  end
22
15
  end
23
16
  end
@@ -10,6 +10,8 @@ module BlizzardApi
10
10
  # You can get an instance of this class using the default region as follows:
11
11
  # api_instance = BlizzardApi::Wow.reputation
12
12
  class Reputation < Wow::GenericDataEndpoint
13
+ setup 'reputation', :static, CACHE_TRIMESTER
14
+
13
15
  ##
14
16
  # This method overrides the inherited default behavior to prevent high server load and fetch time
15
17
  #
@@ -67,15 +69,6 @@ module BlizzardApi
67
69
  def tier(id, **options)
68
70
  api_request "#{endpoint_uri('tiers')}/#{id}", **default_options.merge(options)
69
71
  end
70
-
71
- protected
72
-
73
- def endpoint_setup
74
- @endpoint = 'reputation'
75
- @namespace = :static
76
- @collection = 'reputations'
77
- @ttl = CACHE_TRIMESTER
78
- end
79
72
  end
80
73
  end
81
74
  end
@@ -12,6 +12,8 @@ module BlizzardApi
12
12
  class Spell < Wow::GenericDataEndpoint
13
13
  include BlizzardApi::Wow::Searchable
14
14
 
15
+ setup 'spell', :static, CACHE_TRIMESTER
16
+
15
17
  ##
16
18
  # This method overrides the inherited default behavior to prevent high server load and fetch time
17
19
  #
@@ -20,14 +22,6 @@ module BlizzardApi
20
22
  raise BlizzardApi::ApiException, 'This endpoint does not have a index method'
21
23
  end
22
24
 
23
- ##
24
- # This method overrides the inherited default behavior to prevent high server load and fetch time
25
- #
26
- # @!macro response
27
- def complete
28
- raise BlizzardApi::ApiException, 'This endpoint does not have a complete method'
29
- end
30
-
31
25
  ##
32
26
  # Fetch media for a spell
33
27
  #
@@ -39,15 +33,6 @@ module BlizzardApi
39
33
  def display_media(id, **options)
40
34
  api_request "#{base_url(:media)}/spell/#{id}", **default_options.merge(options)
41
35
  end
42
-
43
- protected
44
-
45
- def endpoint_setup
46
- @endpoint = 'spell'
47
- @namespace = :static
48
- @collection = 'spells'
49
- @ttl = CACHE_TRIMESTER
50
- end
51
36
  end
52
37
  end
53
38
  end