class BlizzardApi::Wow::AccountProfile

Simplifies the requests to Blizzard APIS

Public Class Methods

new(token, region = nil, mode = :regular) click to toggle source

@param token [String] A token obtained using the authorization_code flow

Calls superclass method BlizzardApi::Request::new
# File lib/blizzard_api/wow/profile/profile.rb, line 10
def initialize(token, region = nil, mode = :regular)
  super region, mode
  @token = token
end

Public Instance Methods

collection(**options) click to toggle source

Returns the collection index for the account

@!macro request_options

@!macro response

# File lib/blizzard_api/wow/profile/profile.rb, line 41
def collection(**options)
  api_request "#{base_url(:user_profile)}/collections", **default_options.merge(options)
end
get(**options) click to toggle source

Returns the account summary for WoW

@!macro request_options

@!macro response

# File lib/blizzard_api/wow/profile/profile.rb, line 21
def get(**options)
  api_request base_url(:user_profile).to_s, **default_options.merge(options)
end
mounts(**options) click to toggle source

Returns the mount collection index for the account

@!macro request_options

@!macro response

# File lib/blizzard_api/wow/profile/profile.rb, line 51
def mounts(**options)
  api_request "#{base_url(:user_profile)}/collections/mounts", **default_options.merge(options)
end
pets(**options) click to toggle source

Returns the pet collection index for the account

@!macro request_options

@!macro response

# File lib/blizzard_api/wow/profile/profile.rb, line 61
def pets(**options)
  api_request "#{base_url(:user_profile)}/collections/pets", **default_options.merge(options)
end
protected_character(realm_id, character_id, **options) click to toggle source

Returns data for protected characters

@!macro request_options

@!macro response

# File lib/blizzard_api/wow/profile/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

Protected Instance Methods

api_request(_uri, **query_string) click to toggle source
Calls superclass method BlizzardApi::Request#api_request
# File lib/blizzard_api/wow/profile/profile.rb, line 71
def api_request(_uri, **query_string)
  query_string.merge! access_token: @token
  super
end
default_options() click to toggle source
# File lib/blizzard_api/wow/profile/profile.rb, line 67
def default_options
  { ttl: CACHE_HOUR, namespace: :profile }
end