Class: SeatLayer::Seasons

Inherits:
Resource show all
Defined in:
lib/seatlayer/seasons.rb

Overview

Fixed Renewable Season organizer operations for trusted backends.

Browser selection belongs in the distinct SeasonPicker. Give it only the show-once scoped token returned by create_season_buyer_access_session.

Constant Summary

Constants inherited from Resource

Resource::UNSET

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from SeatLayer::Resource

Instance Method Details

#activate_season(season_key, expected_revision:) ⇒ Object



48
49
50
# File 'lib/seatlayer/seasons.rb', line 48

def activate_season(season_key, expected_revision:)
  lifecycle(season_key, "activate", expected_revision)
end

#archive_season(season_key, expected_revision:) ⇒ Object



56
57
58
# File 'lib/seatlayer/seasons.rb', line 56

def archive_season(season_key, expected_revision:)
  lifecycle(season_key, "archive", expected_revision)
end

#book_season_hold(season_key, operation_id, book_action_id:, booking_ref:) ⇒ Object



129
130
131
132
# File 'lib/seatlayer/seasons.rb', line 129

def book_season_hold(season_key, operation_id, book_action_id:, booking_ref:)
  @client.post(path(season_key, "/holds/#{encode(operation_id)}/book"),
               { "bookActionId" => book_action_id, "bookingRef" => booking_ref })
end

#cancel_season_booking(season_key, action_id, cancel_action_id:, booking_ref:, plan_activation_id:, right_disposition:) ⇒ Object



138
139
140
141
142
143
144
# File 'lib/seatlayer/seasons.rb', line 138

def cancel_season_booking(season_key, action_id, cancel_action_id:, booking_ref:,
                          plan_activation_id:, right_disposition:)
  @client.post(path(season_key, "/bookings/#{encode(action_id)}/cancel"),
               { "cancelActionId" => cancel_action_id, "bookingRef" => booking_ref,
                 "planActivationId" => plan_activation_id,
                 "rightDisposition" => right_disposition })
end

#close_season(season_key, expected_revision:) ⇒ Object



52
53
54
# File 'lib/seatlayer/seasons.rb', line 52

def close_season(season_key, expected_revision:)
  lifecycle(season_key, "close", expected_revision)
end

#commit_season_renewal_offer(season_key, offer_id, commit_action_id:, order_ref:, booking_ref:, plan_activation_id:) ⇒ Object



188
189
190
191
192
193
# File 'lib/seatlayer/seasons.rb', line 188

def commit_season_renewal_offer(season_key, offer_id, commit_action_id:, order_ref:,
                                booking_ref:, plan_activation_id:)
  @client.post(path(season_key, "/renewal-offers/#{encode(offer_id)}/commit"),
               { "commitActionId" => commit_action_id, "orderRef" => order_ref,
                 "bookingRef" => booking_ref, "planActivationId" => plan_activation_id })
end

#create_season(name:, event_keys: nil, source_performance_group_keys: nil, edition: UNSET, idempotency_key: nil) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/seatlayer/seasons.rb', line 21

def create_season(name:, event_keys: nil, source_performance_group_keys: nil,
                  edition: UNSET, idempotency_key: nil)
  body = selection(event_keys, source_performance_group_keys).merge("name" => name)
  body.merge!(supplied({ "edition" => edition }))
  @client.post("/v1/seasons", body, idempotency_key: idempotency_key,
                                    retry_policy: :header_replay)
end

#create_season_amendment(season_key, event_key:, kind:, starts_at: nil, name: nil, idempotency_key: nil) ⇒ Object



207
208
209
210
211
212
213
# File 'lib/seatlayer/seasons.rb', line 207

def create_season_amendment(season_key, event_key:, kind:, starts_at: nil, name: nil,
                            idempotency_key: nil)
  @client.post(path(season_key, "/amendments"),
               compact({ "eventKey" => event_key, "kind" => kind,
                         "startsAt" => starts_at, "name" => name }),
               idempotency_key: idempotency_key, retry_policy: :header_replay)
end

#create_season_buyer_access_session(season_key, allowed_origin:, include_public:, expires_in_seconds: nil, max_quantity: UNSET, buyer_ref: UNSET) ⇒ Object

Reveal one show-once browser bearer. This call is deliberately single-attempt.



108
109
110
111
112
113
114
115
# File 'lib/seatlayer/seasons.rb', line 108

