Class: BlizzardApi::Hearthstone::GenericDataEndpoint
- Defined in:
- lib/blizzard_api/hearthstone/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.
-
#initialize(**options) ⇒ GenericDataEndpoint
constructor
A new instance of GenericDataEndpoint.
-
#search(**options) ⇒ Hash
Get information about the resource.
Constructor Details
#initialize(**options) ⇒ GenericDataEndpoint
Returns a new instance of GenericDataEndpoint.
7 8 9 10 11 |
# File 'lib/blizzard_api/hearthstone/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
34 35 36 |
# File 'lib/blizzard_api/hearthstone/game_data/generic_data_endpoint.rb', line 34 def get(id, **) api_request "#{base_url(:community)}/#{@endpoint}/#{id}", **.merge() end |
#search(**options) ⇒ Hash
Get information about the resource
in the configuration module
23 24 25 |
# File 'lib/blizzard_api/hearthstone/game_data/generic_data_endpoint.rb', line 23 def search(**) api_request "#{base_url(:community)}/#{@endpoint}/", **.merge() end |