class EchoLink::Scraper

Public Instance Methods

Private Instance Methods

clean_status(status) click to toggle source
# File lib/echo_link/scraper.rb, line 64
def clean_status(status)
  case status.downcase
  when 'off' then 'offline'
  when 'conn' then 'connected'
  when 'online' then 'online'
  else
    'unknown'
  end
end
curl(url) click to toggle source
# File lib/echo_link/scraper.rb, line 74
def curl(url)
  http = Curl.get(url) do |http|
    http.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36'
  end
end
html(url) click to toggle source
# File lib/echo_link/scraper.rb, line 80
def html(url)
  http = curl(url)
  html = Nokogiri::HTML(http.body_str)
end