Sha256: 77bd332cc6a5c6a4a7e07e9446a2937b7043c35a65d4c462bdf4a51616848742

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 KB

Contents

# SmsManager

A Ruby SDK for smsmanager.cz - SMS provider.

## Installation
    gem install sms_manager

Add this line to your application's Gemfile:

    gem 'sms_manager'

And then execute:

    bundle

Or install it yourself as:

    gem install sms_manager

## Usage

First you need to setup your credentials. This can be done only once:

```ruby
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:

```ruby
require 'digest/sha1'
Digest::SHA1.hexdigest 'password'
```

That's all. Now you can send SMS messages.

```ruby
SmsManager.send_message number: '+420123456789', message: 'Hello!'
```

## Background call

If you do not want to block your app you can use sucker_punch to deleagte the method call to a pool of workers. Note that any raised exception is not propagated to you, it's _fire and forget_.

```ruby
module SmsManager
  class Client
    include SuckerPunch::Job
  end
end

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

SmsManager.async.send_message number: '+420123456789', message: 'Hello!'
```

## TODO

* add other params to send_message method
* recognize error codes (only a single exception is raised)

## Copyright

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

[license]: LICENSE.md

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sms_manager-0.1.0 README.md