Git Product home page Git Product logo

sms-gateway's Introduction

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.

sms-gateway's People

Contributors

learnjin avatar

Stargazers

Emil Petkov avatar Enrico Stano avatar  avatar Shenouda Bertel avatar

Watchers

 avatar James Cloos avatar Toreans Engineering avatar

sms-gateway's Issues

Error sir!

Error during invoke gem generator, I'd :

  • add new gem into +Gemfile+

gem "sms_gateway"

  • then I run +bundle install+
  • for doing invoke, I run +rails g smsgateway:install+ and error :(

the error is :

Could not find generator 'sms_gateway:install'. Maybe you meant 'system_test', 'generator' or 'scss:assets'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.