blizzard_api_rb_rb 3.4.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.
Files changed (101) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ruby.yml +22 -0
  3. data/.gitignore +12 -0
  4. data/.rubocop.yml +18 -0
  5. data/.rubocop_todo.yml +7 -0
  6. data/CHANGELOG.md +269 -0
  7. data/Gemfile +8 -0
  8. data/Gemfile.lock +50 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +200 -0
  11. data/Rakefile +12 -0
  12. data/bin/console +14 -0
  13. data/bin/setup +8 -0
  14. data/blizzard_api_rb.gemspec +44 -0
  15. data/lib/blizzard_api_rb/api_response.rb +27 -0
  16. data/lib/blizzard_api_rb/api_standards.rb +55 -0
  17. data/lib/blizzard_api_rb/configuration.rb +93 -0
  18. data/lib/blizzard_api_rb/diablo/community/act.rb +35 -0
  19. data/lib/blizzard_api_rb/diablo/community/artisan.rb +38 -0
  20. data/lib/blizzard_api_rb/diablo/community/character_class.rb +38 -0
  21. data/lib/blizzard_api_rb/diablo/community/follower.rb +25 -0
  22. data/lib/blizzard_api_rb/diablo/community/item.rb +25 -0
  23. data/lib/blizzard_api_rb/diablo/community/item_type.rb +35 -0
  24. data/lib/blizzard_api_rb/diablo/community/profile.rb +83 -0
  25. data/lib/blizzard_api_rb/diablo/game_data/era.rb +21 -0
  26. data/lib/blizzard_api_rb/diablo/game_data/generic_data_endpoint.rb +58 -0
  27. data/lib/blizzard_api_rb/diablo/game_data/season.rb +21 -0
  28. data/lib/blizzard_api_rb/diablo/request.rb +15 -0
  29. data/lib/blizzard_api_rb/diablo.rb +91 -0
  30. data/lib/blizzard_api_rb/exception.rb +14 -0
  31. data/lib/blizzard_api_rb/hearthstone/game_data/back.rb +59 -0
  32. data/lib/blizzard_api_rb/hearthstone/game_data/card.rb +111 -0
  33. data/lib/blizzard_api_rb/hearthstone/game_data/deck.rb +30 -0
  34. data/lib/blizzard_api_rb/hearthstone/game_data/generic_data_endpoint.rb +49 -0
  35. data/lib/blizzard_api_rb/hearthstone/game_data/metadata.rb +22 -0
  36. data/lib/blizzard_api_rb/hearthstone/request.rb +15 -0
  37. data/lib/blizzard_api_rb/hearthstone.rb +49 -0
  38. data/lib/blizzard_api_rb/overwatch_league/community/matches.rb +22 -0
  39. data/lib/blizzard_api_rb/overwatch_league/community/players.rb +22 -0
  40. data/lib/blizzard_api_rb/overwatch_league/community/segments.rb +22 -0
  41. data/lib/blizzard_api_rb/overwatch_league/community/summary.rb +22 -0
  42. data/lib/blizzard_api_rb/overwatch_league/community/teams.rb +22 -0
  43. data/lib/blizzard_api_rb/overwatch_league/request.rb +15 -0
  44. data/lib/blizzard_api_rb/overwatch_league.rb +50 -0
  45. data/lib/blizzard_api_rb/request.rb +189 -0
  46. data/lib/blizzard_api_rb/starcraft/community/account.rb +23 -0
  47. data/lib/blizzard_api_rb/starcraft/community/ladder.rb +34 -0
  48. data/lib/blizzard_api_rb/starcraft/community/legacy.rb +87 -0
  49. data/lib/blizzard_api_rb/starcraft/community/profile.rb +76 -0
  50. data/lib/blizzard_api_rb/starcraft/game_data/league.rb +27 -0
  51. data/lib/blizzard_api_rb/starcraft/request.rb +36 -0
  52. data/lib/blizzard_api_rb/starcraft.rb +57 -0
  53. data/lib/blizzard_api_rb/token_manager.rb +49 -0
  54. data/lib/blizzard_api_rb/version.rb +6 -0
  55. data/lib/blizzard_api_rb/wow/game_data/achievement.rb +46 -0
  56. data/lib/blizzard_api_rb/wow/game_data/auction.rb +50 -0
  57. data/lib/blizzard_api_rb/wow/game_data/azerite_essence.rb +30 -0
  58. data/lib/blizzard_api_rb/wow/game_data/connected_realm.rb +18 -0
  59. data/lib/blizzard_api_rb/wow/game_data/covenant.rb +72 -0
  60. data/lib/blizzard_api_rb/wow/game_data/creature.rb +102 -0
  61. data/lib/blizzard_api_rb/wow/game_data/generic_data_endpoint.rb +50 -0
  62. data/lib/blizzard_api_rb/wow/game_data/guild_crest.rb +48 -0
  63. data/lib/blizzard_api_rb/wow/game_data/heirloom.rb +16 -0
  64. data/lib/blizzard_api_rb/wow/game_data/item.rb +102 -0
  65. data/lib/blizzard_api_rb/wow/game_data/journal.rb +110 -0
  66. data/lib/blizzard_api_rb/wow/game_data/media.rb +26 -0
  67. data/lib/blizzard_api_rb/wow/game_data/modified_crafting.rb +60 -0
  68. data/lib/blizzard_api_rb/wow/game_data/mount.rb +18 -0
  69. data/lib/blizzard_api_rb/wow/game_data/mythic_keystone.rb +86 -0
  70. data/lib/blizzard_api_rb/wow/game_data/mythic_keystone_affix.rb +28 -0
  71. data/lib/blizzard_api_rb/wow/game_data/mythic_keystone_leaderboard.rb +48 -0
  72. data/lib/blizzard_api_rb/wow/game_data/mythic_raid_leaderboard.rb +28 -0
  73. data/lib/blizzard_api_rb/wow/game_data/pet.rb +62 -0
  74. data/lib/blizzard_api_rb/wow/game_data/playable_class.rb +39 -0
  75. data/lib/blizzard_api_rb/wow/game_data/playable_race.rb +16 -0
  76. data/lib/blizzard_api_rb/wow/game_data/playable_specialization.rb +65 -0
  77. data/lib/blizzard_api_rb/wow/game_data/power_type.rb +16 -0
  78. data/lib/blizzard_api_rb/wow/game_data/profession.rb +65 -0
  79. data/lib/blizzard_api_rb/wow/game_data/pvp_region.rb +82 -0
  80. data/lib/blizzard_api_rb/wow/game_data/pvp_season.rb +53 -0
  81. data/lib/blizzard_api_rb/wow/game_data/pvp_tier.rb +26 -0
  82. data/lib/blizzard_api_rb/wow/game_data/quest.rb +79 -0
  83. data/lib/blizzard_api_rb/wow/game_data/realm.rb +18 -0
  84. data/lib/blizzard_api_rb/wow/game_data/region.rb +16 -0
  85. data/lib/blizzard_api_rb/wow/game_data/reputation.rb +74 -0
  86. data/lib/blizzard_api_rb/wow/game_data/spell.rb +38 -0
  87. data/lib/blizzard_api_rb/wow/game_data/talent.rb +75 -0
  88. data/lib/blizzard_api_rb/wow/game_data/tech_talent.rb +50 -0
  89. data/lib/blizzard_api_rb/wow/game_data/title.rb +16 -0
  90. data/lib/blizzard_api_rb/wow/game_data/toy.rb +16 -0
  91. data/lib/blizzard_api_rb/wow/game_data/wow_token.rb +20 -0
  92. data/lib/blizzard_api_rb/wow/profile/account_profile.rb +97 -0
  93. data/lib/blizzard_api_rb/wow/profile/character_profile.rb +415 -0
  94. data/lib/blizzard_api_rb/wow/profile/guild.rb +75 -0
  95. data/lib/blizzard_api_rb/wow/request.rb +16 -0
  96. data/lib/blizzard_api_rb/wow/search/search_composer.rb +97 -0
  97. data/lib/blizzard_api_rb/wow/search/search_request.rb +24 -0
  98. data/lib/blizzard_api_rb/wow/slug.rb +12 -0
  99. data/lib/blizzard_api_rb/wow.rb +335 -0
  100. data/lib/blizzard_api_rb.rb +26 -0
  101. metadata +237 -0
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+
3
+ ##
4
+ # @!macro [new] init_options
5
+ # @param options [Hash] Initialization options
6
+ # @option options [String] :region API region
7
+ # @option options [Symbol] :model API mode (:regular, :extended)
8
+
9
+ module BlizzardApi
10
+ # Diablo III related classes
11
+ module Diablo
12
+ require_relative 'diablo/request'
13
+ require_relative 'diablo/game_data/generic_data_endpoint'
14
+
15
+ # Diablo data api
16
+ require_relative 'diablo/game_data/season'
17
+ require_relative 'diablo/game_data/era'
18
+
19
+ ##
20
+ # @!macro init_options
21
+ # @return {Season}
22
+ def self.season(**options)
23
+ BlizzardApi::Diablo::Season.new(**options)
24
+ end
25
+
26
+ ##
27
+ # @!macro init_options
28
+ # @return {Era}
29
+ def self.era(**options)
30
+ BlizzardApi::Diablo::Era.new(**options)
31
+ end
32
+
33
+ # Diablo community api
34
+ require_relative 'diablo/community/act'
35
+ require_relative 'diablo/community/artisan'
36
+ require_relative 'diablo/community/follower'
37
+ require_relative 'diablo/community/character_class'
38
+ require_relative 'diablo/community/item_type'
39
+ require_relative 'diablo/community/item'
40
+ require_relative 'diablo/community/profile'
41
+
42
+ ##
43
+ # @!macro init_options
44
+ # @return {Act}
45
+ def self.act(**options)
46
+ BlizzardApi::Diablo::Act.new(**options)
47
+ end
48
+
49
+ ##
50
+ # @!macro init_options
51
+ # @return {Artisan}
52
+ def self.artisan(**options)
53
+ BlizzardApi::Diablo::Artisan.new(**options)
54
+ end
55
+
56
+ ##
57
+ # @!macro init_options
58
+ # @return {Follower}
59
+ def self.follower(**options)
60
+ BlizzardApi::Diablo::Follower.new(**options)
61
+ end
62
+
63
+ ##
64
+ # @!macro init_options
65
+ # @return {Character}
66
+ def self.character(**options)
67
+ BlizzardApi::Diablo::CharacterClass.new(**options)
68
+ end
69
+
70
+ ##
71
+ # @!macro init_options
72
+ # @return {ItemType}
73
+ def self.item_type(**options)
74
+ BlizzardApi::Diablo::ItemType.new(**options)
75
+ end
76
+
77
+ ##
78
+ # @!macro init_options
79
+ # @return {Type}
80
+ def self.item(**options)
81
+ BlizzardApi::Diablo::Item.new(**options)
82
+ end
83
+
84
+ ##
85
+ # @!macro init_options
86
+ # @return {Profile}
87
+ def self.profile(**options)
88
+ BlizzardApi::Diablo::Profile.new(**options)
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BlizzardApi
4
+ ##
5
+ # API Exception
6
+ class ApiException < RuntimeError
7
+ attr_reader :code
8
+
9
+ def initialize(msg = '', code = nil)
10
+ @code = code
11
+ super msg
12
+ end
13
+ end
14
+ end
@@ -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
@@ -0,0 +1,111 @@
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-search
10
+ #
11
+ # You can get an instance of this class using the default region as follows:
12
+ # api_instance = BlizzardApi::Hearthstone.card
13
+ class Card < Hearthstone::GenericDataEndpoint
14
+ # Valid options for card search
15
+ VALID_SEARCH_OPTIONS = %i[
16
+ set
17
+ class
18
+ manaCost
19
+ attack
20
+ health
21
+ collectible
22
+ rarity
23
+ type
24
+ minionType
25
+ keyword
26
+ textFilter
27
+ gameMode
28
+ page
29
+ pageSize
30
+ sort
31
+ order
32
+ ].freeze
33
+
34
+ ##
35
+ # Fetch all possible data for one of the items listed by the {#index} using its *id*
36
+ #
37
+ # @param search_options [Hash] Search options accepted by the endpoint
38
+ # @option search_options [String] :set The slug of the set the card belongs to.
39
+ # If you do not supply a value cards from all sets will be returned.
40
+ # @option search_options [String] :class The slug of the card's class.
41
+ # @option search_options [Integer] :manaCost The mana cost required to play the card.
42
+ # You can include multiple values in a comma-separated list of numeric values.
43
+ # @option search_options [Integer] :attack The attack power of the minion or weapon.
44
+ # You can include multiple values in a comma-separated list of numeric values.
45
+ # @option search_options [Integer] :health The health of a minion.
46
+ # You can include multiple values in a comma-separated list of numeric values.
47
+ # @option search_options [Float] :collectible Whether a card is collectible.
48
+ # A value of 1 indicates that collectible cards should be returned; 0 indicates uncollectible cards.
49
+ # To return all cards, use a value of '0,1'.
50
+ # @option search_options [String] :rarity The rarity of a card.
51
+ # This value must match the rarity slugs found in metadata.
52
+ # @option search_options [String] :type The type of card (for example, minion, spell, and so on).
53
+ # This value must match the type slugs found in metadata.
54
+ # @option search_options [String] :minionType The type of minion card (for example, beast, murloc, dragon, and
55
+ # so on). This value must match the minion type slugs found in metadata.
56
+ # @option search_options [String] :keyword A required keyword on the card (for example, battlecry, deathrattle,
57
+ # and so on). This value must match the keyword slugs found in metadata.
58
+ # @option search_options [String] :textFilter A text string used to filter cards.
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.
62
+ # @option search_options [Integer] :page A page number.
63
+ # @option search_options [Integer] :pageSize The number of results to choose per page.
64
+ # A value will be selected automatically if you do not supply a pageSize or if the pageSize is higher than the
65
+ # maximum allowed. @option search_options [String] :sort The field used to sort the results.
66
+ # Valid values include manaCost, attack, health, and name. Results are sorted by manaCost by default.
67
+ # Cards will also be sorted by class automatically in most cases.
68
+ # @option search_options [String] :order The order in which to sort the results.
69
+ # Valid values are asc or desc. The default value is asc.
70
+ # @!macro request_options
71
+ # @option options [Boolean] :validate_fields If set to true, this method will throw an exception if nay search
72
+ # option is invalid
73
+ #
74
+ # @!macro response
75
+ def search(search_options = {}, **options)
76
+ validate_search_options search_options if options.include? :validate_fields
77
+
78
+ api_request "#{base_url(:community)}/cards", **default_options.merge(options).merge(search_options)
79
+ end
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
+
97
+ protected
98
+
99
+ def validate_search_options(search_options)
100
+ search_options.each do |field|
101
+ raise ArgumentError, "Unrecognized search option #{field}" unless VALID_SEARCH_OPTIONS.include? field
102
+ end
103
+ end
104
+
105
+ def endpoint_setup
106
+ @endpoint = 'cards'
107
+ @ttl = CACHE_TRIMESTER
108
+ end
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,30 @@
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
+ # @see https://develop.battle.net/documentation/hearthstone/guides/decks
10
+ #
11
+ # You can get an instance of this class using the default region as follows:
12
+ # api_instance = BlizzardApi::Hearthstone.deck
13
+ class Deck < Hearthstone::GenericDataEndpoint
14
+ def index
15
+ raise ApiException, 'This endpoint does not have a index method'
16
+ end
17
+
18
+ protected
19
+
20
+ def endpoint_setup
21
+ @endpoint = 'deck'
22
+ @ttl = CACHE_TRIMESTER
23
+ end
24
+
25
+ def default_options
26
+ { ttl: @ttl }
27
+ end
28
+ end
29
+ end
30
+ 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(**options)
8
+ super(**options)
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 search(**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|String] 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,22 @@
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
+ # https://develop.battle.net/documentation/hearthstone/guides/metadata
10
+ #
11
+ # You can get an instance of this class using the default region as follows:
12
+ # api_instance = BlizzardApi::Hearthstone.metadata
13
+ class Metadata < Hearthstone::GenericDataEndpoint
14
+ protected
15
+
16
+ def endpoint_setup
17
+ @endpoint = 'metadata'
18
+ @ttl = CACHE_TRIMESTER
19
+ end
20
+ end
21
+ end
22
+ 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 init_options
9
+ def initialize(**options)
10
+ super(**options)
11
+ @game = 'hearthstone'
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ ##
4
+ # @!macro [new] init_options
5
+ # @param options [Hash] Initialization options
6
+ # @option options [String] :region API region
7
+ # @option options [Symbol] :model API mode (:regular, :extended)
8
+
9
+ module BlizzardApi
10
+ # Hearthstone related classes
11
+ module Hearthstone
12
+ require_relative 'hearthstone/request'
13
+ require_relative 'hearthstone/game_data/generic_data_endpoint'
14
+
15
+ # Hearthstone data api
16
+ require_relative 'hearthstone/game_data/card'
17
+ require_relative 'hearthstone/game_data/back'
18
+ require_relative 'hearthstone/game_data/deck'
19
+ require_relative 'hearthstone/game_data/metadata'
20
+
21
+ ##
22
+ # @!macro init_options
23
+ # @return {Card}
24
+ def self.card(**options)
25
+ BlizzardApi::Hearthstone::Card.new(**options)
26
+ end
27
+
28
+ ##
29
+ # @!macro init_options
30
+ # @return {Back}
31
+ def self.back(**options)
32
+ BlizzardApi::Hearthstone::Back.new(**options)
33
+ end
34
+
35
+ ##
36
+ # @!macro init_options
37
+ # @return {Deck}
38
+ def self.deck(**options)
39
+ BlizzardApi::Hearthstone::Deck.new(**options)
40
+ end
41
+
42
+ ##
43
+ # @!macro init_options
44
+ # @return {Metadata}
45
+ def self.metadata(**options)
46
+ BlizzardApi::Hearthstone::Metadata.new(**options)
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BlizzardApi
4
+ module OverwatchLeague
5
+ ##
6
+ # This class allows access to OWL2 match data
7
+ #
8
+ # @see https://develop.battle.net/documentation/owl/community-apis
9
+ #
10
+ # You can get an instance of this class using the default region as follows:
11
+ # api_instance = BlizzardApi::OverwatchLeague.matches
12
+ class Matches < OverwatchLeague::Request
13
+ ##
14
+ # Returns match information
15
+ #
16
+ # @!macro request_options
17
+ def get(match_id, **options)
18
+ api_request "#{base_url(:community)}/v1/matches/#{match_id}", **{ ttl: CACHE_DAY }.merge(options)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BlizzardApi
4
+ module OverwatchLeague
5
+ ##
6
+ # This class allows access to OWL2 player data
7
+ #
8
+ # @see https://develop.battle.net/documentation/owl/community-apis
9
+ #
10
+ # You can get an instance of this class using the default region as follows:
11
+ # api_instance = BlizzardApi::OverwatchLeague.players
12
+ class Players < OverwatchLeague::Request
13
+ ##
14
+ # Returns player information
15
+ #
16
+ # @!macro request_options
17
+ def get(player_id, **options)
18
+ api_request "#{base_url(:community)}/v1/players/#{player_id}", **{ ttl: CACHE_DAY }.merge(options)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BlizzardApi
4
+ module OverwatchLeague
5
+ ##
6
+ # This class allows access to OWL2 segment data
7
+ #
8
+ # @see https://develop.battle.net/documentation/owl/community-apis
9
+ #
10
+ # You can get an instance of this class using the default region as follows:
11
+ # api_instance = BlizzardApi::OverwatchLeague.segments
12
+ class Segments < OverwatchLeague::Request
13
+ ##
14
+ # Returns segment information
15
+ #
16
+ # @!macro request_options
17
+ def get(segment_id, **options)
18
+ api_request "#{base_url(:community)}/v1/segments/#{segment_id}", **{ ttl: CACHE_DAY }.merge(options)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BlizzardApi
4
+ module OverwatchLeague
5
+ ##
6
+ # This class allows access to OWL2 summary data
7
+ #
8
+ # @see https://develop.battle.net/documentation/owl/community-apis
9
+ #
10
+ # You can get an instance of this class using the default region as follows:
11
+ # api_instance = BlizzardApi::OverwatchLeague.summary
12
+ class Summary < OverwatchLeague::Request
13
+ ##
14
+ # Returns summary information
15
+ #
16
+ # @!macro request_options
17
+ def get(**options)
18
+ api_request "#{base_url(:community)}/v1/owl2", **{ ttl: CACHE_DAY }.merge(options)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BlizzardApi
4
+ module OverwatchLeague
5
+ ##
6
+ # This class allows access to OWL2 team data
7
+ #
8
+ # @see https://develop.battle.net/documentation/owl/community-apis
9
+ #
10
+ # You can get an instance of this class using the default region as follows:
11
+ # api_instance = BlizzardApi::OverwatchLeague.teams
12
+ class Teams < OverwatchLeague::Request
13
+ ##
14
+ # Returns team information
15
+ #
16
+ # @!macro request_options
17
+ def get(team_id, **options)
18
+ api_request "#{base_url(:community)}/v1/teams/#{team_id}", **{ ttl: CACHE_DAY }.merge(options)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BlizzardApi
4
+ module OverwatchLeague
5
+ # Overwatch League requests
6
+ class Request < BlizzardApi::Request
7
+ ##
8
+ # @!macro init_options
9
+ def initialize(**options)
10
+ super(**options)
11
+ @game = 'owl'
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BlizzardApi
4
+ # Overwatch League related classes
5
+ module OverwatchLeague
6
+ require_relative 'overwatch_league/request'
7
+
8
+ # Overwatch League community api
9
+ require_relative 'overwatch_league/community/summary'
10
+ require_relative 'overwatch_league/community/players'
11
+ require_relative 'overwatch_league/community/matches'
12
+ require_relative 'overwatch_league/community/segments'
13
+ require_relative 'overwatch_league/community/teams'
14
+
15
+ ##
16
+ # @!macro init_options
17
+ # @return {Summary}
18
+ def self.summary(**options)
19
+ BlizzardApi::OverwatchLeague::Summary.new(**options)
20
+ end
21
+
22
+ ##
23
+ # @!macro init_options
24
+ # @return {Players}
25
+ def self.players(**options)
26
+ BlizzardApi::OverwatchLeague::Players.new(**options)
27
+ end
28
+
29
+ ##
30
+ # @!macro init_options
31
+ # @return {Matches}
32
+ def self.matches(**options)
33
+ BlizzardApi::OverwatchLeague::Matches.new(**options)
34
+ end
35
+
36
+ ##
37
+ # @!macro init_options
38
+ # @return {Segments}
39
+ def self.segments(**options)
40
+ BlizzardApi::OverwatchLeague::Segments.new(**options)
41
+ end
42
+
43
+ ##
44
+ # @!macro init_options
45
+ # @return {Teams}
46
+ def self.teams(**options)
47
+ BlizzardApi::OverwatchLeague::Teams.new(**options)
48
+ end
49
+ end
50
+ end