class Dota::API::Hero

Attributes

id[R]
internal_name[R]
name[R]

Public Class Methods

find(id) click to toggle source
# File lib/dota/api/hero.rb, line 8
def self.find(id)
  hero = mapping[id]
  hero ? new(id) : Dota::API::MissingHero.new(id)
end
new(id) click to toggle source
# File lib/dota/api/hero.rb, line 13
def initialize(id)
  @id = id
  @internal_name = mapping[id][0]
  @name = mapping[id][1]
end

Public Instance Methods

image_url(type = :full) click to toggle source
# File lib/dota/api/hero.rb, line 19
def image_url(type = :full)
  # Possible values for type:
  # :full - full quality horizontal portrait (256x114px, PNG)
  # :lg - large horizontal portrait (205x11px, PNG)
  # :sb - small horizontal portrait (59x33px, PNG)
  # :vert - full quality vertical portrait (234x272px, JPEG)

  "http://cdn.dota2.com/apps/dota2/images/heroes/#{internal_name}_#{type}.#{type == :vert ? 'jpg' : 'png'}"
end