Module: Crags::Fetcher

Included in:
Category, Country, Search::Location
Defined in:
lib/crags/fetcher.rb

Instance Method Summary collapse

Instance Method Details

#fetch_doc(url) ⇒ Object



3
4
5
# File 'lib/crags/fetcher.rb', line 3

def fetch_doc(url)
  Hpricot.parse(fetch_html(url))
end

#fetch_html(url) ⇒ Object



7
8
9
10
# File 'lib/crags/fetcher.rb', line 7

def fetch_html(url)
  req = fetch_request(url)
  req.body_str
end

#fetch_request(url) ⇒ Object



12
13
14
15
16
17
# File 'lib/crags/fetcher.rb', line 12

def fetch_request(url)
  req = Curl::Easy.new(url)
  req.follow_location = true
  req.perform
  req
end