Class: BlizzardApi::Hearthstone::Back

Inherits:
GenericDataEndpoint show all
Defined in:
lib/blizzard_api/hearthstone/game_data/back.rb

Overview

This class allows access to Hearthstone card data

You can get an instance of this class using the default region as follows:

api_instance = BlizzardApi::Hearthstone.card

Constant Summary collapse

VALID_SEARCH_OPTIONS =

Valid options for card search

%i[
  cardBackCategory
  textFilter
  sort
  order
].freeze

Constants inherited from Request

Request::CACHE_DAY, Request::CACHE_HOUR, Request::CACHE_TRIMESTER

Constants included from ApiStandards

ApiStandards::BASE_URLS

Instance Attribute Summary

Attributes inherited from Request

#mode, #region

Instance Method Summary collapse

Methods inherited from GenericDataEndpoint

#get, #initialize

Methods inherited from Request

#initialize

Methods inherited from Request

#initialize

Constructor Details

This class inherits a constructor from BlizzardApi::Hearthstone::GenericDataEndpoint

Instance Method Details

#search(search_options = {}, **options) ⇒ Hash

Returns an up-to-date list of all card backs matching the search criteria. For more information about the

search parameters, see the Card Backs Guide.

in the configuration module

Parameters:

  • search_options (Hash) (defaults to: {})

    Search options accepted by the endpoint @option search_options [String] :cardBackCategory A category of the card back. The category must match a valid category. @option search_options [String] :textFilter A text string used to filter cards.

    You must include a locale along with the textFilter parameter.
    

    @option search_options [String] :sort The field used to sort the results. Valid value include name.

    Results are sorted by date (desc) by default.
    

    @option search_options [String] :order The order in which to sort the results.

    Valid values are asc or desc. The default value is asc.
    
  • options (Hash)

    You can specify some options

Options Hash (**options):

  • :locale (String)

    Overrides the default locale for a single call

  • :namespace (String)

    Overrides the default namespace for a single call

  • :access_token (String)

    Overrides the access_token for a single call

  • :ignore_cache (Boolean)

    If set to true the request will not use the cache

  • :ttl (Integer)

    Override the default time (in seconds) a request should be cached

  • :since (DateTime)

    Adds the If-modified-since headers. Will always ignore cache when set.

  • :validate_fields (Boolean)

    If set to true, this method will throw an exception if nay search option is invalid

Returns:

  • (Hash)

    API Response. The actual type of the returned object depends on the format option



39
40
41
42
43
# File 'lib/blizzard_api/hearthstone/game_data/back.rb', line 39

def search(search_options = {}, **options)
  validate_search_options search_options if options.include? :validate_fields

  api_request "#{base_url(:community)}/cardbacks", **default_options.merge(options).merge(search_options)
end