Module: Spotlight::Resources::Web
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/spotlight/resources/web.rb
Overview
Generic web resource harvester base module
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.fetch(url) ⇒ Object
30 31 32 33 34 35 |
# File 'app/models/concerns/spotlight/resources/web.rb', line 30 def self.fetch(url) Faraday.new(url) do |b| b.use FaradayMiddleware::FollowRedirects b.adapter Faraday.default_adapter end.get end |
Instance Method Details
#body ⇒ Object
24 25 26 27 28 |
# File 'app/models/concerns/spotlight/resources/web.rb', line 24 def body harvest! if data[:body].blank? @body ||= Nokogiri::HTML.parse data[:body] end |