def create_season_buyer_access_session(season_key, allowed_origin:, include_public:,
                                       expires_in_seconds: nil, max_quantity: UNSET,
                                       buyer_ref: UNSET)
  body = compact({ "allowedOrigin" => allowed_origin, "includePublic" => include_public,
                   "expiresInSeconds" => expires_in_seconds })
  body.merge!(supplied({ "maxQuantity" => max_quantity, "buyerRef" => buyer_ref }))
  @client.post(path(season_key, "/buyer-access-sessions"), body)
end

#create_season_holder_import(season_key, successor_plan_activation_id:, rows:, dry_run: UNSET, idempotency_key: nil) ⇒ Object



150
151
152
153
154
155
156
# File 'lib/seatlayer/seasons.rb', line 150

def create_season_holder_import(season_key, successor_plan_activation_id:, rows:,
                                dry_run: UNSET, idempotency_key: nil)
  body = { "successorPlanActivationId" => successor_plan_activation_id, "rows" => rows }
  body.merge!(supplied({ "dryRun" => dry_run }))
  @client.post(path(season_key, "/imports"), body, idempotency_key: idempotency_key,
                                                   retry_policy: :header_replay)
end

#create_season_plan(season_key, name:, event_keys: nil, source_performance_group_keys: nil, idempotency_key: nil) ⇒ Object



64
65
66
67
68
69
# File 'lib/seatlayer/seasons.rb', line 64

def create_season_plan(season_key, name:, event_keys: nil,
                       source_performance_group_keys: nil, idempotency_key: nil)
  body = selection(event_keys, source_performance_group_keys).merge("name" => name)
  @client.post(path(season_key, "/plans"), body, idempotency_key: idempotency_key,
                                                 retry_policy: :header_replay)
end

#create_season_renewal_offers(season_key, deadline_at:, successor_plan_activation_id: nil, contract_ids: nil, idempotency_key: nil) ⇒ Object



162
163
164
165
166
167
168
169
# File 'lib/seatlayer/seasons.rb', line 162

def create_season_renewal_offers(season_key, deadline_at:,
                                 successor_plan_activation_id: nil, contract_ids: nil,
                                 idempotency_key: nil)
  body = compact({ "successorPlanActivationId" => successor_plan_activation_id,
                   "deadlineAt" => deadline_at, "contractIds" => contract_ids })
  @client.post(path(season_key, "/renewal-offers"), body,
               idempotency_key: idempotency_key, retry_policy: :header_replay)
end

#decline_season_renewal_offer(season_key, offer_id) ⇒ Object



195
196
197
# File 'lib/seatlayer/seasons.rb', line 195

def decline_season_renewal_offer(season_key, offer_id)
  @client.post(path(season_key, "/renewal-offers/#{encode(offer_id)}/decline"), {})
end

#delete_season(season_key, idempotency_key: nil) ⇒ Object



42
43
44
45
46
# File 'lib/seatlayer/seasons.rb', line 42

def delete_season(season_key, idempotency_key: nil)
  @client.mutation_with_header_replay(
    "DELETE", path(season_key), idempotency_key: idempotency_key
  )
end

#duplicate_season_to_live(season_key, event_keys:, name: nil, idempotency_key: nil) ⇒ Object



101
102
103
104
105
# File 'lib/seatlayer/seasons.rb', line 101

def duplicate_season_to_live(season_key, event_keys:, name: nil, idempotency_key: nil)
  @client.post(path(season_key, "/duplicate-to-live"),
               compact({ "eventKeys" => event_keys, "name" => name }),
               idempotency_key: idempotency_key, retry_policy: :header_replay)
end

#end_season_sales(season_key, expected_revision:) ⇒ Object



97
98
99
# File 'lib/seatlayer/seasons.rb', line 97

def end_season_sales(season_key, expected_revision:)
  sales(season_key, "end", expected_revision)
end

#export_season_support_snapshot(season_key) ⇒ Object



248
249
250
# File 'lib/seatlayer/seasons.rb', line 248

def export_season_support_snapshot(season_key)
  @client.get(path(season_key, "/export"))
end

#extend_season_renewal_offer(season_key, offer_id, deadline_at:) ⇒ Object



179
180
181
182
# File 'lib/seatlayer/seasons.rb', line 179

def extend_season_renewal_offer(season_key, offer_id, deadline_at:)
  @client.post(path(season_key, "/renewal-offers/#{encode(offer_id)}/extend"),
               { "deadlineAt" => deadline_at })
end

