Skip to content

Ruby server SDK

Install the seatlayer 0.9.0 gem, inspect an authoritative hold, book with a stable reference, and use the exact Ruby resource namespaces.

Updated View as Markdown

Use the seatlayer gem from a trusted Ruby backend. Version 0.9.0 requires Ruby 3.0 or newer and uses net/http, json, and openssl from the standard library without runtime gem dependencies.

Install and create the client

gem install seatlayer -v 0.9.0

With Bundler, pin the same version in your Gemfile, then run bundle install:

gem "seatlayer", "0.9.0"
require "seatlayer"

client = SeatLayer::Client.new(ENV.fetch("SEATLAYER_SECRET_KEY"))
raise "Use a test key while integrating." unless client.mode == "test"

Keep SEATLAYER_SECRET_KEY in the server environment. Never expose the client or its sk_… credential to browser or mobile code.

Exact resource surface

The client exposes charts, channels, event_series, events, holders, inventory, orders, performance_groups, sessions, seasons, templates, webhooks, and workspaces. event_series, holders (including list_customers), and orders are new in 0.9.0, and so are the Event sales calls on events: buyer checkout, payment gateway, sales readiness, preflight and transitions, booking fee, and discount codes.

client.performance_groups contains all 13 released operations: list, create, retrieve, delete, activate, close, retrieve_lifecycle, create_buyer_access_session, list_buyer_access_sessions, revoke_buyer_access_session, retrieve_hold, book_hold, and retrieve_booking.

client.seasons contains all 90 Season operations in 0.9.0. Ruby keeps the Season prefix and uses snake case, for example create_season, publish_season_plan, book_season_hold, commit_season_renewal_offer, and export_season_support_snapshot. The resource covers catalogue, lifecycle, Plans and sales, buyer handoff, holder import, renewals, amendments, reports, recovery, outbox, audit, and support export. 0.9.0 adds performances, Plan edits and package prices, checkout tests, occurrence return and reclaim (return_season_occurrence_inventory, reclaim_season_occurrence_inventory), holders, season orders, hosted renewals, bulk jobs, sales and seat reports with CSV exports, and season seats.

Season seats are SDK methods in 0.9.0: set_aside_season_block, retrieve_season_block, and release_season_block. Turn them on for a season with inventory_mode: "block" on create_season or update_season; every Season answer carries inventoryMode (block or per_hold). The set-aside and the release answer 202 with a job; follow it with retrieve_season_bulk_job. Refusals raise SeatLayer::APIError or a subclass such as SeatLayer::ConflictError; read the refusal from its code. The season seats routes list every refusal.

The same 13 Performance Group and 90 Season wire operations ship in all seven official server SDKs at 0.9.0; only language naming differs.

The 0.9.0 typed performance_groups.create keywords cover the default fixed policy but do not expose the newer REST inclusionMode field. Use the REST/raw-request path for flexible_dates; the other typed create fields and all 13 operations remain available.

Inspect and book an Event hold

event_key = ENV.fetch("SEATLAYER_EVENT_KEY")
hold_id = ENV.fetch("SEATLAYER_HOLD_ID")
booking_ref = ENV.fetch("ORDER_ID")

hold = client.inventory.retrieve_hold(event_key, hold_id)
# An expired, released or booked hold still answers with its status.
raise "The hold is no longer active" unless hold.fetch("status") == "active"
labels = hold.fetch("items").map { |item| item.fetch("label") }
# Price from hold["items"] and authorize payment in your commerce system here.
booking = client.inventory.book(
  event_key,
  hold_id: hold_id,
  labels: labels,
  booking_ref: booking_ref
)

Do not calculate a charge from browser-submitted totals. booking_ref is your commerce system’s immutable join to SeatLayer inventory. If the response is lost, call client.inventory.retrieve_booking(event_key, booking_ref) before deciding whether to repeat the exact same hold, labels, and reference.

Errors, retries, and pagination

Branch on SeatLayer::AuthError, SeatLayer::ConflictError, and SeatLayer::RateLimitError. Use mode_mismatch?, sold_out?, and retry_after for those common branches.

Reads retry 408, 429, and 5xx with exponential backoff and full jitter. These 43 methods also retry with one exact key, generated when you don’t pass one:

  • charts.create, charts.copy, templates.instantiate_template, events.create, workspaces.create, and performance_groups.create;
  • event_series.create_event_series, add_event_series_dates, and update_event_series;
  • holders.update_holder, create_holder_transfer, create_holder_return, and create_holder_renewal_checkout;
  • orders.refund_event_order and cancel_event_order;
  • 28 on seasons: create_season, update_season, delete_season, publish_season, create_season_plan, update_season_plan, delete_season_plan, duplicate_season_to_live, create_season_performances, attach_season_performances, delete_season_performance, mark_season_performance_past, attach_season_plan_performance, delete_season_plan_performance, replace_season_package_prices, create_season_checkout_test, create_season_holder_import, create_season_holder_import_from_season, create_season_renewal_offers, create_season_renewal_checkout, release_season_lapsed_offers, create_season_amendment, refund_season_performance, refund_season_order, cancel_season_order, cancel_season_order_date, set_aside_season_block, and release_season_block.

Other mutations and raw request mutations are single-attempt.

Large lists can stream through a block:

client.events.list_all do |event|
  sync_event(event)
end

client.charts.list_all is the only other block iterator. Performance Group and top-level Season list methods return one cursor page, and so do the 0.9.0 lists of Season renewal offers, hosted renewals and holders, orders, customers, holder tickets, and event series. Pass the response’s opaque nextCursor back as cursor until it is absent or nil.

Nullable Event fields distinguish omission from an explicit nil; consult the package README before sending a reset. See errors, retries, and idempotency for the shared contract.

Verify and continue

Verify the flow with a test key, a test Event, and a real test hold. Then add webhook verification, choose the correct inventory model, and complete the going-live checklist.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close