Skip to content

mentero/client_smsapi

Repository files navigation

Client SMSApi

Code Climate | Test Coverage | Gem Version

For details visit SMSApi homepage

Installation

Add this line to your application's Gemfile:

gem 'client_smsapi'

And then execute:

$ bundle

Or install it yourself as:

$ gem install client_smsapi

Configuration

The client needs your credentials. Configure them!

SMSApi.configure do |config|
  config.username = 'what_a_username'
  config.secret   = 'what_a_secret'
end

Rails users are recommended to put this code into initializer file such as config/initializers/smsapi.rb

Usage

message = SMSApi::SMS::Message::Eco.new(to: 48123456789, body: 'test')
SMSApi::SMS::Client.new.send_message!(message)
#<SMSApi::Response::Regular:0x007f82eca9ee78 @id=1440528348109731150, @points=0.07, @status=:ok>

.send_message! will raise an error in case of failure. There is also .send_message alternative available.

Test mode

You can use library in test_mode. Test mode will perform API request without sending a message and charging you.

message = SMSApi::SMS::Message::Eco.new(to: 48123456789, body: 'test')
SMSApi::SMS::Client.new(test_mode: true).send_message!(message)
#<SMSApi::Response::Regular:0x007f82eca9ee78 @id=1440528348109731150, @points=0.07, @status=:ok>

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/mentero/client_smsapi.

About

smsapi.pl ruby client

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published