Class: RSSable::Processor

Inherits:
Object
  • Object
show all
Defined in:
lib/rssable/processor.rb

Class Method Summary collapse

Class Method Details

.call(url:) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rssable/processor.rb', line 3

def self.call(url:)
  # Returns the RSSable::Parsers::Channel instance
  # If the feed URL is not detected it returns nil
  #
  # @return [RSSable::Parsers::Channel]
  urls = RSSable::Detection::FeedFinder.call(url: url)
  feed_url, driver = RSSable::Detection::EngineDetector.call(
    urls: urls, source_url: url
  )

  return if feed_url.nil?

  response = RestClient.get(feed_url)

  RSSable::Parsers::Channel.new(
    feed: response.body, driver: driver
  )
end