aggregator/rss.rb
## Use simple-rss to get the latest feed data for
#  the current feed URI/source
Use simple-rss to get the latest feed data for
the current feed URI/source
Use simple - rss to get the latest feed data for the current feed URI / source
def fetch_feed
    endpoint = @current_feed.values.first
    begin
      document = SimpleRSS.parse(URI.open(endpoint, 'User-Agent' => 'Ruby-wget'))
    rescue StandardError => e
      puts "Error: <#{e}> while trying to call <#{@current_feed_link}>"
      document = { title: Rss::NO_VALUE, items: {} }
    end
    @cache[@current_feed.keys.first] = JSON.parse(document.items.to_json)
  end
def fetch_feed endpoint = @current_feed . values . first begin document = SimpleRSS . parse ( URI . open ( endpoint , 'User-Agent' => 'Ruby-wget' ) ) rescue StandardError => e puts "Error: <#{e}> while trying to call <#{@current_feed_link}>" document = { title : Rss :: NO_VALUE , items : { } } end @cache [ @current_feed . keys . first ] = JSON . parse ( document . items . to_json ) end
Use simple-rss to get the latest feed data for
the current feed URI/source
Use simple - rss to get the latest feed data for the current feed URI / source
# effectively skip document # Ensuring string access instead of symbol access. # I know there's probably a better way to do this... # but I can't remember if with_indifferent_access is # a rails thing...