Class: BlizzardApi::Wow::Item

Inherits:
GenericDataEndpoint show all
Includes:
Searchable
Defined in:
lib/blizzard_api/wow/game_data/item.rb

Overview

This class allows access to World of Warcraft item data

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

api_instance = BlizzardApi::Wow.item

Constant Summary

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 included from Searchable

#search

Methods inherited from GenericDataEndpoint

#get, setup

Methods inherited from Request

#initialize

Methods inherited from Request

#initialize

Constructor Details

This class inherits a constructor from BlizzardApi::Wow::Request

Instance Method Details

#classes(**options) ⇒ Hash Also known as: item_classes

Return a list of item classes

in the configuration module

Parameters:

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

  • :classic (Boolean)

    If set to true, this method will call the classic version

  • :classic1x (Boolean)

    If set to true, this method will call the classic era version

Returns:

  • (Hash)

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



33
34
35
# File 'lib/blizzard_api/wow/game_data/item.rb', line 33

def classes(**options)
  api_request "#{endpoint_uri('class')}/index", **default_options.merge(options)
end

#indexHash

This method overrides the inherited default behavior to prevent high server load and fetch time

in the configuration module

Returns:

  • (Hash)

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

Raises:



21
22
23
# File 'lib/blizzard_api/wow/game_data/item.rb', line 21

def index
  raise BlizzardApi::ApiException, 'This endpoint does not have an index method'
end

#item_class(id, **options) ⇒ Hash

Return data about an item class

in the configuration module

Parameters:

  • id (Integer)

    Item class id

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

  • :classic (Boolean)

    If set to true, this method will call the classic version

  • :classic1x (Boolean)

    If set to true, this method will call the classic era version

Returns:

  • (Hash)

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



47
48
49
# File 'lib/blizzard_api/wow/game_data/item.rb', line 47

def item_class(id, **options)
  api_request "#{endpoint_uri('class')}/#{id}", **default_options.merge(options)
end

#media(id, **options) ⇒ Hash

Fetch media for an item using its id

in the configuration module

Parameters:

  • id (Integer)

    Item id

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

  • :classic (Boolean)

    If set to true, this method will call the classic version

  • :classic1x (Boolean)

    If set to true, this method will call the classic era version

Returns:

  • (Hash)

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



76
77
78
# File 'lib/blizzard_api/wow/game_data/item.rb', line 76

def media(id, **options)
  api_request "#{base_url(:media)}/item/#{id}", **default_options.merge(options)
end

#set(id, **options) ⇒ Hash

Return data about an item set

in the configuration module

Parameters:

  • id (Integer)

    Item set id

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

Returns:

  • (Hash)

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



97
98
99
# File 'lib/blizzard_api/wow/game_data/item.rb', line 97

def set(id, **options)
  api_request "#{endpoint_uri('set')}/#{id}", **default_options.merge(options)
end

#sets(**options) ⇒ Hash

Return a list of item sets

in the configuration module

Parameters:

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

Returns:

  • (Hash)

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



86
87
88
# File 'lib/blizzard_api/wow/game_data/item.rb', line 86

def sets(**options)
  api_request "#{endpoint_uri('set')}/index", **default_options.merge(options)
end

#subclass(id, subclass_id, **options) ⇒ Hash Also known as: item_subclass

Return all subclasses of a given class

in the configuration module

Parameters:

  • id (Integer)

    Item class id

  • subclass_id (Integer)

    Item subclass id

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

  • :classic (Boolean)

    If set to true, this method will call the classic version

  • :classic1x (Boolean)

    If set to true, this method will call the classic era version

Returns:

  • (Hash)

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



61
62
63
# File 'lib/blizzard_api/wow/game_data/item.rb', line 61

def subclass(id, subclass_id, **options)
  api_request "#{endpoint_uri('class')}/#{id}/item-subclass/#{subclass_id}", **default_options.merge(options)
end