# # The demo server from whytheluckystiff.net. # require 'okay/rpc' s = Okay::RPC::ModRubyServer.new s.name = "The !okay/rpc Demo Server" s.add_author( 'why the lucky stiff', 'okay-rpc@whytheluckystiff.net', 'http://whytheluckystiff.net/' ) s.about = < y[1] } } # examples.addtwo s.add_handler( "examples.addtwo", %w(int int int), "Add two integers together and return the result." ) { |meth| meth.params[0] + meth.params[1] } # examples.addtwofloat s.add_handler( "examples.addtwofloat", %w(float float float), "Add two floats together and return the result." ) { |meth| meth.params[0] + meth.params[1] } # examples.stringecho s.add_handler( "examples.stringecho", %w(str str), "Accepts a string parameter, returns the string." ) { |meth| meth.params[0] } # examples.echo s.add_handler( "examples.echo", %w(str str), "Accepts a string parameter, returns the entire incoming payload." ) { |meth| meth } # examples.base64 s.add_handler( "examples.base64", %w(str str), "Accepts a base64 parameter and returns it decoded as a string." ) { |meth| [meth.params[0]].pack( "m" ) } # examples.invertBooleans s.add_handler( "examples.invertBooleans", %w(seq seq), "Accepts an array of booleans, and returns them inverted." ) { |meth| meth.params[0].collect{ |x| !x } } s.serve