WaseEndpoint is a library for building daemons that act as WASE Endpoints for the EngineYard Wase competition: bit.ly/3qRMbv
WaseEndpoint is hosted by gemcutter.com. Please make sure you have added them to your gem sources.
$ sudo gem install wase_endpoint
The following are all in the example directory.
Your endpoint logic:
# example/my_endpoint.rb require 'rubygems' require 'wase_endpoint' class MyEndpoint < WaseEndpoint # This where our logic goes. # A json encoded String is the only argument. You can deal with this however # you want. The JSON library is already loaded should you wish to use it. # Return another String, or a Hash containing the String and the program # counter increment you wish to use. def secret_sauce(raw_json) # Just pass it back. Program counter increment will be 1. raw_json # Or pass it back with a custom program counter. # { :data => raw_json, :increment => 2} end end
The init file:
# example/init.rb require 'my_endpoint' MyEndpoint.new( :username => 'twitter_username', :password => 'twitter_password', :logfile => 'my_endpoint.log', :sleep_period => 60 )
Now running the init file will start your daemon. The PID will be returned to allow you to monitor it or kill it later.
ruby init.rb
That’s it! I also included a basic sinatra server in ‘server.rb’ that can be used as an input/output/program-listing node.
Issues can be tracked on github: github.com/dougal/wase_endpoint/issues
All of the above are most welcome. dougal.s@gmail.com
Douglas F Shearer - douglasfshearer.com