Scalar Ruby Test

This library provides convenient access to the Scalar Ruby Test REST API from Ruby.

The full API of this library can be found in api.md.


Contents


Installation

Add the gem to your application's Gemfile:

gem "amritk-scalar-test", "~> 0.5.0" # x-release-please-version

Or install it directly:

gem install amritk-scalar-test

Usage

require "amritk-scalar-test"

client = AmritkScalarTest::Client.new

response = client.ping.list

puts response.inspect

The examples in the following sections assume a client configured as shown above.

See the API reference for every available operation.


Authentication

This API does not declare a global authentication scheme.


Errors

Non-success responses throw generated API errors. Error objects expose status, headers, response body, and request metadata where the target runtime supports it.

begin
  response = client.ping.list

  puts response.inspect
rescue AmritkScalarTest::Errors::APIError => error
  puts "#{error.status}: #{error.message}"
  raise
end

Client Options

Configure the generated client by setting any of these options when you create it.

require "amritk-scalar-test"

client = AmritkScalarTest::Client.new(
  timeout: 60.0,
  max_retries: 2,
  logger: $stderr,
)
Option Type Default Description
base_url String - Override the default API base URL.
timeout Numeric 60.0 Seconds to wait for a response before timing out.
max_retries Integer 2 Maximum number of retries for temporary failures.
logger `Callable \ #puts \ nil` - Receives lightweight request/response debug lines.
default_headers Hash - Headers included with every request.
default_query Hash - Query parameters included with every request.

Request Options

Option Type Default Description
idempotency_key String - Value for the configured idempotency header.
extra_headers Hash - Additional headers for one request.
extra_query Hash - Additional query parameters for one request.
extra_body Hash - Additional body fields for one request.
timeout Numeric - Override timeout for one request.
max_retries Integer - Override retry count for one request.
base_url String - Override the base URL for one request.
url String - Exact URL to request (used internally by link-header pagination).
allow_auth_to_base_url Boolean - Send auth to a different base URL origin.

Retries and Timeouts

Generated clients support request timeouts and retry temporary failures such as network errors, 408, 409, 429, and 5xx responses. Retry delays honor Retry-After headers when present. Tune the retry and timeout client options shown above, or override them per request.


Helpers

  • Every model is a BaseModel: pass a plain hash or a model instance, and read decoded values back as attributes.
  • Paginated methods return a page you can iterate directly, or walk with auto_paging_each.
  • The gem ships rbi/ and sig/ trees, so Sorbet and Steep type-check calls into the SDK.

Requirements

  • Ruby >= 3.2

Powered by Scalar.