class BN::API::D3
The the Diablo 3 API
requester.
Public Instance Methods
hero(options={})
click to toggle source
Request a hero.
@param [#to_h] options @option options [#to_s] :battle_tag The battle tag. @option options [#to_s] :id The hero’s ID. @return [HTTPI::Response]
# 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={})
click to toggle source
Request a profile.
@param [#to_h] options @option options [#to_s] :battle_tag The battle tag. @return [HTTPI::Response]
# 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
Protected Instance Methods
sanitize_id(id)
click to toggle source
# File lib/bn/api/d3.rb, line 37 def sanitize_id(id) id = id.to_s.gsub(/[^0-9]/, "") unless id.is_a?(Integer) id.to_i end