Class: BN::API::D3

Inherits:
Base
  • Object
show all
Defined in:
lib/bn/api/d3.rb

Overview

The the Diablo 3 API requester.

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from Helpers::HasAttributes

included, #initialize, #update_attributes

Constructor Details

This class inherits a constructor from BN::API::Base

Instance Method Details

#hero(options = {}) ⇒ HTTPI::Response

Request a hero.

Parameters:

  • options (#to_h) (defaults to: {})

Options Hash (options):

  • :battle_tag (#to_s)

    The battle tag.

  • :id (#to_s)

    The hero’s ID.

Returns:

  • (HTTPI::Response)


26
27
28
29
30
31
32
33
# File 'lib/bn/api/d3.rb', line 26

def hero(options={})
  options = options.to_h

  battle_tag = sanitize_battle_tag(options.delete(:battle_tag))
  id = sanitize_id(options.delete(:id))

  get("/d3/profile/#{battle_tag}/hero/#{id}", options)
end

#profile(options = {}) ⇒ HTTPI::Response

Request a profile.

Parameters:

  • options (#to_h) (defaults to: {})

Options Hash (options):

  • :battle_tag (#to_s)

    The battle tag.

Returns:

  • (HTTPI::Response)


12
13
14
15
16
17
18
# File 'lib/bn/api/d3.rb', line 12

def profile(options={})
  options = options.to_h

  battle_tag = sanitize_battle_tag(options.delete(:battle_tag))

  get("/d3/profile/#{battle_tag}", options)
end