Class: Player::EOC

Inherits:
Object
  • Object
show all
Defined in:
lib/rs_api-ruby/player.rb

Instance Method Summary collapse

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

#getAvatarChatObject



57
58
59
# File 'lib/rs_api-ruby/player.rb', line 57

def getAvatarChat
  return Utils.baseURI + "avatar-rs/" + @@name + "/chat.png"
end

#getAvatarFullObject



53
54
55
# File 'lib/rs_api-ruby/player.rb', line 53

def getAvatarFull
 return Utils.baseURI + "avatar-rs/" + @@name + "/full.png"
end

#getClanObject



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

#getNameObject



31
32
33
# File 'lib/rs_api-ruby/player.rb', line 31

def getName
  return @@name
end

#getTitleObject



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