Project

sms_box

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Ruby API client for the MNC smsBox® v6.4 -- HTTP XML API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

SmsBox

mnc smsBox® v6.4 -- HTTP XML API client

Installation

Add this line to your application's Gemfile:

gem 'sms_box'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sms_box

Usage

Generic Usage

Load and SMSBox

require 'sms_box'
client = SMSBox.client 'http://pro.smsbox.ch:8047/Pro/sms/xml',
  {
    :username => 'myuser',
    :password => 'mypass'
  }

Client can be configured within a block

client = SMSBox.client 'http://pro.smsbox.ch:8047/Pro/sms/xml' do |c|
  c.username = 'myuser'
  c.password = 'mypass'
end

To send a request, a Request object needs to be instantiated and passed to client.request

request = SMSBox::WebsendRequest.new.tap do |r|
  r.service = 'TEST'
  r.text = 'This is a test message.'
  r.receivers = [
    '+41790000001',
    '+41790000002',
    '+41790000003',
  ]
end
res = client.request request

The bang method request! can be used to automatically raise an SMSBox::RequestException when request failed.

res = client.request! request # raises SMSBox::RequestException when response.error? == true

The status of the request can be checked on the response object

res.success?
# or
res.error?
# The error type is stored as string in res.error

Implemented Requests

  • WEBSEND (with multiReceiver)

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request