Class OpenWFE::Extras::BlogParticipant
In: lib/openwfe/extras/participants/atompub_participants.rb
Parent: AtomPubParticipant

A participant that blogs.

   require 'openwfe/extras/participants/atompub_participants'
   include OpenWFE::Extras

   target_uri = "https://openwferu.wordpress.com/wp-app.php/posts"

   params = {}
   params[:username] = 'jeff'
   params[:password] = 'whatever'

   params[:categories] = 'openwferu, test'

   #params[:title_field] = "title"
       #
       # which workitem field will hold the post title ?
       # by default, it's "title"

   engine.register_participant "blogger", BlogParticipant.new(target_uri, params) do
       """
           paragraph 0

           paragraph 1 : ${f:message}

           paragraph 2
       """
   end

This participant takes its template and the workitem it receives to publish a blog entry.

The template can be specified as a block (as in the previous example) or via the :template parameter.

Methods

Included Modules

OpenWFE::TemplateMixin

Public Class methods

[Source]

     # File lib/openwfe/extras/participants/atompub_participants.rb, line 245
245:         def initialize (target_uri, params, &block)
246: 
247:             super
248: 
249:             @template = params[:template]
250:             @block_template = block
251: 
252:             @content_type = params[:content_type] || "html"
253: 
254:             @title_field = params[:title_field] || "title"
255:         end

Protected Instance methods

[Source]

     # File lib/openwfe/extras/participants/atompub_participants.rb, line 259
259:             def render_content (entry, workitem)
260: 
261:                 entry.title = workitem.attributes[@title_field].to_s
262: 
263:                 entry.content = eval_template workitem
264:                 entry.content["type"] = @content_type
265:             end

[Validate]