Ruby API for smsmanager.cz
Ruby
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.coveralls.yml
.gitignore
.travis.yml
CHANGELOG.md
Gemfile
Gemfile.lock
LICENSE.md
README.md
Rakefile
sms_manager.gemspec

README.md

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:

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

Copyright

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