Project

rjab

0.0
No commit activity in last 3 years
No release in over 3 years
A Ruby library for interacting with Jabbify. Simplifies the process of delivering messages to Jabbify's Comet server.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.9.2
 Project Readme

RJab: a Ruby library for Jabbify

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.

Installing the Gem

$ sudo gem install rjab

Utilizing the Library

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

Default Attributes on the Jabbify::Comet Class

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.