0.01
No commit activity in last 3 years
No release in over 3 years
Provides an interface to SMS Gateways. So far it supports smsglobal.com and smstrade.de
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0

Runtime

 Project Readme

SMS Gateway¶ ↑

The SMS Gateway gem provides a simple and extensible interface for various SMS Gateways. It is loosely oriented on Action Mailer. The gem allows you to create an SMS and deliver it synchronously or asynchronously. So far it ships with the following adapters:

  • smsglobal.com

  • smstrade.de

Installation¶ ↑

You install the gem in your rails app by adding it your Gemfile:

gem "sms_gateway"

After that you run the bundle:install task and then invoke the gem’s generator:

rails g sms_gateway:install

which installs an initializer and a yml file that you will need to configure before sending out an SMS.

Resque and Redis¶ ↑

To deliver SMS asynchronously this gem makes use of resque, a popular queing system basd on the key-value data store redis. You need to have a working resque and redis setup if you want to use the aynchronous sending feature. For more information on resque visit github.com/defunkt/resque .

Usage¶ ↑

Similar to action mailer you create a message object first:

m = SmsGateway::Sms.new(:from => '493088888888, :to => '49309999999',
      :text => 'my sms must not be longer than 160 characters.')

And then deliver it with:

m.deliver

This will block until the the HTTP call is complete. As with email it’s better practice to enqueue the call:

m.deliver_later

This will be non-blocking and is the recommended way of sending an SMS. This requires a resque worker, though, to get actually sent (see the resque documentation):

rake resque:work

Outlook and Todo¶ ↑

So far the gem is pretty limited. Ideas for following version are:

  • more and better unit tests

  • more sms gateway apis

  • decoupling of resque

  • error handling

License¶ ↑

GPLv3. Copyright 2011 Kai Rubarth.