<commit_before>require 'open-uri'

module Jobs
  class PollWebsiteFeed < Autobot::Jobs::Base
    require 'simple-rss'

    def execute(args)
      @feed_url = campaign[:key]
      last_polled_at = campaign[:last_polled_at]

      rss = fetch_rss
      if rss.present?
        if last_polled_at.present?
          build_date = rss.channel.lastBuildDate || rss.channel.pubDate
          return if build_date.present? && build_date < last_polled_at
        end

        rss.items.each do |i|
          creator = Autobot::Website::PostCreator.new(campaign, i)
          creator.create
          return unless last_polled_at.present?
        end
      end
    end

    private

      def fetch_rss
        SimpleRSS.parse open(@feed_url, allow_redirections: :all)
      rescue OpenURI::HTTPError, SimpleRSSError
        nil
      end

  end
end
<commit_msg>FIX: Wrong method name<commit_after>require 'open-uri'

module Jobs
  class PollWebsiteFeed < Autobot::Jobs::Base
    require 'simple-rss'

    def poll(campaign)
      @feed_url = campaign[:key]
      last_polled_at = campaign[:last_polled_at]

      rss = fetch_rss
      if rss.present?
        if last_polled_at.present?
          build_date = rss.channel.lastBuildDate || rss.channel.pubDate
          return if build_date.present? && build_date < last_polled_at
        end

        rss.items.each do |i|
          creator = Autobot::Website::PostCreator.new(campaign, i)
          creator.create
          return unless last_polled_at.present?
        end
      end
    end

    private

      def fetch_rss
        SimpleRSS.parse open(@feed_url, allow_redirections: :all)
      rescue OpenURI::HTTPError, SimpleRSSError
        nil
      end

  end
end

{'fraction_non_alphanumeric': 0.07992998833138856, 'fraction_numerical': 0.0, 'mean_word_length': 2.349609375, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3613461', 'n_tokens_mistral': 561, 'n_tokens_neox': 540, 'n_words': 117}