Skip to content

mediasota/smslist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smslist

Gem Version Build Status Dependency Status Code Climate Coverage Status

Simple Ruby wrapper for the SMSlist API. SMSlist is a service for mass sending sms messages.

Installation

gem install smslist

Configuration

You can configure this gem in an initializer:

Smslist.configure do |c|
  c.sender = '79101234567'

  # you can use the token
  c.token = 'your_api_token'

  # or authenticate with login and password
  c.login = 'username'
  c.password = 'secret'
end

Or simply:

client = Smslist.new(sender: '79101234567', token: 'your_api_token')

Usage

Getting the balance and remaining sms count

balance = client.balance
remaining = client.remaining_sms

Sending sms messages

recipients = %w(79031234567 79032345678 79033456789)
response = client.send_sms('Your text message', recipients)

If can pass optional param, to send a flash sms message:

response = client.send_sms('Your text message', recipients, flash: true)

You will get a hash for each number, with status, message id (to retrieve status later) and number of parts:

{
  '79031234567' => { status: :ok, id: 1001, parts: 2 },
  ...
  '79033456789' => { error: 'Номер телефона присутствует в стоп-листе.' }
}

Status :ok means, that the message was successfully placed in a queue.

Getting state of sent messages

message_ids = %w(1001 1002 1003 1004)
response = client.state(message_ids)

You will get a hash for id, with state and datetime, or error message.

Supported Ruby Versions

This library aims to support and is tested against the following Ruby implementations:

  • Ruby 1.9.2
  • Ruby 1.9.3
  • Ruby 2.0.0

If something doesn't work on one of these Ruby versions, it's a bug.

This library may inadvertently work (or seem to work) on other Ruby implementations, however support will only be provided for the versions listed above.

Inspiration

Smslist was inspired by Octokit.

Copyright

Copyright (c) 2013 Yury Lebedev. See LICENSE for details.

About

Ruby wrapper for smslist API

Resources

License

Stars

Watchers

Forks

Packages

No packages published