#inspect_season_renewal_offer(season_key, offer_id) ⇒ Object



184
185
186
# File 'lib/seatlayer/seasons.rb', line 184

def inspect_season_renewal_offer(season_key, offer_id)
  @client.get(path(season_key, "/renewal-offers/#{encode(offer_id)}/inspect"))
end

#list_season_amendments(season_key) ⇒ Object



215
216
217
# File 'lib/seatlayer/seasons.rb', line 215

def list_season_amendments(season_key)
  @client.get(path(season_key, "/amendments"))
end

#list_season_audit(season_key) ⇒ Object



244
245
246
# File 'lib/seatlayer/seasons.rb', line 244

def list_season_audit(season_key)
  @client.get(path(season_key, "/audit"))
end

#list_season_buyer_access_sessions(season_key, limit: nil) ⇒ Object



117
118
119
# File 'lib/seatlayer/seasons.rb', line 117

def list_season_buyer_access_sessions(season_key, limit: nil)
  @client.get(path(season_key, "/buyer-access-sessions"), compact({ "limit" => limit }))
end

#list_season_occurrences(season_key) ⇒ Object



203
204
205
# File 'lib/seatlayer/seasons.rb', line 203

def list_season_occurrences(season_key)
  @client.get(path(season_key, "/occurrences"))
end

#list_season_operations(season_key) ⇒ Object



227
228
229
# File 'lib/seatlayer/seasons.rb', line 227

def list_season_operations(season_key)
  @client.get(path(season_key, "/operations"))
end

#list_season_outbox(season_key) ⇒ Object



236
237
238
# File 'lib/seatlayer/seasons.rb', line 236

def list_season_outbox(season_key)
  @client.get(path(season_key, "/outbox"))
end

#list_season_renewal_offers(season_key) ⇒ Object



171
172
173
# File 'lib/seatlayer/seasons.rb', line 171

def list_season_renewal_offers(season_key)
  @client.get(path(season_key, "/renewal-offers"))
end

#list_seasons(workspace_id: nil, structure_state: nil, limit: nil, cursor: nil) ⇒ Object



9
10
11
12
13
# File 'lib/seatlayer/seasons.rb', line 9

def list_seasons(workspace_id: nil, structure_state: nil, limit: nil, cursor: nil)
  @client.get("/v1/seasons", compact({ "workspaceId" => workspace_id,
                                       "structureState" => structure_state,
                                       "limit" => limit, "cursor" => cursor }))
end

#open_season_sales(season_key, expected_revision:) ⇒ Object



85
86
87
# File 'lib/seatlayer/seasons.rb', line 85

def open_season_sales(season_key, expected_revision:)
  sales(season_key, "open", expected_revision)
end

#pause_season_sales(season_key, expected_revision:) ⇒ Object



89
90
91
# File 'lib/seatlayer/seasons.rb', line 89

def pause_season_sales(season_key, expected_revision:)
  sales(season_key, "pause", expected_revision)
end

#publish_season_plan(season_key, plan_key, expected_revision:) ⇒ Object



75
76
77
78
# File 'lib/seatlayer/seasons.rb', line 75

def publish_season_plan(season_key, plan_key, expected_revision:)
  @client.post(path(season_key, "/plans/#{encode(plan_key)}/publish"),
               { "expectedRevision" => expected_revision })
end

#release_season_renewal_offer(season_key, offer_id) ⇒ Object



199
200
201
# File 'lib/seatlayer/seasons.rb', line 199

def release_season_renewal_offer(season_key, offer_id)
  @client.post(path(season_key, "/renewal-offers/#{encode(offer_id)}/release"), {})
end

#replay_season_outbox(season_key, occurrence_id) ⇒ Object



240
241
242
# File 'lib/seatlayer/seasons.rb', line 240

def replay_season_outbox(season_key, occurrence_id)
  @client.post(path(season_key, "/outbox/#{encode(occurrence_id)}/replay"), {})
end

#resume_season_sales(season_key, expected_revision:) ⇒ Object



93
94
95
# File 'lib/seatlayer/seasons.rb', line 93

def resume_season_sales(season_key, expected_revision:)
  sales(season_key, "resume", expected_revision)
end

#retrieve_season(season_key) ⇒ Object



29
30
31
# File 'lib/seatlayer/seasons.rb', line 29

def retrieve_season(season_key)
  @client.get(path(season_key))
end

#retrieve_season_amendment(season_key, amendment_id) ⇒ Object



