# Ruby SDK

Ruby 3.2 or later, no runtime gem dependencies.

## Install

```sh
gem install ohauthcat -v 0.0.2
```

- Create a client: `OhAuthCat::Client.new(api_key: ENV.fetch("OHAUTHCAT_API_KEY"), client_id: "pk_...")`.
- Call any API operation, for example `client.organizations.get_organization("org_...")`, or page through everything with `list_directory_users_auto_paging`.
- SSO: `client.sso_helpers.get_authorization_url(redirect_uri:, domain:)` returns the URL and a `code_verifier` to store on your server; then `client.sso_helpers.get_profile_and_token(code:, code_verifier:, redirect_uri:)`.
- Webhooks: `OhAuthCat::Webhooks.verify(request.raw_post, request.headers["OhAuthCat-Signature"], secret)`.
- Errors are `OhAuthCat::Error` subclasses, such as `NotFoundError` and `RateLimitedError`, with the stable `code`.
- Pass `idempotency_key:` to set your own key on a write.
