Sha256: 4f4faefa83ed8232c8f1e4318189d9e65a6c15d39818fdc9d91e854fc8e5cdbe

Contents?: true

Size: 733 Bytes

Versions: 2

Compression:

Stored size: 733 Bytes

Contents

require 'open-uri'
require 'simple-rss'

module Stratify
  module Instapaper
    class Query
      attr_reader :rss_url

      def initialize(rss_url)
        @rss_url = rss_url
      end

      def activities
        raw_activities.map {|raw_activity| build_activity_from_raw_data(raw_activity)}
      end

      private

      def raw_activities
        rss = SimpleRSS.parse open(rss_url)
        rss.items
      end

      def build_activity_from_raw_data(raw_activity)
        Stratify::Instapaper::Activity.new({
          :url => raw_activity.link,
          :title => raw_activity.title,
          :description => raw_activity.description,
          :created_at => raw_activity.pubDate
        })
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stratify-instapaper-0.1.4.1 lib/stratify-instapaper/query.rb
stratify-instapaper-0.1.4 lib/stratify-instapaper/query.rb