219
220
221
# File 'lib/seatlayer/seasons.rb', line 219

def retrieve_season_amendment(season_key, amendment_id)
  @client.get(path(season_key, "/amendments/#{encode(amendment_id)}"))
end

#retrieve_season_booking(season_key, action_id) ⇒ Object



134
135
136
# File 'lib/seatlayer/seasons.rb', line 134

def retrieve_season_booking(season_key, action_id)
  @client.get(path(season_key, "/bookings/#{encode(action_id)}"))
end

#retrieve_season_hold(season_key, operation_id) ⇒ Object



125
126
127
# File 'lib/seatlayer/seasons.rb', line 125

def retrieve_season_hold(season_key, operation_id)
  @client.get(path(season_key, "/holds/#{encode(operation_id)}"))
end

#retrieve_season_holder_import(season_key, import_id) ⇒ Object



158
159
160
# File 'lib/seatlayer/seasons.rb', line 158

def retrieve_season_holder_import(season_key, import_id)
  @client.get(path(season_key, "/imports/#{encode(import_id)}"))
end

#retrieve_season_lifecycle(season_key, operation_id) ⇒ Object



60
61
62
# File 'lib/seatlayer/seasons.rb', line 60

def retrieve_season_lifecycle(season_key, operation_id)
  @client.get(path(season_key, "/lifecycle/#{encode(operation_id)}"))
end

#retrieve_season_plan(season_key, plan_key) ⇒ Object



71
72
73
# File 'lib/seatlayer/seasons.rb', line 71

def retrieve_season_plan(season_key, plan_key)
  @client.get(path(season_key, "/plans/#{encode(plan_key)}"))
end

#retrieve_season_renewal_offer(season_key, offer_id) ⇒ Object



175
176
177
# File 'lib/seatlayer/seasons.rb', line 175

def retrieve_season_renewal_offer(season_key, offer_id)
  @client.get(path(season_key, "/renewal-offers/#{encode(offer_id)}"))
end

#retrieve_season_report(season_key) ⇒ Object



223
224
225
# File 'lib/seatlayer/seasons.rb', line 223

def retrieve_season_report(season_key)
  @client.get(path(season_key, "/reports"))
end

#retrieve_season_support_lookup(season_key, booking_ref: nil, holder_ref: nil) ⇒ Object



231
232
233
234
# File 'lib/seatlayer/seasons.rb', line 231

def retrieve_season_support_lookup(season_key, booking_ref: nil, holder_ref: nil)
  @client.get(path(season_key, "/support-lookups"),
              compact({ "bookingRef" => booking_ref, "holderRef" => holder_ref }))
end

#revoke_season_buyer_access_session(season_key, session_id) ⇒ Object



121
122
123
# File 'lib/seatlayer/seasons.rb', line 121

def revoke_season_buyer_access_session(season_key, session_id)
  @client.delete(path(season_key, "/buyer-access-sessions/#{encode(session_id)}"))
end

#supersede_season_plan(season_key, plan_key, expected_revision:) ⇒ Object



80
81
82
83
# File 'lib/seatlayer/seasons.rb', line 80

def supersede_season_plan(season_key, plan_key, expected_revision:)
  @client.post(path(season_key, "/plans/#{encode(plan_key)}/supersede"),
               { "expectedRevision" => expected_revision })
end

#update_season(season_key, expected_revision:, name: nil, edition: UNSET, idempotency_key: nil) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/seatlayer/seasons.rb', line 33

def update_season(season_key, expected_revision:, name: nil, edition: UNSET,
                  idempotency_key: nil)
  body = compact({ "expectedRevision" => expected_revision, "name" => name })
  body.merge!(supplied({ "edition" => edition }))
  @client.mutation_with_header_replay(
    "PATCH", path(season_key), body, idempotency_key: idempotency_key
  )
end

#validate_season(event_keys: nil, source_performance_group_keys: nil) ⇒ Object

Read-only compatibility preflight.



16
17
18
19
# File 'lib/seatlayer/seasons.rb', line 16

def validate_season(event_keys: nil, source_performance_group_keys: nil)
  @client.post("/v1/seasons/validate",
               selection(event_keys, source_performance_group_keys))
end

#validate_season_buyer_rehearsal(season_key) ⇒ Object



146
147
148
# File 'lib/seatlayer/seasons.rb', line 146

def validate_season_buyer_rehearsal(season_key)
  @client.post(path(season_key, "/buyer-rehearsals/validate"))
end