Class: BriarScraper

Inherits:
Object
  • Object
show all
Defined in:
lib/itinerary/briar_scraper.rb

Constant Summary collapse

CacheDir =
Pathname.new(__FILE__).dirname + '../cache'

Instance Method Summary collapse

Constructor Details

#initializeBriarScraper

Returns a new instance of BriarScraper.



13
14
15
16
17
18
19
20
21
22
# File 'lib/itinerary/briar_scraper.rb', line 13

def initialize
  @cache = Cache.new(CacheDir)
  @base_uri = URI.parse('http://www.briarpress.org')
  @conn = Faraday.new(:url => @base_uri) do |c|
    # c.use Faraday::Response::Logger
    c.use FaradayMiddleware::ParseHTML
    c.use FaradayMiddleware::Caching, @cache
    c.adapter Faraday.default_adapter
  end
end

Instance Method Details

#scrape_state(state) ⇒ Object



24
25
26
27
# File 'lib/itinerary/briar_scraper.rb', line 24

def scrape_state(state)
  # ;;warn "Scraping state #{state.inspect}"
  scrape_state_with_uri(uri_for_state(state))
end