class BlizzardApi::Hearthstone::GenericDataEndpoint
Generic endpoint to support most data requests with minor configurations
Public Class Methods
new(region = nil, mode = :regular)
click to toggle source
Calls superclass method
BlizzardApi::Hearthstone::Request::new
# File lib/blizzard_api/hearthstone/game_data/generic_data_endpoint.rb, line 7 def initialize(region = nil, mode = :regular) super region, mode endpoint_setup @ttl ||= CACHE_DAY end
Public Instance Methods
get(id, **options)
click to toggle source
Fetch all possible data for one of items listed by the {#index} using its id
@param [Integer|String] id One of the IDs returned by the {#index} @!macro request_options
@!macro response
# File lib/blizzard_api/hearthstone/game_data/generic_data_endpoint.rb, line 34 def get(id, **options) api_request "#{base_url(:community)}/#{@endpoint}/#{id}", **default_options.merge(options) end
index(**options)
click to toggle source
Get information about the resource
@!macro request_options
@!macro response
# File lib/blizzard_api/hearthstone/game_data/generic_data_endpoint.rb, line 23 def index(**options) api_request "#{base_url(:community)}/#{@endpoint}/", **default_options.merge(options) end
Protected Instance Methods
default_options()
click to toggle source
# File lib/blizzard_api/hearthstone/game_data/generic_data_endpoint.rb, line 44 def default_options { ttl: @ttl } end
endpoint_setup()
click to toggle source
# File lib/blizzard_api/hearthstone/game_data/generic_data_endpoint.rb, line 40 def endpoint_setup raise NotImplementedError end