Method: OpenWFE::Extras::ActivityFeedService#get_feed

Defined in:
lib/openwfe/extras/misc/activityfeed.rb

#get_feed(participant_regex, options = {}) ⇒ Object

Returns an Atom feed of all the workitem activity for the participants whose name matches the given regular expression.

Options :

:upon

can be set to either nil, :apply, :reply. :apply states that the returned feed should only contain entries about participant getting applied, :reply only about participant replying.

:feed_uri

the URI for the feed. Defaults to ‘localhost/feed

:feed_title

the title for the feed. Defaults to ‘OpenWFEru engine activity feed’

:format

yaml|text|json



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/openwfe/extras/misc/activityfeed.rb', line 166

def get_feed (participant_regex, options={})

    participant_regex = Regexp.compile(participant_regex) \
        if participant_regex.is_a?(String)

    upon = options[:upon]
    feed_uri = options[:feed_uri] || "http://localhost/feed"
    title = options[:feed_title] || "OpenWFEru engine activity feed"

    feed = Atom::Feed.new feed_uri
    feed.title = title

    format = options[:format]
    format = validate_format(format)

    @entries.each do |e|

        next unless participant_regex.match(e.participant_name)
        next if upon and upon != e.upon

        feed.updated = e.updated \
            if feed.updated == nil or e.updated > feed.updated

        feed << as_atom_entry(format, e)
    end

    feed
end