Class: SeatLayer::Events
- Defined in:
- lib/seatlayer/resources.rb
Overview
Event lifecycle, metadata and reports.
Instance Method Summary collapse
- #archive(event_key) ⇒ Object
-
#close(event_key) ⇒ Object
Stop buyer sales.
- #create(chart_id:, name: nil, slug: nil, starts_at: nil, venue: nil, external_ref: nil, currency: nil, idempotency_key: nil) ⇒ Object
- #delete(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
- #retrieve_hold_ttl(event_key) ⇒ Object
- #retrieve_log(event_key) ⇒ Object
- #retrieve_report(event_key) ⇒ Object
- #update(event_key, fields) ⇒ Object
-
#update_chart(event_key) ⇒ Object
Move a live event onto the latest published version of its chart.
- #update_hold_ttl(event_key, hold_ttl_ms) ⇒ Object
Methods inherited from Resource
Constructor Details
This class inherits a constructor from SeatLayer::Resource
Instance Method Details
#archive(event_key) ⇒ Object
168 169 170 |
# File 'lib/seatlayer/resources.rb', line 168 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.
160 161 162 |
# File 'lib/seatlayer/resources.rb', line 160 def close(event_key) @client.post("/v1/events/#{encode(event_key)}/close") end |
#create(chart_id:, name: nil, slug: nil, starts_at: nil, venue: nil, external_ref: nil, currency: nil, idempotency_key: nil) ⇒ Object
134 135 136 137 138 139 140 |
# File 'lib/seatlayer/resources.rb', line 134 def create(chart_id:, name: nil, slug: nil, starts_at: nil, venue: nil, external_ref: nil, currency: nil, idempotency_key: nil) body = compact({ "chartId" => chart_id, "name" => name, "slug" => slug, "startsAt" => starts_at, "venue" => venue, "externalRef" => external_ref, "currency" => currency }) @client.post("/v1/events", body, idempotency_key: idempotency_key) end |
#delete(event_key) ⇒ Object
150 151 152 |
# File 'lib/seatlayer/resources.rb', line 150 def delete(event_key) @client.delete("/v1/events/#{encode(event_key)}") 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.
112 113 114 115 116 117 |
# File 'lib/seatlayer/resources.rb', line 112 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.
122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/seatlayer/resources.rb', line 122 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
164 165 166 |
# File 'lib/seatlayer/resources.rb', line 164 def reopen(event_key) @client.post("/v1/events/#{encode(event_key)}/reopen") end |
#retrieve(event_key) ⇒ Object
142 143 144 |
# File 'lib/seatlayer/resources.rb', line 142 def retrieve(event_key) @client.get("/v1/events/#{encode(event_key)}") end |
#retrieve_hold_ttl(event_key) ⇒ Object
172 173 174 |
# File 'lib/seatlayer/resources.rb', line 172 def retrieve_hold_ttl(event_key) @client.get("/v1/events/#{encode(event_key)}/hold-ttl") end |
#retrieve_log(event_key) ⇒ Object
184 185 186 |
# File 'lib/seatlayer/resources.rb', line 184 def retrieve_log(event_key) @client.get("/v1/events/#{encode(event_key)}/log") end |
#retrieve_report(event_key) ⇒ Object
180 181 182 |
# File 'lib/seatlayer/resources.rb', line 180 def retrieve_report(event_key) @client.get("/v1/events/#{encode(event_key)}/report") end |
#update(event_key, fields) ⇒ Object
146 147 148 |
# File 'lib/seatlayer/resources.rb', line 146 def update(event_key, fields) @client.patch("/v1/events/#{encode(event_key)}", fields) end |
#update_chart(event_key) ⇒ Object
Move a live event onto the latest published version of its chart.
155 156 157 |
# File 'lib/seatlayer/resources.rb', line 155 def update_chart(event_key) @client.post("/v1/events/#{encode(event_key)}/update-chart") end |
#update_hold_ttl(event_key, hold_ttl_ms) ⇒ Object
176 177 178 |
# File 'lib/seatlayer/resources.rb', line 176 def update_hold_ttl(event_key, hold_ttl_ms) @client.post("/v1/events/#{encode(event_key)}/hold-ttl", { "holdTtlMs" => hold_ttl_ms }) end |