Project

sms_aero

0.01
No commit activity in last 3 years
No release in over 3 years
HTTP(s) client to SMS Aero API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 10
~> 3.0
~> 0.48
~> 2.1

Runtime

 Project Readme

SmsAero

Gem Version Build Status Dependency Status Code Climate

HTTP(s) client to SMS Aero service API written on top of evil-client "framework".

Sponsored by Evil Martians

Synopsis

See operation specs for more verbose examples.

Initialize a client with user and password:

client = SmsAero.new user: "joe",        # required
                     password: "foobar", # required
                     testsend: true      # optional - to send test SMS

Then send requests:

answer = client.send_sms text: "Hello!",
                         to:   "+7 (909) 382-84-45",
                         date: "2100/01/12", # Date, Time, DateTime are accepted as well
                         type: 3 # see API docs for details

answer.result   # => "accepted"
answer.id       # => "38293"
answer.success? # => true (checks whether an id has been returned)
answer = client.check_status id: "38293"
answer.result # => "pending"
answer = client.send_sms text:  "Hello!",
                         group: "customers",
                         date:  Date.new("2100/01/12"),
                         type:  1

answer.result   # => "accepted"
answer.id       # => "894924"
answer.success? # => true (checks whether an id has been returned)
answer = client.check_sending id: "894924"
answer.result # => "pending"
answer = client.add_blacklist phone: "+7 (999) 123-45-67"
answer.result # => "accepted"
answer = client.add_group group: "baz"
answer.result # => "accepted"
answer = client.add_phone phone: "+7 (999) 123-45-67",
                          group: "customers",
                          fname: "John",
                          lname: "Paul",
                          lname: "Doe",
                          bday:  "1998/08/12",
                          param: "VIP"

answer.result # => "accepted"
answer = client.check_balance
answer.result  # => "accepted"
answer.balance # => 1973.2
answer = client.check_groups
answer.result   # => "accepted"
answer.channels # => ["customers", "employee"]
answer = client.check_senders sign: "qux"
answer.result # => "accepted"
answer.result # => ["peter", "paul"]
answer = client.check_sign sign: "qux"
answer.result # => "accepted"
answer.data   # => ["approved"]   
answer = client.check_tariff
answer.result # => "accepted"
answer.tariff # => { direct: 10.3, digital: 3.89 }
answer = client.delete_group group: "employee"
answer.result   # => "accepted"
answer = client.delete_phone phone: "+7 (999) 123-4567",
                             group: "customers"

answer.result   # => "accepted"
# checking existance & availability of phone number
answer = client.hlr phone: "+7 (999) 123-4567"
answer.result   # => "accepted"
id = answer.id  # => "12345", id of request

answer = client.hlr_status id
answer.result   # => "accepted"
answer.status   # => any of :available, :unavailable or :nonexistent