TerrasmsApi
Ruby client for Terrasms API | Библиотека для API провайдера Terrasms
Table of Contents
- Installation
- Usage
- Quick Demo
- Exceptions
- Contributing
- License
Installation
Add this line to your application's Gemfile:
gem 'terrasms_api'
And then execute:
$ bundle
Or install it yourself as:
$ gem install terrasms_api
Usage
Quick demo
require 'terrasms_api'
First, create client using your access token:
client = TerrasmsApi.new(access_token: 'your.token')
After that simply do some request.
# send sms
# mandatory_attributes for mostly all requests:
# - login: your login for Terrasms auth
# - target: phone or email
# - sender: public name
# - message: sms body
client.post('send', mandatory_attributes)
Exceptions
def send_sms
client.post('send', attrs)
rescue TerrasmsApi::RequestError, TerrasmsApi::ConnectionError => e
puts e.message, e.backtrace
end
Name | Description |
---|---|
TerrasmsApi::RequestError |
Request didn't succeed |
TerrasmsApi::ConnectionError |
Connection didn't succeed |
Testing
bundle exec rspec
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
License
The gem is available as open source under the terms of the MIT License.