Class: Player::EOC
- Inherits:
-
Object
- Object
- Player::EOC
- Defined in:
- lib/rs_api-ruby/player.rb
Instance Method Summary collapse
- #getAvatarChat ⇒ Object
- #getAvatarFull ⇒ Object
- #getClan ⇒ Object
- #getName ⇒ Object
- #getTitle ⇒ Object
-
#initialize(name) ⇒ EOC
constructor
A new instance of EOC.
Constructor Details
#initialize(name) ⇒ EOC
Returns a new instance of EOC.
26 27 28 29 |
# File 'lib/rs_api-ruby/player.rb', line 26 def initialize(name) @@name = name #@skills = HighScores::OS.getPlayer(name) end |
Instance Method Details
#getAvatarChat ⇒ Object
57 58 59 |
# File 'lib/rs_api-ruby/player.rb', line 57 def getAvatarChat return Utils.baseURI + "avatar-rs/" + @@name + "/chat.png" end |
#getAvatarFull ⇒ Object
53 54 55 |
# File 'lib/rs_api-ruby/player.rb', line 53 def getAvatarFull return Utils.baseURI + "avatar-rs/" + @@name + "/full.png" end |
#getClan ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/rs_api-ruby/player.rb', line 35 def getClan uri = URI.encode(Utils.baseURI + "website-data/playerDetails.ws?names=[\"" + @@name + "\"]&callback=jQuery000000000000000_0000000000") jsonRequest = open(uri).read jsonRequest = jsonRequest.gsub("jQuery000000000000000_0000000000([", "") jsonRequest = jsonRequest.gsub("]);", "") data = JSON.parse(jsonRequest) return { "clan" => data["clan"], "recruiting" => data["recruiting"] } end |
#getName ⇒ Object
31 32 33 |
# File 'lib/rs_api-ruby/player.rb', line 31 def getName return @@name end |
#getTitle ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/rs_api-ruby/player.rb', line 44 def getTitle uri = URI.encode(Utils.baseURI + 'website-data/playerDetails.ws?names=["' + @@name + '"]&callback=jQuery000000000000000_0000000000') jsonRequest = open(uri).read jsonRequest = jsonRequest.gsub("jQuery000000000000000_0000000000([", "") jsonRequest = jsonRequest.gsub("]);", "") json = JSON.parse(jsonRequest) return json["title"] end |