Class: BlizzardApi::Diablo::GenericDataEndpoint
- Defined in:
- lib/blizzard_api/diablo/game_data/generic_data_endpoint.rb
Overview
Generic endpoint to support most data requests with minor configurations
Constant Summary
Constants inherited from Request
Request::CACHE_DAY, Request::CACHE_HOUR, Request::CACHE_TRIMESTER
Constants included from ApiStandards
Instance Attribute Summary
Attributes inherited from Request
Instance Method Summary collapse
-
#get(id, **options) ⇒ Hash
Fetch all possible data for one of items listed by the #index using its id.
-
#index(**options) ⇒ Hash
Get information about the resource.
-
#initialize(**options) ⇒ GenericDataEndpoint
constructor
A new instance of GenericDataEndpoint.
-
#leaderboard(id, leaderboard_id, **options) ⇒ Hash
Fetch leaderboard data for the current endpoint.
Constructor Details
#initialize(**options) ⇒ GenericDataEndpoint
Returns a new instance of GenericDataEndpoint.
7 8 9 10 11 |
# File 'lib/blizzard_api/diablo/game_data/generic_data_endpoint.rb', line 7 def initialize(**) super(**) endpoint_setup @ttl ||= CACHE_DAY end |
Instance Method Details
#get(id, **options) ⇒ Hash
Fetch all possible data for one of items listed by the #index using its id
in the configuration module
30 31 32 |
# File 'lib/blizzard_api/diablo/game_data/generic_data_endpoint.rb', line 30 def get(id, **) api_request "#{base_url(:game_data)}/#{@endpoint}/#{id}", **.merge() end |
#index(**options) ⇒ Hash
Get information about the resource
in the configuration module
19 20 21 |
# File 'lib/blizzard_api/diablo/game_data/generic_data_endpoint.rb', line 19 def index(**) api_request "#{base_url(:game_data)}/#{@endpoint}/", **.merge() end |
#leaderboard(id, leaderboard_id, **options) ⇒ Hash
Fetch leaderboard data for the current endpoint
in the configuration module
42 43 44 45 |
# File 'lib/blizzard_api/diablo/game_data/generic_data_endpoint.rb', line 42 def leaderboard(id, leaderboard_id, **) opts = .merge() api_request "#{base_url(:game_data)}/#{@endpoint}/#{id}/leaderboard/#{leaderboard_id}", **opts end |