Skip to content

candidhealth/candid-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Candid Health Ruby Library

Gem Version fern shield

The Candid Health Ruby library provides access to the Candid Health API from Ruby.

Installation

Install the gem and add to the application's Gemfile by executing:

bundle add candidhealth

If bundler is not being used to manage dependencies, install the gem by executing:

gem install candidhealth

Instantiation

require "candidhealth"

options = CandidApiClient::CandidApiAuthOptions.new(client_id: "YOUR_CLIENT_ID", client_secret: "YOUR_CLIENT_SECRET")

candidhealth = CandidApiClient::Client.new(
  options: options
)

Async Client

The SDK exports an async client that you can use for non-blocking requests.

require "candidhealth"

options = CandidApiClient::CandidApiAuthOptions.new(client_id: "YOUR_CLIENT_ID", client_secret: "YOUR_CLIENT_SECRET")
candidhealth = CandidApiClient::AsyncClient.new(options: options)

Sync do
  guarantor = candidhealth.guarantor.v_1.get(guarantor_id: "guarantor-id")
  puts guarantor
end

Timeouts

The SDK defaults to a 60 second timout. Use the timeout_in_seconds option to configure this behavior.

candidhealth.guarantor.v_1.get(guarantor_id: "guarantor-id", request_options: RequestOptions.new(
  timeout_in_seconds: 30 // override timeout to 30s
))

Retries

The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long as the request is deemed retriable and the number of retry attempts has not grown larger than the configured retry limit (default: 2).

A request is deemed retriable when any of the following HTTP status codes is returned:

  • 408 (Timeout)
  • 409 (Conflict)
  • 429 (Too Many Requests)
  • 5XX (Internal Server Errors)

Use the max_retries request option to configure this behavior.

candidhealth.guarantor.v_1.get(guarantor_id: "guarantor-id", RequestOptions.new(
  max_retries: 0 // override maxRetries at the request level
))

Beta status

This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning the package version to a specific version in your package.json file. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.

Contributing

While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!

On the other hand, contributions to the README are always very welcome!