Skip to main content
The Ruby SDK gives you a client for the whole incident.io API. There’s a method for every endpoint and a class for every request and response, all generated from our OpenAPI specification. Requiring it is quick: models load the first time you use them, rather than all at once. It requires Ruby 3.0 or later.

Installing

Or in your Gemfile:
The gem is called incident_io_api, but the library is require "incident_io", and everything lives under the IncidentIo module.

Your first request

You’ll need an API key from Settings > API keys (see API keys). Then:

How endpoints work

Each API resource has a class, such as IncidentsV2Api or AlertsV2Api, with one method per endpoint. Path parameters and request bodies are positional arguments, and everything optional goes in a trailing hash:
If you need the status code or headers, every method has a _with_http_info twin:

Pagination

List endpoints are cursor-paginated. Read the next cursor from pagination_meta.after and pass it back as after:

Filtering

Filters that take an operator are nested hashes:

Errors

A failed request raises a subclass of IncidentIo::ApiError for its status code, so you can rescue the cases you care about and let the rest through:
The subclasses are BadRequestError (400), AuthenticationError (401), PermissionDeniedError (403), NotFoundError (404), ConflictError (409), UnprocessableEntityError (422), RateLimitError (429), and ServerError (5xx). Network failures and timeouts raise ApiError itself, with a code of nil. When you hit the rate limit, RateLimitError#retry_after tells you how many seconds to wait.

Configuration

IncidentIo.configure sets the defaults every API class uses. If you need more than one configuration in a process, build an ApiClient and pass it in:
The client is built on Faraday. config.configure_faraday_connection { |conn| ... } gives you the connection, so you can add middleware such as retries or logging.

Enum values

Fields the API documents as an enum are plain strings in this SDK, and the documentation lists the known values. We add enum values as a backwards-compatible change, and plain strings mean a value newer than your installed gem never breaks the response.

Deprecated endpoints

Endpoints we’ve deprecated stay available, but they’re marked @deprecated in the documentation and warn when called. Ruby hides deprecation warnings by default, so run with ruby -W:deprecated, or set Warning[:deprecated] = true, to see them.

Versioning

The SDK is kept up to date with the API automatically. Additions to the API are minor versions. A change that would break your code, like a removed field, is released as a new major version, and its release notes list what changed.

Resources

RubyGems

The incident_io_api gem and its versions.

GitHub

Source, README, and issues for the Ruby SDK.

API reference

Endpoints, authentication, rate limits, and errors.

All SDKs

Clients for Go, TypeScript, Python, Rust, PHP, and .NET.