SMSCentre
Send SMS via SMS Centre gateway
Installation
Add this line to your application's Gemfile:
gem 'sms_centre'
And then execute:
$ bundle
Or install it yourself as:
$ gem install sms_centre
Usage
-
Register at http://smscentre.com
-
Create api object:
api = SMSCentre::API.new('your_login', 'your_password')
-
Send sms:
result = api.broadcast('PHONENUMBER1', 'This is message text')
result = api.broadcast(['PHONENUMBER1', ...], 'This is message text')
result = api.broadcast('PHONENUMBER1', 'This is message text', params: {sender: 'SENDER NAME', id: 'MESSAGE_ID'}
result.status_for 'PHONENUMBER1'
result.human_status_for 'PHONENUMBER1'
-
Get sms status by phone number and message id:
status = api.status('MESSAGE_ID', 'PHONENUMBER1')
status.status
status.human_status
status.delivered?
status.pending?
status.failed?
-
Check your balance:
api.balance
# => '999.99'
Configure
Paste this code in some file, load it before send sms (rails hint: initializer is the best place to do it)
SMSCentre.configure.do |config|
# For example, disable SSL
config.use_ssl = false
end
See options list in source code
Contributing
- Fork it
- 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 new Pull Request