Module: OvercastAPI
- Defined in:
- lib/overcast_api.rb,
lib/overcast_api/version.rb
Defined Under Namespace
Classes: Infraction, Player, PvPEncounter, Rank, Trophy
Constant Summary collapse
- BASE_URL =
'http://oc.tc'- VERSION =
"0.0.2"
Class Method Summary collapse
- .clean(str) ⇒ Object
-
.enter_container(base_node) ⇒ Object
Remove <html> & <body>.
- .player(username) ⇒ Object
Class Method Details
.clean(str) ⇒ Object
20 21 22 |
# File 'lib/overcast_api.rb', line 20 def self.clean(str) str.gsub "\n", '' end |
.enter_container(base_node) ⇒ Object
Remove <html> & <body>
10 11 12 |
# File 'lib/overcast_api.rb', line 10 def self.enter_container(base_node) base_node.xpath "/html/body/div[@class='container']" end |
.player(username) ⇒ Object
14 15 16 17 18 |
# File 'lib/overcast_api.rb', line 14 def self.player(username) resp = HTTParty.get("#{BASE_URL}/#{username}") html = Nokogiri::HTML resp.parsed_response Player.new(enter_container(html)) end |