Class: SeatLayer::PerformanceGroups
- Defined in:
- lib/seatlayer/performance_groups.rb
Overview
Fixed multi-performance runs. This is a secret-key surface: mint the browser token here, then give that token (never this client) to the PerformanceGroupPicker in the browser SDK.
Constant Summary
Constants inherited from Resource
Instance Method Summary collapse
-
#activate(performance_group_key, expected_revision:) ⇒ Object
Starts lifecycle coordination.
-
#book_hold(performance_group_key, operation_id, book_action_id:, booking_ref:) ⇒ Object
Confirm external payment for a committed hold.
-
#close(performance_group_key, expected_revision:) ⇒ Object
Stops new group sales.
-
#create(name:, event_keys:, external_ref: UNSET, idempotency_key: nil) ⇒ Object
Create a draft from two to eight compatible assigned-seat events.
-
#create_buyer_access_session(performance_group_key, allowed_origin:, include_public:, channel_ids_by_event: nil, expires_in_seconds: nil, max_quantity: UNSET, buyer_ref: UNSET, partner_ref: UNSET) ⇒ Object
Reveals a one-time, origin-bound browser bearer.
-
#delete(performance_group_key) ⇒ Object
Only a draft can be deleted.
-
#list(workspace_id: nil, external_ref: nil, state: nil, limit: nil, cursor: nil) ⇒ Object
One page of fixed runs.
-
#list_buyer_access_sessions(performance_group_key, limit: nil) ⇒ Object
Token records only: the bearer value is never returned again.
- #retrieve(performance_group_key) ⇒ Object
- #retrieve_booking(performance_group_key, action_id) ⇒ Object
-
#retrieve_hold(performance_group_key, operation_id) ⇒ Object
Read the trusted server projection before charging; do not price from client input or the picker state.
- #retrieve_lifecycle(performance_group_key, operation_id) ⇒ Object
- #revoke_buyer_access_session(performance_group_key, session_id) ⇒ Object
Methods inherited from Resource
Constructor Details
This class inherits a constructor from SeatLayer::Resource
Instance Method Details
#activate(performance_group_key, expected_revision:) ⇒ Object
Starts lifecycle coordination. When its response contains a non-terminal
lifecycle operation, poll retrieve_lifecycle until it completes.
37 38 39 40 |
# File 'lib/seatlayer/performance_groups.rb', line 37 def activate(performance_group_key, expected_revision:) @client.post(path(performance_group_key, "/activate"), { "expectedRevision" => expected_revision }) end |
#book_hold(performance_group_key, operation_id, book_action_id:, booking_ref:) ⇒ Object
Confirm external payment for a committed hold. Keep both identifiers
stable, and poll retrieve_booking if the response is book_pending.
82 83 84 85 86 |
# File 'lib/seatlayer/performance_groups.rb', line 82 def book_hold(performance_group_key, operation_id, book_action_id:, booking_ref:) @client.post(path(performance_group_key, "/holds/#{encode(operation_id)}/book"), { "bookActionId" => book_action_id, "bookingRef" => normalise_booking_ref(booking_ref) }) end |
#close(performance_group_key, expected_revision:) ⇒ Object
Stops new group sales. Poll retrieve_lifecycle while the close remains pending.
43 44 45 46 |
# File 'lib/seatlayer/performance_groups.rb', line 43 def close(performance_group_key, expected_revision:) @client.post(path(performance_group_key, "/close"), { "expectedRevision" => expected_revision }) end |
#create(name:, event_keys:, external_ref: UNSET, idempotency_key: nil) ⇒ Object
Create a draft from two to eight compatible assigned-seat events. The server validates compatibility and exactly replays a request with the same idempotency key.
19 20 21 22 23 24 |
# File 'lib/seatlayer/performance_groups.rb', line 19 def create(name:, event_keys:, external_ref: UNSET, idempotency_key: nil) body = { "name" => name, "eventKeys" => event_keys } body.merge!(supplied({ "externalRef" => external_ref })) @client.post("/v1/performance-groups", body, idempotency_key: idempotency_key, retry_policy: :header_replay) end |
#create_buyer_access_session(performance_group_key, allowed_origin:, include_public:, channel_ids_by_event: nil, expires_in_seconds: nil, max_quantity: UNSET, buyer_ref: UNSET, partner_ref: UNSET) ⇒ Object
Reveals a one-time, origin-bound browser bearer. It intentionally remains single-attempt: a retry could create a token whose only reveal is lost.
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/seatlayer/performance_groups.rb', line 54 def create_buyer_access_session(performance_group_key, allowed_origin:, include_public:, channel_ids_by_event: nil, expires_in_seconds: nil, max_quantity: UNSET, buyer_ref: UNSET, partner_ref: UNSET) body = compact({ "allowedOrigin" => allowed_origin, "includePublic" => include_public, "channelIdsByEvent" => channel_ids_by_event, "expiresInSeconds" => expires_in_seconds }) body.merge!(supplied({ "maxQuantity" => max_quantity, "buyerRef" => buyer_ref, "partnerRef" => partner_ref })) @client.post(path(performance_group_key, "/buyer-access-sessions"), body) end |
#delete(performance_group_key) ⇒ Object
Only a draft can be deleted. Activated runs retain their audit identity.
31 32 33 |
# File 'lib/seatlayer/performance_groups.rb', line 31 def delete(performance_group_key) @client.delete(path(performance_group_key)) end |
#list(workspace_id: nil, external_ref: nil, state: nil, limit: nil, cursor: nil) ⇒ Object
One page of fixed runs.
9 10 11 12 13 14 |
# File 'lib/seatlayer/performance_groups.rb', line 9 def list(workspace_id: nil, external_ref: nil, state: nil, limit: nil, cursor: nil) @client.get("/v1/performance-groups", compact({ "workspaceId" => workspace_id, "externalRef" => external_ref, "state" => state, "limit" => limit, "cursor" => cursor })) end |
#list_buyer_access_sessions(performance_group_key, limit: nil) ⇒ Object
Token records only: the bearer value is never returned again.
66 67 68 |
# File 'lib/seatlayer/performance_groups.rb', line 66 def list_buyer_access_sessions(performance_group_key, limit: nil) @client.get(path(performance_group_key, "/buyer-access-sessions"), { "limit" => limit }) end |
#retrieve(performance_group_key) ⇒ Object
26 27 28 |
# File 'lib/seatlayer/performance_groups.rb', line 26 def retrieve(performance_group_key) @client.get(path(performance_group_key)) end |
#retrieve_booking(performance_group_key, action_id) ⇒ Object
88 89 90 |
# File 'lib/seatlayer/performance_groups.rb', line 88 def retrieve_booking(performance_group_key, action_id) @client.get(path(performance_group_key, "/bookings/#{encode(action_id)}")) end |
#retrieve_hold(performance_group_key, operation_id) ⇒ Object
Read the trusted server projection before charging; do not price from client input or the picker state.
76 77 78 |
# File 'lib/seatlayer/performance_groups.rb', line 76 def retrieve_hold(performance_group_key, operation_id) @client.get(path(performance_group_key, "/holds/#{encode(operation_id)}")) end |
#retrieve_lifecycle(performance_group_key, operation_id) ⇒ Object
48 49 50 |
# File 'lib/seatlayer/performance_groups.rb', line 48 def retrieve_lifecycle(performance_group_key, operation_id) @client.get(path(performance_group_key, "/lifecycle/#{encode(operation_id)}")) end |
#revoke_buyer_access_session(performance_group_key, session_id) ⇒ Object
70 71 72 |
# File 'lib/seatlayer/performance_groups.rb', line 70 def revoke_buyer_access_session(performance_group_key, session_id) @client.delete(path(performance_group_key, "/buyer-access-sessions/#{encode(session_id)}")) end |