https://github.com/jbox-web/ovh-rest
OVH Rest client for Ruby
https://github.com/jbox-web/ovh-rest
Last synced: 7 months ago
JSON representation
OVH Rest client for Ruby
- Host: GitHub
- URL: https://github.com/jbox-web/ovh-rest
- Owner: jbox-web
- License: mit
- Created: 2024-02-26T17:07:41.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2025-03-04T21:17:08.000Z (10 months ago)
- Last Synced: 2025-05-14T12:19:52.222Z (7 months ago)
- Language: Ruby
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OVH Rest client
[](https://github.com/jbox-web/ovh-rest/blob/master/LICENSE)
[](https://github.com/jbox-web/ovh-rest/releases/latest)
[](https://github.com/jbox-web/ovh-rest/actions)
[](https://codeclimate.com/github/jbox-web/ovh-rest)
[](https://codeclimate.com/github/jbox-web/ovh-rest/coverage)
OVH Rest client is a tiny helper library based on [faraday](https://github.com/lostisland/faraday), wrapping the authentication parts and simplifying interaction with OVH API in Ruby programs.
## Installation
Put this in your `Gemfile` :
```ruby
git_source(:github){ |repo_name| "https://github.com/#{repo_name}.git" }
gem 'ovh', github: 'jbox-web/ovh-rest', tag: '1.0.0'
```
then run `bundle install`.
## Usage
```ruby
require 'ovh-rest'
ovh = OvhRest::Client.new(
application_key: ,
application_secret: ,
consumer_key:
)
# Get sms account status
result = ovh.get("/sms/sms-xx12345-1")
puts YAML.dump(result)
=>
{
"status": "enable",
"creditsLeft": 42,
"name": "sms-xx12345-1",
"userQuantityWithQuota": 0,
"description": "",
[...]
}
# Send sms
result = ovh.post("/sms/sms-xx12345-1/jobs", {
"charset" => "UTF-8",
"class" => "phoneDisplay",
"coding" => "7bit",
"priority" => "high",
"validityPeriod" => 2880
"message" => "Dude! Disk is CRITICAL!",
"receivers" => ["+12345678900", "+12009876543"],
"sender" => "+12424242424",
})
puts YAML.dump(result)
=>
{
"totalCreditsRemoved": 2,
"ids": [
12345,
12346
]
}
```