Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Tree: d9e3cb8879
Fetching contributors…

Cannot retrieve contributors at this time

79 lines (54 sloc) 2.686 kB


Ruote 2.0 participant which does a HTTP call using rufus-jig (, a HTTP client, greedy with JSON content.

By default, it POSTs received workitems as JSON to a HTTP server and stores the answer back into the workitem. If the answer is in JSON, it is automatically converted into Ruby data types (this magic is thanks to rufus-jig).

The handling of outgoing and incoming data may be customized by Procs.


require 'yajl' # by default, you will need some JSON lib (yajl-ruby or json_pure or ActiveSupport)

# require this lib
require 'ruote/jig/part/jig_participant'

# let's assume you have a ruote engine in '''engine'''
engine.register_participant :jig_default, Ruote::Jig::JigParticipant
engine.register_participant :jig_advanced,
  :host              => 'somehost',
  :port              => 80,
  :path              => '/path/to/the/magic',
  :method            => :post,
  :content_type      => 'foo/bar',
  :data_preparition  => {|workitem| workitem.fields['foo_bar'].to_s},
  :response_handling => do |response, workitem|
    workitem.set_field('incoming_foo_bar', FooBar.from_str(response.body))

# in a workflow definition...
participant :ref => 'jig_default' # will POST the current workitem as JSON
                                  # to and save the
                                  # responded data in the workitem field
                                  # \_\_jig_response__

participant :ref => 'jig_advanced', # will PUT the the string returned by
  :host   => 'anotherhost',         # workitem.fields['foo_bar'].to_s to
  :path   => '/path/to/bar',        # http://anotherhost:80/path/to/bar,
  :method => :put                   # processes the response body and
                                    # saves the result in the workitem
                                    # field 'incoming_foo_bar'

running tests

to run unit tests

ruby test/test.rb

fakeweb and yajl-ruby have to be installed.





mailing list

irc #ruote


Many thanks to John Mettraux ( for his tireless work on Ruote and the many rufus libs. Thanks to Kenneth Kalmer ( for his work on rufus-jig.

Jump to Line
Something went wrong with that request. Please try again.