0.03
Low commit activity in last 3 years
A long-lived project that still receives updates
Ruby client for auth.aptible.com
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
~> 3.0
~> 0.8.1

Runtime

 Project Readme

Aptible::Auth

Gem Version Build Status Dependency Status

Ruby client for auth.aptible.com. Aptible's authorization server is built on top of OAuth 2.0 and HAL+JSON, and so this client is just a thin layer on top of the oauth2 and HyperResource gems.

Installation

Add the following line to your application's Gemfile.

gem 'aptible-auth'

And then run bundle install.

Usage

First, get a token:

token = Aptible::Auth::Token.create(email: 'user0@example.com', password: 'password')

From here, you can interact with the Authorization API however you wish:

auth = Aptible::Auth.new(token: token)
auth.clients.first.name
# => "Client 0"
client = Aptible::Auth::Client.create(token: token, name: 'Dogeclient')
client.href
# => "http://localhost:4000/clients/60765b69-ffd8-4762-b9d2-96354ddb16f9"

Configuration

Parameter Description Default
root_url Root URL of the authorization server ENV['APTIBLE_AUTH_ROOT_URL'] or https://auth.aptible.com

To point the client at a different authorization server (e.g., during development), add the following to your application's initializers (or set the APTIBLE_AUTH_ROOT_URL environment variable):

Aptible::Auth.configure do |config|
  config.root_url = 'http://some.other.url'
end

Contributing

  1. Fork the project.
  2. Commit your changes, with specs.
  3. Ensure that your code passes specs (rake spec) and meets Aptible's Ruby style guide (rake rubocop).
  4. Create a new pull request on GitHub.

Copyright and License

MIT License, see LICENSE for details.

Copyright (c) 2019 Aptible and contributors.