blizzard_api 0.3.1 → 0.3.2

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.
@@ -0,0 +1,110 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BlizzardApi
4
+ module Wow
5
+ ##
6
+ # This class allows access to World of Warcraft journal data
7
+ #
8
+ # @see https://develop.battle.net/documentation/world-of-warcraft/game-data-apis
9
+ #
10
+ # You can get an instance of this class using the default region as follows:
11
+ # api_instance = BlizzardApi::Wow.journal
12
+ class Journal < Wow::GenericDataEndpoint
13
+ ##
14
+ # This method overrides the inherited default behavior to prevent high server load and fetch time
15
+ #
16
+ # @!macro response
17
+ def index
18
+ raise BlizzardApi::ApiException, 'This endpoint does not have a index method'
19
+ end
20
+
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
+ ##
30
+ # This method overrides the inherited default behavior to prevent high server load and fetch time
31
+ #
32
+ # @!macro response
33
+ def get(_id, _options = {})
34
+ raise BlizzardApi::ApiException, 'This endpoint does not have a get method'
35
+ end
36
+
37
+ ##
38
+ # Return a list of expansion journal entries
39
+ #
40
+ # @!macro request_options
41
+ #
42
+ # @!macro response
43
+ def expansions(options = {})
44
+ api_request "#{endpoint_uri('expansion')}/index", default_options.merge(options)
45
+ end
46
+
47
+ ##
48
+ # Return data about an expansion journal entry
49
+ #
50
+ # @param id [Integer] Journal entry id
51
+ # @!macro request_options
52
+ #
53
+ # @!macro response
54
+ def expansion(id, options = {})
55
+ api_request "#{endpoint_uri('expansion')}/#{id}", default_options.merge(options)
56
+ end
57
+
58
+ ##
59
+ # Return a list of instance journal entries
60
+ #
61
+ # @!macro request_options
62
+ #
63
+ # @!macro response
64
+ def instances(options = {})
65
+ api_request "#{endpoint_uri('instance')}/index", default_options.merge(options)
66
+ end
67
+
68
+ ##
69
+ # Return data about an instance journal entry
70
+ #
71
+ # @param id [Integer] Journal entry id
72
+ # @!macro request_options
73
+ #
74
+ # @!macro response
75
+ def instance(id, options = {})
76
+ api_request "#{endpoint_uri('instance')}/#{id}", default_options.merge(options)
77
+ end
78
+
79
+ ##
80
+ # Return a list of encounter journal entries
81
+ #
82
+ # @!macro request_options
83
+ #
84
+ # @!macro response
85
+ def encounters(options = {})
86
+ api_request "#{endpoint_uri('encounter')}/index", default_options.merge(options)
87
+ end
88
+
89
+ ##
90
+ # Return data about an encounter journal entry
91
+ #
92
+ # @param id [Integer] Journal entry id
93
+ # @!macro request_options
94
+ #
95
+ # @!macro response
96
+ def encounter(id, options = {})
97
+ api_request "#{endpoint_uri('encounter')}/#{id}", default_options.merge(options)
98
+ end
99
+
100
+ protected
101
+
102
+ def endpoint_setup
103
+ @endpoint = 'journal'
104
+ @namespace = :static
105
+ @collection = 'journals'
106
+ @ttl = CACHE_TRIMESTER
107
+ end
108
+ end
109
+ end
110
+ end
@@ -10,20 +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.mount
12
12
  class Mount < Wow::GenericDataEndpoint
13
- ##
14
- # Returns a index of mounts
15
- #
16
- # @!macro request_options
17
- # @option options [Boolean] :use_community_endpoint If set to true, this method will call the community endpoint
18
- # instead of the data endpoint https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
19
- #
20
- # @!macro response
21
- def index(options = {})
22
- return super options unless options.include? :use_community_endpoint
23
-
24
- api_request "#{base_url(:community)}/mount/", { ttl: CACHE_TRIMESTER }.merge(options)
25
- end
26
-
27
13
  protected
28
14
 
29
15
  def endpoint_setup
@@ -10,81 +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.pet
12
12
  class Pet < Wow::GenericDataEndpoint
