Module: Spotlight::Resources::Web
- Extended by:
- ActiveSupport::Concern
- Included in:
- OpenGraph
- 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
28 29 30 31 32 33 |
# File 'app/models/concerns/spotlight/resources/web.rb', line 28 def self.fetch(url) Faraday.new(url) do |b| b.use FaradayMiddleware::FollowRedirects b.adapter :net_http end.get end |
Instance Method Details
#body ⇒ Object
22 23 24 25 26 |
# File 'app/models/concerns/spotlight/resources/web.rb', line 22 def body harvest! if data[:body].blank? @body ||= Nokogiri::HTML.parse data[:body] end |