class DiabloApi::Hero

Attributes

battle_tag[R]
data[R]
hero_id[R]
locale[R]
region[R]

Public Class Methods

new(region, locale, battle_tag, hero_id) click to toggle source
# File lib/diablo_api/hero.rb, line 11
def initialize(region, locale, battle_tag, hero_id)
  @region = region
  @locale = locale
  @battle_tag = battle_tag
  @hero_id = hero_id
  fetch
end

Private Instance Methods

build_url() click to toggle source
# File lib/diablo_api/hero.rb, line 25
def build_url
  "https://#{@region}.api.battle.net/d3/profile/#{URI.escape(@battle_tag)}/hero/#{@hero_id}?locale=#{@locale}&apikey=#{DiabloApi::Config.configuration.api_key}"
end
fetch() click to toggle source
# File lib/diablo_api/hero.rb, line 21
def fetch
  @data = convert_hash_keys(JSON.load(open(build_url).read))
end