13
- # Poor (gray) quality pet
14
- PET_QUALITY_POOR = 0
15
- # Common (white) quality pet
16
- PET_QUALITY_COMMON = 1
17
- # Uncommon (green) quality pet
18
- PET_QUALITY_UNCOMMON = 2
19
- # Rare (blue) quality pet
20
- PET_QUALITY_RARE = 3
21
- # Epic (purple) quality pet
22
- PET_QUALITY_EPIC = 4
23
- # Legendary (orange) quality pet
24
- PET_QUALITY_LEGENDARY = 5
25
-
26
- ##
27
- # Return a list of all available pets
28
- #
29
- # @!macro request_options
30
- # @option options [Boolean] :use_community_endpoint If set to true, this method will call the community endpoint
31
- # instead of the data endpoint https://develop.battle.net/documentation/api-reference/world-of-warcraft-community-api
32
- #
33
- # @!macro response
34
- def index(options = {})
35
- return super options unless options.include? :use_community_endpoint
36
-
37
- api_request "#{base_url(:community)}/pet/", { ttl: CACHE_TRIMESTER }.merge(options)
38
- end
39
-
40
- ##
41
- # Return complete data about a pet ability by its id
42
- #
43
- # @param id [Integer] Pet ability id
44
- # @!macro request_options
45
- #
46
- # @!macro response
47
- def ability(id, options = {})
48
- api_request "#{base_url(:community)}/pet/ability/#{id}", { ttl: CACHE_TRIMESTER }.merge(options)
49
- end
50
-
51
- ##
52
- # Return complete data about a pet species by its id
53
- #
54
- # @param id [Integer] Pet species id
55
- # @!macro request_options
56
- #
57
- # @!macro response
58
- def species(id, options = {})
59
- api_request "#{base_url(:community)}/pet/species/#{id}", { ttl: CACHE_TRIMESTER }.merge(options)
60
- end
61
-
62
- ##
63
- # Return complete data about a pet stats based on its attributes
64
- #
65
- # @param id [Integer] Pet id (Obtained by the {#index} or {Character#get} with the fields *pets* or *petSlots*)
66
- # @param level [Integer] Pet's level (1 - 25)
67
- # @param breed_id [Integer]
68
- # @param quality_id [Integer] Pets quality ID where 0 = Poor and 5 = legendary. You can use the
69
- # constants PET_QUALITY_*
70
- # @!macro request_options
71
- #
72
- # @!macro response
73
- def stats(id, level = 25, breed_id = 3, quality_id = 1, options = {})
74
- opts = { level: level, breedId: breed_id, qualityId: quality_id, ttl: CACHE_TRIMESTER }.merge(options)
75
- api_request "#{base_url(:community)}/pet/stats/#{id}", opts
76
- end
77
-
78
- ##
79
- # Return a complete list of pet types
80
- #
81
- # @!macro request_options
82
- #
83
- # @!macro response
84
- def types(options = {})
85
- api_request "#{base_url(:community)}/data/pet/types", { ttl: CACHE_TRIMESTER }.merge(options)
86
- end
87
-
88
13
  protected
89
14
 
90
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.playable_class
12
12
  class PlayableClass < Wow::GenericDataEndpoint
13
- ##
14
- # Returns a index of playable classes
15
- #
16
- # @!macro request_options
17
- # @option options [Boolean] :use_community_endpoint If set to true, this method will call the community endpoint
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
20
- #
21
- # @!macro response
22
- def index(options = {})
23
- return super options unless options.include? :use_community_endpoint
24
-
25
- api_request "#{base_url(:community)}/data/character/classes", { ttl: CACHE_TRIMESTER }.merge(options)
26
- end
27
-
28
13
  ##
29
14
  # Returns the PvP talent slots data of a specific class
30
15
  #
@@ -3,19 +3,19 @@
3
3
  module BlizzardApi
4
4
  module Wow
5
5
  ##
6
- # This class allows access to World of Warcraft reputation
6
+ # This class allows access to World of Warcraft playable races
7
7
  #
8
8
  # @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-game-data-api
9
9
  #
10
10
  # You can get an instance of this class using the default region as follows:
11
- # api_instance = BlizzardApi::Wow.creature
12
- class ReputationTier < Wow::GenericDataEndpoint
11
+ # race = BlizzardApi::Wow.playable_race
12
+ class PlayableRace < Wow::GenericDataEndpoint
13
13
  protected
14
14
 
15
15
  def endpoint_setup
16
- @endpoint = 'reputation-tiers'
16
+ @endpoint = 'playable-race'
17
17
  @namespace = :static
18
- @collection = 'achievements'
18
+ @collection = 'races'
19
19
  @ttl = CACHE_TRIMESTER
20
20
  end
21
21
  end
@@ -8,7 +8,7 @@ module BlizzardApi
8
8
  # @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-game-data-api
9
9
  #
10
10
  # You can get an instance of this class using the default region as follows:
11
- # api_instance = BlizzardApi::Wow.power_type
11
+ # api_instance = BlizzardApi::Wow.pvp_tier
12
12
  class PvpTier < Wow::GenericDataEndpoint
13
13
  ##
