SmsManager

Gem Version Build Status Dependency Status Code Climate Coverage Status

A Ruby SDK for smsmanager.cz - Czech SMS provider.

Installation

gem install sms_manager

Or add to Gemfile:

gem 'sms_manager'

Usage

First you need to setup your credentials:

SmsManager.configure do |config|
  config.username = YOUR_USERNAME
  config.hashed_password = HASHED_PASSWORD
end

Create 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. The exception contains error code as well as error message.

begin
  SmsManager.send number: '+420123456789', message: 'Hello!'
rescue SmsManager::SendingError => e
  puts e.code # => 104
  puts e.message # => Neplatný parametr gateway
end

Copyright (c) 2013 David Hrachovy See LICENSE for details.