Sha256: ceb5667bee843070a31e2a4e72aef82edc38c94195f1fcb76bc09f54d0532f3f

Contents?: true

Size: 809 Bytes

Versions: 2

Compression:

Stored size: 809 Bytes

Contents

require 'atom'

module RingCentral
  module RSS
    class AtomFeed
      attr_accessor :feed

      def initialize(response = nil, opts = {})
        if opts.key?(:feed_name) && opts[:feed_name]
          @feed_name = opts[:feed_name]
        else
          @feed_name = 'RingCentral Feed'
        end
        load_message_store_response(response) unless response.nil?
      end

      def load_message_store_response(response)
        @feed = Atom::Feed.new do |f|
          f.title = @feed_name
          f.links << Atom::Link.new(href: "#{response.body['uri']}")
          f.updated = Time.parse("#{response.headers['date']}")
          response.body['records'].each do |message|
            f.entries << RingCentral::RSS::AtomEntry.new(message).entry
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ringcentral-rss-0.0.2 lib/ringcentral-rss/atom_feed.rb
ringcentral-rss-0.0.1 lib/ringcentral-rss/atom_feed.rb