Skip to content

mech/smbglobal-sms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smbglobal::Sms

Build Status Code Climate

This gem is a wrapper to send SMS using SMBGlobal HTTP API.

Installation

Add this line to your application's Gemfile:

gem 'smbglobal-sms'

And then execute:

$ bundle

Or install it yourself as:

$ gem install smbglobal-sms

Configuration

We get credential from your environment variables, please set your API's username and password via:

SMBGLOBAL_USERNAME
SMBGLOBAL_PASSWORD

To overwrite the host name, you can create a smbglobal_sms.rb file:

SmbglobalSms.configure do |config|
  config.host_name = "api.smbglobal.net"
end

Usage

You need to create a SmbglobalSms::Request object in order to send SMS.

transaction_id = get_any_integer_unique_id
request  = SmbglobalSms::Request.new
response = request.send_sms(transaction_id, "Meet you at 5", [87656765, 98765676])

A SmbglobalSms::Response object will be returned to you to check for status and remaining credits.

response.status  #=> 100
response.credits #=> 4500

Please note that credits reflected has been normalized, which means if you see 4500 credits left, you can send 4500 more SMS messages. SMBGlobal usually uses 4 credits for 1 SMS message, but in order to simplify thing, we will use 1 credit for 1 SMS message.

Unicode string for SMS

http://sms.24cro.com/op_1_4_en.htm http://spin.atomicobject.com/2010/07/28/converting-to-utf-16-ucs-2-with-iconv/

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

Send SMS using SMBGlobal API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages