https://github.com/wowinter13/terrasms_api
https://github.com/wowinter13/terrasms_api
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/wowinter13/terrasms_api
- Owner: wowinter13
- License: mit
- Created: 2019-11-28T09:35:35.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-04-03T19:06:11.000Z (about 2 years ago)
- Last Synced: 2025-02-26T05:47:00.456Z (3 months ago)
- Language: Ruby
- Size: 15.6 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# TerrasmsApi
Ruby client for Terrasms API | Библиотека для API провайдера Terrasms
**Table of Contents**
- [Installation](#installation)
- [Usage](#usage)
- [Quick Demo](#quick-demo)
- [Exceptions](#exceptions)
- [Contributing](#contributing)
- [License](#license)## Installation
Add this line to your application's Gemfile:
```ruby
gem 'terrasms_api'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install terrasms_api
## Usage
### Quick demo
```ruby
require 'terrasms_api'
```First, create client using your access token:
```ruby
client = TerrasmsApi.new(access_token: 'your.token')
```
After that simply do some request.```ruby
# send sms
# mandatory_attributes for mostly all requests:
# - login: your login for Terrasms auth
# - target: phone or email
# - sender: public name
# - message: sms bodyclient.post('send', mandatory_attributes)
```## Exceptions
```ruby
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
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## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).