This gem is a wrapper to send SMS using SMBGlobal HTTP API.
Add this line to your application's Gemfile:
gem 'smbglobal-sms'
And then execute:
$ bundle
Or install it yourself as:
$ gem install smbglobal-sms
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
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.
http://sms.24cro.com/op_1_4_en.htm http://spin.atomicobject.com/2010/07/28/converting-to-utf-16-ucs-2-with-iconv/
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request