A Ruby wrapper for the Celltrust API.
Add this line to your application's Gemfile:
gem 'celltrust'
And then execute:
$ bundle
Or install it yourself as:
$ gem install celltrust
First you need to load up the gem and construct a Celltrust::Client object with your API credentials, like this:
require 'celltrust'
# simple sms
celltrust = Celltrust::SimpleSMSClient.new('username', 'password', 'nickname')
#secure sms
celltrust = Celltrust::SecureSMSClient.new('username', 'password', 'nickname')
Sending a SMS
response = celltrust.send_sms('number', 'message', params = {})
if response.ok?
# do something with response.object
else
puts response.error?
puts response.error_details
# handle the error
end
Remember that phone numbers should be specified in international format.
The Celltrust documentation contains a list of error codes which may be useful if you have problems sending a message.
Please report all bugs/issues via the GitHub issue tracker.
- Fork it ( https://github.com/raivil/celltrust/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request