Sha256: efe8fd207c0596d14ecd6e8bc0a959a2bb03f6f8a46d955cf04b315085dca379

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

module WarcraftArmory
  
  # The Base class provides general purpose methods to access the Armory
  class Base
    
    # Generates a URL to the Armory. 
    #
    # ==== Usage
    # * <tt>location</tt> - A symbol specifying your realm's location. E.g. <tt>:eu</tt> or <tt>:us</tt>
    # * <tt>realm</tt> - A symbol specifying your realm. E.g. <tt>:aszune</tt> or <tt>:bloodhoof</tt>
    # * <tt>character</tt> - A symbol specifying the character. E.g. <tt>:adries</tt> or <tt>:dwaria</tt>
    # * <tt>file</tt> - Optionally specifies the XML file to retrieve. Defauls to <tt>character-sheet.xml</tt>
    #
    # ==== Examples
    #   WarcraftArmory::Base.generate_url(:eu, :aszune, :adries)
    #   # => http://eu.wowarmory.com/character-sheet.xml?r=Aszune&n=Adries
    #
    #   WarcraftArmory::Base.generate_url(:us, :nazgrel, :gorgious, 'character-talents.xml')
    #   # => http://us.wowarmory.com/character-talents.xml?r=Nazgrel&n=Gorgious 
    def self.generate_url(location, realm, character, file = 'character-sheet.xml')
      "http://#{location.to_s}.wowarmory.com/#{file.to_s}?r=#{realm.to_s}&n=#{character.to_s}"
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
warcraft-armory-0.1.1 lib/warcraft_armory/base.rb
warcraft-armory-0.1.0 lib/warcraft_armory/base.rb