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.
-
#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 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.
- #reopen(event_key) ⇒ Object
-
#retrieve(event_key) ⇒ Object
rubocop:enable Metrics/ParameterLists.
- #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_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).
Methods inherited from Resource
Constructor Details
This class inherits a constructor from SeatLayer::Resource
Instance Method Details
#archive(event_key) ⇒ Object
215 216 217 |
# File 'lib/seatlayer/resources.rb', line 215 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.
207 208 209 |
# File 'lib/seatlayer/resources.rb', line 207 def close(event_key) @client.post("/v1/events/#{encode(event_key)}/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 Metrics/ParameterLists
162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/seatlayer/resources.rb', line 162 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
186 187 188 |
# File 'lib/seatlayer/resources.rb', line 186 def delete(event_key) @client.delete("/v1/events/#{encode(event_key)}") end |
#delete_poster(event_key) ⇒ Object
195 196 197 |
# File 'lib/seatlayer/resources.rb', line 195 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.
139 140 141 142 143 144 |
# File 'lib/seatlayer/resources.rb', line 139 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.
149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/seatlayer/resources.rb', line 149 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 |
#reopen(event_key) ⇒ Object
211 212 213 |
# File 'lib/seatlayer/resources.rb', line 211 def reopen(event_key) @client.post("/v1/events/#{encode(event_key)}/reopen") end |
#retrieve(event_key) ⇒ Object
rubocop:enable Metrics/ParameterLists
178 179 180 |
# File 'lib/seatlayer/resources.rb', line 178 def retrieve(event_key) @client.get("/v1/events/#{encode(event_key)}") end |
#retrieve_hold_ttl(event_key) ⇒ Object
219 220 221 |
# File 'lib/seatlayer/resources.rb', line 219 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
232 233 234 235 |
# File 'lib/seatlayer/resources.rb', line 232 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
228 229 230 |
# File 'lib/seatlayer/resources.rb', line 228 def retrieve_report(event_key) @client.get("/v1/events/#{encode(event_key)}/report") end |
#update(event_key, fields) ⇒ Object
182 183 184 |
# File 'lib/seatlayer/resources.rb', line 182 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.
200 201 202 203 204 |
# File 'lib/seatlayer/resources.rb', line 200 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_hold_ttl(event_key, hold_ttl_ms) ⇒ Object
223 224 225 226 |
# File 'lib/seatlayer/resources.rb', line 223 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).
191 192 193 |
# File 'lib/seatlayer/resources.rb', line 191 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 |