Module: Elvarg::Hiscores
- Included in:
- Player
- Defined in:
- lib/hiscores/player.rb,
lib/hiscores/hiscores.rb
Defined Under Namespace
Classes: Player
Constant Summary collapse
- MODES =
{ 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/", }
- ENDPOINT =
{ stats: "index_lite.ws?player=", scores: 'overall.ws?', }
Class Method Summary collapse
-
.search_for(username, mode = :default) ⇒ Object
Searches for a specific user on a specified mode on the OldSchool RuneScape HiScores website.
Class Method Details
.search_for(username, mode = :default) ⇒ Object
Searches for a specific user on a specified mode on the OldSchool RuneScape HiScores website.
Parameters
- String
-
username- The user’s username
- Symbol
-
mode- the mode to look in, see Hiscores::MODES for available modes. Default is ‘:default`.
Examples
player = Elvarg::Hiscores.search_for ‘ruby’ player = Elvarg::Hiscores.search_for(‘github’, :ironman)
32 33 34 |
# File 'lib/hiscores/hiscores.rb', line 32 def self.search_for(username, mode = :default) open(MODES[mode] + ENDPOINT[:stats] + username, &:read) end |