Project

sms-club

0.0
No commit activity in last 3 years
No release in over 3 years
Client for http://smsclub.mobi/ SMS gate. Allows you to send and retrieve status of sent SMS via XML API. Supports Resque for asynchronous sending.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 3.0
~> 1.18

Runtime

~> 0.9
~> 1.6
~> 0.1
 Project Readme

SmsClub API Client Gem Version

Client for http://smsclub.mobi/ SMS gate. Allows you to send and retrieve status of sent SMS via XML API.

Installation

Add this line to your application's Gemfile:

gem 'sms-club'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sms-club

Usage

Create new client first. Constructor accepts your login, password for smsclub.mobi and optional default from argument

SmsClub::Client.new '380993123123', 'password', from: 'CoolCompany'
#=> #<SmsClub::Client:0x000000051f9320 @user_name="380993123123", @password="password", @from="CoolCompany", @transliterate=false>

You can also turn on transliteration option by default

client = SmsClub::Client.new '380993123123', 'password', transliterate: true
#=> #<SmsClub::Client:0x000000051b14d0 @user_name="380993123123", @password="password", @from=nil, @transliterate=true>

Sending SMS to multiple numbers at once

client.send 'test', to: ['+380664018206', '+380666018203', '+380666018202']
#=> ["ID_1", "ID_2", "ID_N"]

Send sms to one number

client.send_one 'test', to: '+380666128206'
#=> "ID_1"

Get status of SMS

client.status_for 'ID_1'
#=> :delivrd

client.statuses_for ['ID_1', 'ID_2']
#=> { 'ID_1' => :delivrd }, { 'ID_2' => :delivrd }

For more info please see original api docs http://smsclub.mobi/en/pages/show/api#xml

Resque

It also support asynchronous SMS sending with Resque gem

require 'sms-club/resque'
client = SmsClub::AsyncClient.new '380993123123', 'password', from: 'CoolCompany'
client.send_async 'async test', to: ['+380664018206', '+380666018203', '+380666018202']

When Redis server is not available it automatically switches to synchronous mode.

Make sure Resque is added to your Gemfile.

Contributing

  1. Fork it ( https://github.com/pavel-d/sms-club/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request