Ruby SDK
The official Ruby SDK for the Generator Labs API v4.0. Uses Ruby-idiomatic conventions including keyword arguments and optional parentheses.
| Package | generatorlabs (RubyGems) |
| Minimum version | Ruby 3.0+ |
| GitHub | generator-labs/ruby-sdk |
Installation
gem install generatorlabs
Or add to your Gemfile:
gem 'generatorlabs'
Then run:
bundle install
Usage
require 'generatorlabs'
client = GeneratorLabs::Client.new('your_account_sid', 'your_auth_token')
# Get a single host
host = client.rbl.hosts.get('host_id')
# List all hosts with automatic pagination
hosts = client.rbl.hosts.get_all
# Create a certificate monitor
monitor = client.cert.monitors.create(name: 'example.com')
# Responses support hash-like access
puts host['data']['name']
Configuration
config = GeneratorLabs::Config.new(
timeout: 45,
max_retries: 5,
retry_backoff: 2.0,
)
client = GeneratorLabs::Client.new('your_account_sid', 'your_auth_token', config)
| Option | Default | Description |
|---|---|---|
timeout | 30 | Total request timeout in seconds |
connect_timeout | 5 | TCP connection timeout in seconds |
max_retries | 3 | Maximum number of retry attempts |
retry_backoff | 1.0 | Backoff multiplier between retries |
base_url | — | Override the default API base URL |
Webhook Verification
GeneratorLabs::Webhook.verify(body, signature_header, secret, tolerance)
See Using Web Hooks for more details on webhook payloads and signature verification.
Error Handling
The Ruby SDK raises GeneratorLabs::Error errors that you can catch with standard begin / rescue:
begin
host = client.rbl.hosts.get('host_id')
rescue GeneratorLabs::Error => e
puts e.message
end
Rate Limit Information
Rate limit details are available on every response:
puts response.rate_limit_info.remaining
puts response.rate_limit_info.reset
See What Are the API Rate Limits? for more information.