Ruby API client for the [Minty](https://minty.page) platform.

[![MIT licensed](https://img.shields.io/dub/l/vibe-d.svg?style=flat)](https://github.com/mintypage/ruby/blob/master/LICENSE)

## Documentation

- [API documentation](https://www.rubydoc.info/gems/minty) - documentation auto-generated from the code comments that explains all the available features
- [Examples](https://github.com/mintypage/ruby/blob/master/EXAMPLES.md) - examples that demonstrate the different ways in which this SDK can be used
[FAQ](https://github.com/mintypage/ruby/blob/master/FAQ.md) - frequently asked questions about the SDK
- [Docs Site](https://minty.page/docs) - explore our Docs site and learn more about Minty

## Getting Started

### Installation

This gem can be installed directly:

```bash
$ gem install minty
```

or with [Bundler](https://bundler.io/man/bundle-add.1.html):

```bash
bundle add minty
```

### Usage

Create an instance of `MintyClient` to access properties and methods of the authentication and management APIs:

```ruby
require 'minty'

client = MintyClient.new(
  client_id: ENV['AUTH0_RUBY_CLIENT_ID'],
  client_secret: ENV['AUTH0_RUBY_CLIENT_SECRET'],
  domain: ENV['AUTH0_RUBY_DOMAIN'],
)
```

If `token` is omitted, the SDK will attempt to fetch a new token using the `client_credentials` grant, provided that `client_id` and `client_secret` are provided in the configuration. Once the token is about to expire (or has already expired), a new token will be fetched and cached for future calls.

For this to work, ensure your application can make a Client Credentials grant (Application settings in Minty > Advanced > Grant Types tab) and that the application is authorized for the Management API: https://minty.page/docs/api-auth/config/using-the-minty-dashboard

## Authentication API Client

This SDK provides access to [Authentication API](https://minty.page/docs/api/authentication) endpoints with the `Minty::API::AuthenticationEndpoints` module.

## Further reading

- [API authentication in Ruby](https://minty.page/docs/quickstart/backend/ruby)
- [API authentication in Rails](https://minty.page/docs/quickstart/backend/rails)
- [Managing authentication with Minty (blog)](https://minty.page/blog/rails-5-with-minty/)
- [Ruby on Rails workflow with Docker (blog)](https://minty.page/blog/ruby-on-rails-killer-workflow-with-docker-part-1/)

## Feedback

### Contributing

We appreciate feedback and contribution to this repo! Before you get started, please see the following:

- [Minty's general contribution guidelines](https://github.com/minty/open-source-template/blob/master/GENERAL-CONTRIBUTING.md)
- [Minty's code of conduct guidelines](https://github.com/minty/open-source-template/blob/master/CODE-OF-CONDUCT.md)

### Raise an issue

To provide feedback or report a bug, please [raise an issue on our issue tracker](https://github.com/mintypage/ruby/issues).

### Vulnerability Reporting

Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://minty.page/whitehat) details the procedure for disclosing security issues.

---

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://cdn.minty.page/website/sdks/logos/minty_dark_mode.png" width="150">
    <source media="(prefers-color-scheme: light)" srcset="https://cdn.minty.page/website/sdks/logos/minty_light_mode.png" width="150">
    <img alt="Minty Logo" src="https://cdn.minty.page/website/sdks/logos/minty_light_mode.png" width="150">
  </picture>
</p>
<p align="center">
  Minty is an easy to implement, adaptable authentication and authorization platform. To learn more checkout <a href="https://minty.page/why-minty">Why Minty?</a>
</p>
<p align="center">
  This project is licensed under the MIT license. See the <a href="https://github.com/mintypage/ruby/blob/master/LICENSE"> LICENSE</a> file for more info.
</p>