SmsManager
A Ruby SDK for smsmanager.cz - Czech SMS provider. Supports SMS sending and error handling. Uses legacy endpoint.
Installation
bundle add sms_manager
Usage
First you need to setup your credentials:
SmsManager.configure do |config|
config.username = YOUR_USERNAME
config.hashed_password = HASHED_PASSWORD
endCreate the password hash with SHA-1 in console and then put the string into the configuration block:
require 'digest/sha1'
Digest::SHA1.hexdigest 'password'That's all. Now you can send SMS messages.
SmsManager.send number: '+420123456789', message: 'Hello!'You can pass all the parameters available at SmsManager API. These additional parameters will be appended to the request:
SmsManager.send number: '+420123456789', message: 'Hello!', gateway: 'lowcost', time: '2013-01-01T23:59:59'If the service fails an exception is raised:
begin
SmsManager.send number: '+420123456789', message: 'Hello!'
rescue SmsManager::Error => e
puts e.message # => Neplatný parametr gateway
end