The SDK supports Ruby 3.2.0+ and provides a clean, idiomatic Ruby interface to the Straddle API.
Installation
Install the SDK by adding it to your application’sGemfile:
Setup and Configuration
Require the SDK
Require the necessary gems in your Ruby application:
Initialize the Client
Create a new instance of the Straddle client:
Implementation Examples
- Straddle Account Customers
- Embed Customers
For account customers (non-platform), the flow is simpler as the account context is inferred from the API key:
Key Features
Idiomatic Ruby
Clean, Ruby-style interface following community conventions with snake_case methods and intuitive hash parameters.
Thread Safety
The client is thread-safe, allowing you to share a single instance across multiple threads in your application.
Automatic Retries
Built-in retry logic for transient errors with configurable retry strategies.
Error Handling
Comprehensive error classes that map to HTTP status codes for precise error handling.
Error Handling
The SDK provides specific exception types for different error cases:Common Error Types
Common Error Types
BadRequestError(400)UnprocessableEntityError(422)AuthenticationError(401)PermissionDeniedError(403)NotFoundError(404)RateLimitError(429)InternalServerError(>=500)
Timeout Configuration
Timeout Configuration
Configure request timeouts:
Retry Configuration
Retry Configuration
Configure automatic retries:
SDK Requirements
Ruby Version
Ruby 3.2.0 or higher
Bundler
Bundler for dependency management