In my last post, I showed you how you can use ActiveResource to interact with MessagePub. I’ve also wrote a gem that makes interacting with MessagePub even easier.
To get started, install the gem:
sudo gem install messagepub
Code is worth a thousand words so I’ll leave you with this code sample:
require 'rubygems'
require 'messagepub'
client = MessagePub::Client.new('YOUR API KEY')
notification = MessagePub::Notification.new
notification.body = 'So and so has added you as a friend.'
notification.escalation = 20
notification.add_recipient(MessagePub::Recipient.new(:position => 1, :channel => 'twitter', :address => 'joetheplumber'))
notification.add_recipient(MessagePub::Recipient.new(:position => 2, :channel => 'email', :address => 'joe@example.com'))
client.create!(notification)
The gem is on RubyForge, the code on github and we have a Google Group where you can ask questions.

