A Ruboty Handler + Actions to enable routing function to Ruboty.
Ruboty is Chat bot framework. Ruby + Bot = Ruboty
Add this line to your application's Gemfile:
gem 'ruboty-router'
And then execute:
$ bundle
WEBrick will start with port 9292 by default, when starting Ruboty.
You can define routings by Ruboty::Routers class. Sample is below:
module Ruboty
module Routers
class Sample < Base
route('/sample', name: 'sample', description: 'sample router.')
route('/sample/child', name: 'child', description: 'sample router.')
def sample(req, res)
res.write 'This is sample.'
robot.say(body: 'something to say', to: '#general')
end
def child(req, res)
res.write 'This is sample for multiple definition.'
robot.say(body: 'something to say for /sample/child', to: '#general')
end
end
end
end
route(<path>, name: <method_name>, description: <description>)
- Add routing
<path>
must start with '/'
def sample(req, res)
- Routing method definition
- Method receive Rack::Request and Rack::Response
Name | Description |
---|---|
RUBOTY_ROUTER_PORT | HTTP listen port (default: 9292) |
- Fork it ( https://github.com/zeero/ruboty-router/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request