Project

smsway_api

0.0
No commit activity in last 3 years
No release in over 3 years
Simple ruby wrapper for smsway.ru XML API. Provides simples methods for sending sms, flash sms, vcard and wappushes, check balance.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 2.14

Runtime

~> 3.2
 Project Readme

smsway_api Build Status Gem Version Dependency Status Code Climate

Ruby wrapper for smsway.ru xml api

Installation

# Gemfile
gem 'smsway_api'

or just

$ gem install smsway_api

Config

Parameters for smsway_api should be placed in SmswayApi.configure block. Put smsway_api.rb into config/initializers directory of your rails application or just run:

 rails generate smsway_api:install

Example of config file:

SmswayApi.configure do |config|
  config.login = '123'
  config.password = 'AbCdE654'


  config.default_sender = 'smsway'
end

Usage

Now implemented only two methods of smsway api: send message and get balance. You can send sms, flash-sms, wap-push and vcard.

Simple sending message: SmswayApi::API.send_message('test message', phone). Building and sending VCard:

vcard = SmswayApi::Message::Vcard.new({
  name: 'Steave Jobs',
  email: 'jobs@apple.com',
  phone: {
    work: '1-800-275-2273'
  }
})
vcard.add_recipient('1-800-694-7466')
vcard.add_recipient('1-800-800-2775')
vcard.sender = 'apple'
SmswayApi::API.send_message(vcard)

This example will send vcard to two recipients. Field 'from' will be 'apple'.

Get balance:

SmswayApi::API.balance