Class: BlizzardApi::Wow::AccountProfile

Inherits:
Request show all
Defined in:
lib/blizzard_api/wow/profile/account_profile.rb

Overview

Simplifies the requests to Blizzard APIS

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

Constructor Details

#initialize(token, **options) ⇒ AccountProfile

Returns a new instance of AccountProfile.

Parameters:

  • token (String)

    A token obtained using the authorization_code flow



10
11
12
13
# File 'lib/blizzard_api/wow/profile/account_profile.rb', line 10

def initialize(token, **options)
  super(**options)
  @token = token
end

Instance Method Details

#collection(**options) ⇒ Hash

Returns the collection index for the account

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



41
42
43
# File 'lib/blizzard_api/wow/profile/account_profile.rb', line 41

def collection(**options)
  api_request "#{base_url(:user_profile)}/collections", **default_options.merge(options)
end

#get(**options) ⇒ Hash

Returns the account summary for WoW

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



21
22
23
# File 'lib/blizzard_api/wow/profile/account_profile.rb', line 21

def get(**options)
  api_request base_url(:user_profile).to_s, **default_options.merge(options)
end

#heirloom(**options) ⇒ Hash

Returns the heirloom collection index for the account

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



71
72
73
# File 'lib/blizzard_api/wow/profile/account_profile.rb', line 71

def heirloom(**options)
  api_request "#{base_url(:user_profile)}/collections/heirloom", **default_options.merge(options)
end

#mounts(**options) ⇒ Hash

Returns the mount collection index for the account

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



51
52
53
# File 'lib/blizzard_api/wow/profile/account_profile.rb', line 51

def mounts(**options)
  api_request "#{base_url(:user_profile)}/collections/mounts", **default_options.merge(options)
end

#pets(**options) ⇒ Hash

Returns the pet collection index for the account

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



81
82
83
# File 'lib/blizzard_api/wow/profile/account_profile.rb', line 81

def pets(**options)
  api_request "#{base_url(:user_profile)}/collections/pets", **default_options.merge(options)
end

#protected_character(realm_id, character_id, **options) ⇒ Hash

Returns data for protected characters

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



31
32
33
# File 'lib/blizzard_api/wow/profile/account_profile.rb', line 31

def protected_character(realm_id, character_id, **options)
  api_request "#{base_url(:user_profile)}/protected-character/#{realm_id}-#{character_id}", **default_options.merge(options)
end

#toys(**options) ⇒ Hash

Returns the toy collection index for the account

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



61
62
63
# File 'lib/blizzard_api/wow/profile/account_profile.rb', line 61

def toys(**options)
  api_request "#{base_url(:user_profile)}/collections/toys", **default_options.merge(options)
end