Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/technohippy/ruby-wave-robot-api
An API for writing Wave Robots in Ruby
https://github.com/technohippy/ruby-wave-robot-api
Last synced: 4 months ago
JSON representation
An API for writing Wave Robots in Ruby
- Host: GitHub
- URL: https://github.com/technohippy/ruby-wave-robot-api
- Owner: technohippy
- License: mit
- Created: 2010-07-13T16:27:42.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2010-07-28T03:08:36.000Z (over 14 years ago)
- Last Synced: 2023-04-12T11:03:54.391Z (almost 2 years ago)
- Language: Ruby
- Homepage: http://reviewmycode.blogspot.com/2010/07/wave-robot-api-on-ruby.html
- Size: 227 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE.txt
Awesome Lists containing this project
README
Ruby Wave Robot API
===================What is this
------------This library allows you to develop a wave robot with Ruby language and to run it on any server other than GAE.
Note
----This library is under construction. Files in the examples directory are the only codes I've confirmed to work.
* Events
* WaveletCreated
* WaveletSelfAdded
* WaveletParticipantsChanged
* BlipSubmitted
* Actions
* blip.append
* blip.first
* blip.insert_inline_blip
* blip_ref.update_element
* wavelet.reply
* wavelet.proxy_for
* wavelet.append_markup
* wavelet.submit_with
* robot.new_wave
* Elements
* Image
* GadgetHow to try the sample on [Heroku](http://heroku.com)
-------------------------------1. Register your robot's domain in accordance with:
[http://code.google.com/intl/ja/apis/wave/extensions/robots/registration.html](http://code.google.com/intl/ja/apis/wave/extensions/robots/registration.html)
2. Push all files to your heroku repository
3. Add your robot to a wave as a participantSample
------require 'rubygems'
require 'sinatra'
require 'waveapi'robot = Waveapi::Robot.new(
'Ruby Robot',
:base_url => '/sample-robot',
:image_url => 'http://ruby-wave-robot-api.heroku.com/images/icon.png',
:profile_url => 'http://ruby-wave-robot-api.heroku.com'
)robot.register_handler(Waveapi::WaveletSelfAddedEvent) do |event, wavelet|
wavelet.reply("\nHi everybody! I'm a Ruby robot!")
endrobot.register_handler(Waveapi::WaveletParticipantsChangedEvent) do |event, wavelet|
new_participants = event.participants_added
new_participants.each do |new_participant|
wavelet.reply("\nHi : #{new_participant}")
end
endrobot.register_handler(Waveapi::BlipSubmittedEvent) do |event, wavelet|
blip = event.blipwavelet.title = 'A wavelet title'
blip.append(Waveapi::Image.new('http://www.google.com/logos/clickortreat1.gif', 320, 118))
wavelet.proxy_for('douwe').reply().append('hi from douwe')
inline_blip = blip.insert_inline_blip(5)
inline_blip.append('hello again!')new_wave = robot.new_wave(wavelet.domain, wavelet.participants, wavelet.to_json)
new_wave.root_blip.append('A new day and a new wave')
new_wave.root_blip.append_markup('Some stuff!
Not the beautiful
')
new_wave.submit_with(wavelet)
endrobot.start
Contact
-------
Ando Yasushi (andyjpn _at_ gmail.com)* [http://reviewmycode.blogspot.com/](http://reviewmycode.blogspot.com/)
* [http://d.hatena.ne.jp/technohippy/](http://d.hatena.ne.jp/technohippy/)
* [http://twitter.com/technohippy](http://twitter.com/technohippy)