Module: Elvarg::Hiscores

Defined in:
lib/hiscores/skill.rb,
lib/hiscores/player.rb,
lib/hiscores/hiscores.rb

Overview

:nodoc:

Defined Under Namespace

Classes: Player, Skill

Constant Summary collapse

MODES =

Represents different modes base URL’s on the OldSchool RuneScape Hiscores.

{
  default: 'https://secure.runescape.com/m=hiscore_oldschool/',
  ironman: 'http://services.runescape.com/m=hiscore_oldschool_ironman/',
  ultimate: 'http://services.runescape.com/m=hiscore_oldschool_ultimate/',
  hardcore: 'http://services.runescape.com/m=hiscore_oldschool_hardcore_ironman/',
  deadman: 'http://services.runescape.com/m=hiscore_oldschool_deadman/',
  seasonal: 'http://services.runescape.com/m=hiscore_oldschool_seasonal/',
  tournament: 'http://services.runescape.com/m=hiscore_oldschool_tournament/'
}.freeze
ENDPOINTS =

Represents different endpoints on the Hiscores.

{
  stats: 'index_lite.ws?player=',
  scores: 'overall.ws?'
}.freeze

Class Method Summary collapse

Class Method Details

.search_for(username, mode = :default) ⇒ String

Searches for a particular player on the Hiscores and grabs data about the player.

Parameters:

  • username (String)

    the player’s username

  • mode (Symbol) (defaults to: :default)

    the mode to grab data in. This can be any of the Elvarg::Hiscores::MODES.

Returns:

  • (String)

    data about the Player on the Hiscores



32
33
34
# File 'lib/hiscores/hiscores.rb', line 32

def self.search_for(username, mode = :default)
  open(MODES[mode] + ENDPOINTS[:stats] + username, &:read)
end