Aptible::Api
Ruby client for api.aptible.com. Aptible's API server is built on top of HAL+JSON, and so this client is just a thin layer on top of the HyperResource gem.
Installation
Add the following lines to your application's Gemfile.
gem 'aptible-api'
And then run bundle install.
Note: A forked version of the HyperResource gem (hyperresource-aptible) is necessary until gamache/hyperresource#22 and gamache/hyperresource#23 are merged.
Usage
First, get a token:
token = Aptible::Auth::Token.new(email: '[email protected]', password: 'password')
Then, initialize a client:
api = Aptible::Api::Client.new(token: token)
From here, you can interact with the Authorization API however you wish:
api.get.clients.count
# => 4
api.get.clients.first.name
# => "Client 0"
client = api.get.clients.create(name: 'Dogeclient')
client.href
# => "http://localhost:4000/clients/60765b69-ffd8-4762-b9d2-96354ddb16f9"
Configuration
| Parameter | Description | Default |
|---|---|---|
root_url |
Root URL of the API server | ENV['APTIBLE_API_ROOT_URL'] or https://api.aptible.com |
To point the client at a different API server (e.g., during development), add the following to your application's initializers (or set the APTIBLE_API_ROOT_URL environment variable):
Aptible::Api.configure do |config|
config.root_url = 'http://some.other.url'
end
Contributing
- Fork the project.
- Commit your changes, with specs.
- Ensure that your code passes specs (
rake spec) and meets Aptible's Ruby style guide (rake rubocop). - Create a new pull request on GitHub.
Copyright and License
MIT License, see LICENSE for details.
Copyright (c) 2013 Aptible, Frank Macreery, and contributors.


