Class: SeatLayer::Events
- Defined in:
- lib/seatlayer/resources.rb
Overview
Event lifecycle, metadata and reports.
Constant Summary
Constants inherited from Resource
Instance Method Summary collapse
- #archive(event_key) ⇒ Object
-
#close(event_key) ⇒ Object
Stop buyer sales.
-
#close_ticket_release(event_key, release_id) ⇒ Object
Close one release while preserving its audit provenance.
-
#create(chart_id:, name: nil, slug: nil, starts_at: UNSET, venue: UNSET, external_ref: UNSET, currency: UNSET, idempotency_key: nil, description: UNSET, ends_at: UNSET, timezone: UNSET, locale: UNSET, poster_asset_id: UNSET, mode: nil) ⇒ Object
rubocop:disable-next Metrics/ParameterLists.
- #delete(event_key) ⇒ Object
- #delete_poster(event_key) ⇒ Object
-
#list(workspace_id: nil, external_ref: nil, limit: nil, cursor: nil, counts: true) ⇒ Object
One page of events.
-
#list_all(counts: false, **options, &block) ⇒ Object
Every event, paging transparently.
- #list_ticket_releases(event_key) ⇒ Object
- #reopen(event_key) ⇒ Object
- #retrieve(event_key) ⇒ Object
-
#retrieve_configuration_binding(event_key) ⇒ Object
Read the Event's exact immutable configuration selection and audit trail.
- #retrieve_hold_ttl(event_key) ⇒ Object
- #retrieve_log(event_key, limit: nil, before: nil) ⇒ Object
- #retrieve_report(event_key) ⇒ Object
- #update(event_key, fields) ⇒ Object
-
#update_chart(event_key, acknowledge_dropped_assignments: nil, reason: nil) ⇒ Object
Move a live event onto the latest published version of its chart.
-
#update_configuration_binding(event_key, expected_revision:, configuration:) ⇒ Object
Attach an exact published configuration version, or pass
nilto detach. - #update_hold_ttl(event_key, hold_ttl_ms) ⇒ Object
-
#update_poster(event_key, image, content_type: "application/octet-stream") ⇒ Object
Upload raw PNG, JPEG, or WebP bytes (maximum 5 MiB).
-
#update_ticket_releases(event_key, releases:) ⇒ Object
Replace every ticket release for an event.
Methods inherited from Resource
Constructor Details
This class inherits a constructor from SeatLayer::Resource
Instance Method Details
#archive(event_key) ⇒ Object
246 247 248 |
# File 'lib/seatlayer/resources.rb', line 246 def archive(event_key) @client.post("/v1/events/#{encode(event_key)}/archive") end |
#close(event_key) ⇒ Object
Stop buyer sales. Existing holds keep their TTL.
238 239 240 |
# File 'lib/seatlayer/resources.rb', line 238 def close(event_key) @client.post("/v1/events/#{encode(event_key)}/close") end |
#close_ticket_release(event_key, release_id) ⇒ Object
Close one release while preserving its audit provenance.
270 271 272 |
# File 'lib/seatlayer/resources.rb', line 270 def close_ticket_release(event_key, release_id) @client.post("/v1/events/#{encode(event_key)}/releases/#{encode(release_id)}/close") end |
#create(chart_id:, name: nil, slug: nil, starts_at: UNSET, venue: UNSET, external_ref: UNSET, currency: UNSET, idempotency_key: nil, description: UNSET, ends_at: UNSET, timezone: UNSET, locale: UNSET, poster_asset_id: UNSET, mode: nil) ⇒ Object
rubocop:disable-next Metrics/ParameterLists
179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/seatlayer/resources.rb', line 179 def create(chart_id:, name: nil, slug: nil, starts_at: UNSET, venue: UNSET, external_ref: UNSET, currency: UNSET, idempotency_key: nil, description: UNSET, ends_at: UNSET, timezone: UNSET, locale: UNSET, poster_asset_id: UNSET, mode: nil) body = compact({ "chartId" => chart_id, "name" => name, "slug" => slug, "mode" => mode }) body.merge!(supplied({ "startsAt" => starts_at, "venue" => venue, "externalRef" => external_ref, "currency" => currency, "description" => description, "endsAt" => ends_at, "timezone" => timezone, "locale" => locale, "posterAssetId" => poster_asset_id })) @client.post( "/v1/events", body, idempotency_key: idempotency_key, retry_policy: :header_replay ) end |
#delete(event_key) ⇒ Object
217 218 219 |
# File 'lib/seatlayer/resources.rb', line 217 def delete(event_key) @client.delete("/v1/events/#{encode(event_key)}") end |
#delete_poster(event_key) ⇒ Object
226 227 228 |
# File 'lib/seatlayer/resources.rb', line 226 def delete_poster(event_key) @client.delete("/v1/events/#{encode(event_key)}/poster") end |
#list(workspace_id: nil, external_ref: nil, limit: nil, cursor: nil, counts: true) ⇒ Object
One page of events.
Live availability counts cost one round-trip per event server-side. They are on by default because most callers of a single page want them; pass counts: false when paging a whole catalogue.
156 157 158 159 160 161 |
# File 'lib/seatlayer/resources.rb', line 156 def list(workspace_id: nil, external_ref: nil, limit: nil, cursor: nil, counts: true) query = compact({ "workspaceId" => workspace_id, "externalRef" => external_ref, "limit" => limit, "cursor" => cursor }) query["counts"] = "0" unless counts @client.get("/v1/events", query) end |
#list_all(counts: false, **options, &block) ⇒ Object
Every event, paging transparently. Counts default off here — you are walking the whole list, so per-event availability is rarely what you want and always what it costs.
166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/seatlayer/resources.rb', line 166 def list_all(counts: false, **, &block) return enum_for(:list_all, counts: counts, **) unless block_given? cursor = nil loop do page = list(**, counts: counts, cursor: cursor) Array(page["events"]).each(&block) cursor = page["nextCursor"] break if cursor.nil? || cursor.empty? end end |
#list_ticket_releases(event_key) ⇒ Object
259 260 261 |
# File 'lib/seatlayer/resources.rb', line 259 def list_ticket_releases(event_key) @client.get("/v1/events/#{encode(event_key)}/releases") end |
#reopen(event_key) ⇒ Object
242 243 244 |
# File 'lib/seatlayer/resources.rb', line 242 def reopen(event_key) @client.post("/v1/events/#{encode(event_key)}/reopen") end |
#retrieve(event_key) ⇒ Object
194 195 196 |
# File 'lib/seatlayer/resources.rb', line 194 def retrieve(event_key) @client.get("/v1/events/#{encode(event_key)}") end |
#retrieve_configuration_binding(event_key) ⇒ Object
Read the Event's exact immutable configuration selection and audit trail.
199 200 201 |
# File 'lib/seatlayer/resources.rb', line 199 def retrieve_configuration_binding(event_key) @client.get("/v1/events/#{encode(event_key)}/event-configuration") end |
#retrieve_hold_ttl(event_key) ⇒ Object
250 251 252 |
# File 'lib/seatlayer/resources.rb', line 250 def retrieve_hold_ttl(event_key) @client.get("/v1/events/#{encode(event_key)}/hold-ttl") end |
#retrieve_log(event_key, limit: nil, before: nil) ⇒ Object
278 279 280 281 |
# File 'lib/seatlayer/resources.rb', line 278 def retrieve_log(event_key, limit: nil, before: nil) @client.get("/v1/events/#{encode(event_key)}/log", compact({ "limit" => limit, "before" => before })) end |
#retrieve_report(event_key) ⇒ Object
274 275 276 |
# File 'lib/seatlayer/resources.rb', line 274 def retrieve_report(event_key) @client.get("/v1/events/#{encode(event_key)}/report") end |
#update(event_key, fields) ⇒ Object
213 214 215 |
# File 'lib/seatlayer/resources.rb', line 213 def update(event_key, fields) @client.patch("/v1/events/#{encode(event_key)}", fields) end |
#update_chart(event_key, acknowledge_dropped_assignments: nil, reason: nil) ⇒ Object
Move a live event onto the latest published version of its chart.
231 232 233 234 235 |
# File 'lib/seatlayer/resources.rb', line 231 def update_chart(event_key, acknowledge_dropped_assignments: nil, reason: nil) body = compact({ "acknowledgeDroppedAssignments" => acknowledge_dropped_assignments, "reason" => reason }) @client.post("/v1/events/#{encode(event_key)}/update-chart", body) end |
#update_configuration_binding(event_key, expected_revision:, configuration:) ⇒ Object
Attach an exact published configuration version, or pass nil to detach.
The expected revision prevents one administrator from silently overwriting
another, and the mutation remains deliberately single-attempt.
206 207 208 209 210 211 |
# File 'lib/seatlayer/resources.rb', line 206 def update_configuration_binding(event_key, expected_revision:, configuration:) @client.put( "/v1/events/#{encode(event_key)}/event-configuration", { "expectedRevision" => expected_revision, "configuration" => configuration } ) end |
#update_hold_ttl(event_key, hold_ttl_ms) ⇒ Object
254 255 256 257 |
# File 'lib/seatlayer/resources.rb', line 254 def update_hold_ttl(event_key, hold_ttl_ms) # +nil+ restores the event default and must remain an explicit JSON null. @client.post("/v1/events/#{encode(event_key)}/hold-ttl", { "holdTtlMs" => hold_ttl_ms }) end |
#update_poster(event_key, image, content_type: "application/octet-stream") ⇒ Object
Upload raw PNG, JPEG, or WebP bytes (maximum 5 MiB).
222 223 224 |
# File 'lib/seatlayer/resources.rb', line 222 def update_poster(event_key, image, content_type: "application/octet-stream") @client.put_raw("/v1/events/#{encode(event_key)}/poster", image, content_type: content_type) end |
#update_ticket_releases(event_key, releases:) ⇒ Object
Replace every ticket release for an event. This stays single-attempt: the route does not promise exact idempotent-response replay.
265 266 267 |
# File 'lib/seatlayer/resources.rb', line 265 def update_ticket_releases(event_key, releases:) @client.put("/v1/events/#{encode(event_key)}/releases", { "releases" => releases }) end |