class BlizzardApi::Hearthstone::Card

This class allows access to Hearthstone card data

@see develop.battle.net/documentation/api-reference/hearthstone-game-data-api @see develop.battle.net/documentation/hearthstone/guides/card-search

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

api_instance = BlizzardApi::Hearthstone.card

Constants

VALID_SEARCH_OPTIONS

Valid options for card search

Public Instance Methods

get(id_or_slug, game_mode = 'constructed', **options) click to toggle source

Returns the card with an ID or slug that matches the one you specify. For more information, see the Card Search Guide.

@see develop.battle.net/documentation/hearthstone/guides/card-search @see develop.battle.net/documentation/hearthstone/guides/game-modes

@param id_or_slug [String] Card ID or slug @param game_mode [String] A recognized game mode (for example, battlegrounds or constructed).

The default value is constructed. See the Game Modes Guide for more information.

@!macro request_options

@!macro response

# File lib/blizzard_api/hearthstone/game_data/card.rb, line 93
def get(id_or_slug, game_mode = 'constructed', **options)
  super id_or_slug, **{ gameMode: game_mode }.merge(options)
end

Protected Instance Methods

endpoint_setup() click to toggle source
# File lib/blizzard_api/hearthstone/game_data/card.rb, line 105
def endpoint_setup
  @endpoint = 'cards'
  @ttl = CACHE_TRIMESTER
end
validate_search_options(search_options) click to toggle source
# File lib/blizzard_api/hearthstone/game_data/card.rb, line 99
def validate_search_options(search_options)
  search_options.each do |field|
    raise ArgumentError, "Unrecognized search option #{field}" unless VALID_SEARCH_OPTIONS.include? field
  end
end