Module: BlizzardApi::Wow::Searchable

Included in:
AzeriteEssence, ConnectedRealm, Creature, Item, Media, Mount, Realm, Spell
Defined in:
lib/blizzard_api_rb/wow/search/search_request.rb

Overview

Added search support to an endpoint

Instance Method Summary collapse

Instance Method Details

#search(page = 1, page_size = 100, **options) {|search_options| ... } ⇒ Hash

Fetch data based on search criteria

in the configuration module

Parameters:

  • page (Integer) (defaults to: 1)

    Page o return

  • page_size (Integer) (defaults to: 100)

    Amount of items per page

  • 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.

Yields:

  • (search_options)

Returns:

  • (Hash)

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



16
17
18
19
20
21
# File 'lib/blizzard_api_rb/wow/search/search_request.rb', line 16

def search(page = 1, page_size = 100, **options)
  search_options = SearchComposer.new(page, page_size)
  yield search_options if block_given?

  api_request "#{endpoint_uri(nil, :search)}?#{search_options.to_search_query}", **default_options.merge(options)
end