Class: BlizzardApi::Diablo::Profile

Inherits:
Request show all
Defined in:
lib/blizzard_api_rb/diablo/community/profile.rb

Overview

This class allows access to Diablo III profile data

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

api_instance = BlizzardApi::Diablo.profile

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 inherited from Request

#initialize

Methods inherited from Request

#initialize

Constructor Details

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

Instance Method Details

#hero(battletag, oauth_token, hero_id, **options) ⇒ Hash

Return more data about a hero

in the configuration module

Parameters:

  • battletag (String)

    User’s battletag

  • oauth_token (String)

    A token generated by the OAuth authorization flow. See the link below for more info.

  • hero_id (Integer)

    Hero 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

See Also:



39
40
41
42
# File 'lib/blizzard_api_rb/diablo/community/profile.rb', line 39

def hero(battletag, oauth_token, hero_id, **options)
  opts = { access_token: oauth_token, ttl: CACHE_TRIMESTER }.merge(options)
  api_request "#{base_url(:community)}/profile/#{parse_battle_tag(battletag)}/hero/#{hero_id}", **opts
end

#hero_follower_items(battletag, oauth_token, hero_id, **options) ⇒ Hash

Return more data about a hero’s followers

in the configuration module

Parameters:

  • battletag (String)

    User’s battletag

  • oauth_token (String)

    A token generated by the OAuth authorization flow. See the link below for more info.

  • hero_id (Integer)

    Hero 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

See Also:



71
72
73
74
# File 'lib/blizzard_api_rb/diablo/community/profile.rb', line 71

def hero_follower_items(battletag, oauth_token, hero_id, **options)
  opts = { access_token: oauth_token, ttl: CACHE_TRIMESTER }.merge(options)
  api_request "#{base_url(:community)}/profile/#{parse_battle_tag(battletag)}/hero/#{hero_id}/follower-items", **opts
end

#hero_items(battletag, oauth_token, hero_id, **options) ⇒ Hash

Return more data about a hero’s items

in the configuration module

Parameters:

  • battletag (String)

    User’s battletag

  • oauth_token (String)

    A token generated by the OAuth authorization flow. See the link below for more info.

  • hero_id (Integer)

    Hero 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

See Also:



55
56
57
58
# File 'lib/blizzard_api_rb/diablo/community/profile.rb', line 55

def hero_items(battletag, oauth_token, hero_id, **options)
  opts = { access_token: oauth_token, ttl: CACHE_TRIMESTER }.merge(options)
  api_request "#{base_url(:community)}/profile/#{parse_battle_tag(battletag)}/hero/#{hero_id}/items", **opts
end

#index(battletag, oauth_token, **options) ⇒ Hash

Return an user’s profile data with a list of heroes

in the configuration module

Parameters:

  • battletag (String)

    User’s battletag

  • oauth_token (String)

    A token generated by the OAuth authorization flow. See the link below for more info.

  • 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

See Also:



23
24
25
26
# File 'lib/blizzard_api_rb/diablo/community/profile.rb', line 23

def index(battletag, oauth_token, **options)
  opts = { access_token: oauth_token, ttl: CACHE_TRIMESTER }.merge(options)
  api_request "#{base_url(:community)}/profile/#{parse_battle_tag(battletag)}/", **opts
end