14
14
  # Returns media assets for a pvp tier
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BlizzardApi
4
+ module Wow
5
+ ##
6
+ # This class allows access to World of Warcraft quest data
7
+ #
8
+ # @see https://develop.battle.net/documentation/world-of-warcraft/game-data-apis
9
+ #
10
+ # You can get an instance of this class using the default region as follows:
11
+ # api_instance = BlizzardApi::Wow.quest
12
+ class Quest < Wow::GenericDataEndpoint
13
+ ##
14
+ # Return a list of quest categories
15
+ #
16
+ # @!macro request_options
17
+ #
18
+ # @!macro response
19
+ def categories(options = {})
20
+ api_request "#{endpoint_uri}/category/index", default_options.merge(options)
21
+ end
22
+
23
+ ##
24
+ # Return data about a quest category
25
+ #
26
+ # @param id [Integer] Quest category id
27
+ # @!macro request_options
28
+ #
29
+ # @!macro response
30
+ def category(id, options = {})
31
+ api_request "#{endpoint_uri}/category/#{id}", default_options.merge(options)
32
+ end
33
+
34
+ ##
35
+ # Return a list of quest areas
36
+ #
37
+ # @!macro request_options
38
+ #
39
+ # @!macro response
40
+ def areas(options = {})
41
+ api_request "#{endpoint_uri}/area/index", default_options.merge(options)
42
+ end
43
+
44
+ ##
45
+ # Return data about a quest area
46
+ #
47
+ # @param id [Integer] Quest category id
48
+ # @!macro request_options
49
+ #
50
+ # @!macro response
51
+ def area(id, options = {})
52
+ api_request "#{endpoint_uri}/area/#{id}", default_options.merge(options)
53
+ end
54
+
55
+ ##
56
+ # Return a list of quest types
57
+ #
58
+ # @!macro request_options
59
+ #
60
+ # @!macro response
61
+ def types(options = {})
62
+ api_request "#{endpoint_uri}/type/index", default_options.merge(options)
63
+ end
64
+
65
+ ##
66
+ # Return data about a quest type
67
+ #
68
+ # @param id [Integer] Quest type
69
+ # @!macro request_options
70
+ #
71
+ # @!macro response
72
+ def type(id, options = {})
73
+ api_request "#{endpoint_uri}/type/#{id}", default_options.merge(options)
74
+ 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
+ end
85
+ end
86
+ end
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BlizzardApi
4
+ module Wow
5
+ ##
6
+ # This class allows access to World of Warcraft reputation
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.reputation
12
+ class Reputation < Wow::GenericDataEndpoint
13
+ ##
14
+ # This method overrides the inherited default behavior to prevent high server load and fetch time
15
+ #
16
+ # @!macro response
17
+ def index
18
+ raise BlizzardApi::ApiException, 'This endpoint does not have a index method'
19
+ end
20
+
21
+ ##
22
+ # This method overrides the inherited default behavior to prevent high server load and fetch time
23
+ #
24
+ # @!macro response
25
+ def get
26
+ raise BlizzardApi::ApiException, 'This endpoint does not have a get method'
27
+ end
28
+
29
+ ##
30
+ # Return a list of reputation factions
31
+ #
32
+ # @!macro request_options
33
+ #
34
+ # @!macro response
35
+ def factions(options = {})
36
+ api_request "#{endpoint_uri('faction')}/index", default_options.merge(options)
37
+ end
38
+
39
+ ##
40
+ # Return data about a reputation faction
41
+ #
42
+ # @param id [Integer] Reputation faction id
43
+ # @!macro request_options
44
+ #
45
+ # @!macro response
46
+ def faction(id, options = {})
47
+ api_request "#{endpoint_uri('faction')}/#{id}", default_options.merge(options)
48
+ end
49
+
50
+ ##
51
+ # Return a list of reputation tiers
52
+ #
53
+ # @!macro request_options
54
+ #
55
+ # @!macro response
56
+ def tiers(options = {})
57
+ api_request "#{endpoint_uri('tiers')}/index", default_options.merge(options)
58
+ end
59
+
60
+ ##
61
+ # Return data about a reputation tier
62
+ #
63
+ # @param id [Integer] Reputation tier id
64
+ # @!macro request_options
65
+ #
66
+ # @!macro response
67
+ def tier(id, options = {})
68
+ api_request "#{endpoint_uri('tiers')}/#{id}", default_options.merge(options)
69
+ 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
+ end
80
+ end
81
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BlizzardApi
4
+ module Wow
5
+ ##
6
+ # This class allows access to World of Warcraft spell data
7
+ #
8
+ # @see https://develop.battle.net/documentation/world-of-warcraft/game-data-apis
9
+ #
10
+ # You can get an instance of this class using the default region as follows:
11
+ # api_instance = BlizzardApi::Wow.spell
12
+ class Spell < Wow::GenericDataEndpoint
13
+ ##
14
+ # This method overrides the inherited default behavior to prevent high server load and fetch time
15
+ #
16
+ # @!macro response
17
+ def index
18
+ raise BlizzardApi::ApiException, 'This endpoint does not have a index method'
19
+ end
20
+
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
+ ##
30
+ # Fetch media for a spell
31
+ #
32
+ # @param id [Integer] Spell id
33
+ #
34
+ # @!macro request_options
35
+ #
36
+ # @!macro response
37
+ def display_media(id, options = {})
38
+ api_request "#{base_url(:media)}/spell/#{id}", default_options.merge(options)
39
+ end
40
+
41
+ protected
42
+
43
+ def endpoint_setup
44
+ @endpoint = 'spell'
45
+ @namespace = :static
46
+ @collection = 'spells'
47
+ @ttl = CACHE_TRIMESTER
48
+ end
49
+ end
50
+ end
51
+ end