Jabbify is a simple messaging service that one can plug into their website with a few lines of Javascript. At the heart of Jabbify is a centralized, ready-to-use Comet server.
You can utilize their Comet service via the Javascript API, or by creating a simple GET or POST request along with the necessary parameters. This library attempts to simplify creation of that request.
$ sudo gem install rjab
require 'rubygems'
require 'jabbify'
If you only make one message delivery in your app, you might find it easiest to use the class method:
Jabbify::Comet.deliver(
:api_key => 'YourApiKeyGoesHere',
:type => :type_of_delivery,
:action => :action_of_delivery,
:name => 'John Doe',
:message => 'This is the message!',
:to => 'Jane Doe',
)
More commonly, you will instantiate an instance of Jabbify::Comet
with a few customized attributes. Keep in mind that there a few default attributes set for you; they are denoted below. Then you can just call #deliver
whenever you're ready, passing in a couple more attributes which will only be used during the delivery:
custom_attributes = {
:api_key => 'YourApiKeyGoesHere',
:name => 'The Server'
}
@comet = Jabbify::Comet.new(custom_attributes)
if @comet.deliver(:message => "A special message at #{ Time.now.to_s }")
# do something
else
# do something else
end
Attribute | Default Value | Description |
---|---|---|
:action |
:create |
The action you are performing against the type, as a symbol. Commonly a RESTful action. |
:api_key |
nil |
Required. The API key provided to you when you sign up with Jabbify. |
:message |
nil |
Required. The message to deliver to the Comet server. |
:name |
'Server' |
Required. The sender of the message. |
:to |
nil |
The recipient of the message. Not usually specified, as most messages are sent to all users. |
:type |
:message |
The type of resource you are working with, as a symbol. |