class Fletcher::Data
This class is responsible for fetching and parsing data.
Public Class Methods
read(url, options = {})
click to toggle source
Get read url and get data object
# File lib/fletcher/data.rb, line 8 def self.read(url, options = {}) response = open(url, "User-Agent" => Fletcher::USER_AGENT) doc = ::Nokogiri::HTML(response.read) # Save contents of URL/Remote File for debugging # response.rewind # last_response_file = File.expand_path(File.join("..", "..", "last_response"), File.dirname(__FILE__)) # File.new(last_response_file, "w+").write(response.read) return doc end