Class: Weneedfeed::Scraping
- Inherits:
-
Object
- Object
- Weneedfeed::Scraping
- Defined in:
- lib/weneedfeed/scraping.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Weneedfeed::Page
-
#initialize(description:, item_description_selector:, item_image_selector:, item_link_selector:, item_time_selector:, item_title_selector:, item_selector:, title:, url:) ⇒ Scraping
constructor
A new instance of Scraping.
Constructor Details
#initialize(description:, item_description_selector:, item_image_selector:, item_link_selector:, item_time_selector:, item_title_selector:, item_selector:, title:, url:) ⇒ Scraping
Returns a new instance of Scraping.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/weneedfeed/scraping.rb', line 26 def initialize( description:, item_description_selector:, item_image_selector:, item_link_selector:, item_time_selector:, item_title_selector:, item_selector:, title:, url: ) @description = description @item_description_selector = item_description_selector @item_image_selector = item_image_selector @item_link_selector = item_link_selector @item_time_selector = item_time_selector @item_title_selector = item_title_selector @item_selector = item_selector @title = title @url = url end |
Class Method Details
.faraday_connection ⇒ Faraday::Connection
10 11 12 13 14 |
# File 'lib/weneedfeed/scraping.rb', line 10 def faraday_connection @faraday_connection ||= ::Faraday.new do |connection| connection.use ::Weneedfeed::FaradayResponseMiddleware end end |
Instance Method Details
#call ⇒ Weneedfeed::Page
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/weneedfeed/scraping.rb', line 49 def call ::Weneedfeed::Page.new( description: @description, node: parsed_body, item_description_selector: @item_description_selector, item_image_selector: @item_image_selector, item_selector: @item_selector, item_link_selector: @item_link_selector, item_time_selector: @item_time_selector, item_title_selector: @item_title_selector, title: @title, url: @url ) end |