ittybit 0.7.6 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b244efadc944c3d3983943a53e62e0b553e21eb9e0717ff4a3ee1512f3879909
4
- data.tar.gz: f3736a908e119ee1324f616e07af8f63e4fdd5f0ac4447b6440990ece8fd7629
3
+ metadata.gz: 68c5c28ca6b723ff4a4d39808a6d3abc4ed054fd989f634bbf6ad80bca79c1cc
4
+ data.tar.gz: 16559f00f2413da6b35e47ef14b3c55205fd2444dd93a6ec3b7aec8863149bf0
5
5
  SHA512:
6
- metadata.gz: 50e7da1d6cfb20932674642060b296ac71aedc88cb7ff4fa821ce18775458168afb227792f3605b601dccd370b15943e136ddd7f2fed98fe70a900ead5b1215c
7
- data.tar.gz: c3038600b9d3973c045e1a7efa2e789bb15ba17b3ea3e5cab7b7681798634eb7d5c4c9b822d417599c6e034ed8a5e28affa1c29ee3779974ec45c8f48720b097
6
+ metadata.gz: 9033149c63d7848dd8492b37d390fa94bf75f88cccb1599e62a0831044628f9da55f90d9f8937090336e3ae64079c87ba10a9381c1b78b4e4165063391f625ec
7
+ data.tar.gz: 73293534e09b68e8ff28a50c1954f235e40963ec9fe7ef236dcd0d85a4952b5a6f867343109938749153cc13af2cd3cb799a77b251b9171e4e331cee908b3a75
@@ -2,9 +2,13 @@
2
2
 
3
3
  require_relative "../../requests"
4
4
  require_relative "../types/automation_list_response"
5
+ require_relative "types/automations_create_request_trigger"
6
+ require_relative "../types/workflow_task_step"
7
+ require_relative "types/automations_create_request_status"
5
8
  require_relative "../types/automation_response"
9
+ require_relative "../types/confirmation_response"
6
10
  require_relative "types/automations_update_request_trigger"
7
- require_relative "../types/workflow_task_step"
11
+ require_relative "types/automations_update_request_status"
8
12
  require "async"
9
13
 
10
14
  module Ittybit
@@ -18,8 +22,9 @@ module Ittybit
18
22
  @request_client = request_client
19
23
  end
20
24
 
21
- # Retrieves a list of all automations for the current project
25
+ # Retrieves a paginated list of all automations for the current project
22
26
  #
27
+ # @param limit [Integer]
23
28
  # @param request_options [Ittybit::RequestOptions]
24
29
  # @return [Ittybit::AutomationListResponse]
25
30
  # @example
@@ -29,7 +34,7 @@ module Ittybit
29
34
  # token: "YOUR_AUTH_TOKEN"
30
35
  # )
31
36
  # api.automations.list
32
- def list(request_options: nil)
37
+ def list(limit: nil, request_options: nil)
33
38
  response = @request_client.conn.get do |req|
34
39
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
35
40
  req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
@@ -39,9 +44,7 @@ module Ittybit
39
44
  **@request_client.get_headers,
40
45
  **(request_options&.additional_headers || {})
41
46
  }.compact
42
- unless request_options.nil? || request_options&.additional_query_parameters.nil?
43
- req.params = { **(request_options&.additional_query_parameters || {}) }.compact
44
- end
47
+ req.params = { **(request_options&.additional_query_parameters || {}), "limit": limit }.compact
45
48
  unless request_options.nil? || request_options&.additional_body_parameters.nil?
46
49
  req.body = { **(request_options&.additional_body_parameters || {}) }.compact
47
50
  end
@@ -50,8 +53,18 @@ module Ittybit
50
53
  Ittybit::AutomationListResponse.from_json(json_object: response.body)
51
54
  end
52
55
 
53
- # Creates a new automation for the current project
56
+ # Creates a new automation.
54
57
  #
58
+ # @param name [String]
59
+ # @param description [String]
60
+ # @param trigger [Hash] Request of type Ittybit::Automations::AutomationsCreateRequestTrigger, as a Hash
61
+ # * :kind (String)
62
+ # * :event (String)
63
+ # @param workflow [Array<Hash>] Request of type Array<Ittybit::WorkflowTaskStep>, as a Hash
64
+ # * :kind (Ittybit::WorkflowTaskStepKind)
65
+ # * :ref (String)
66
+ # * :next_ (Array<Ittybit::WorkflowTaskStepNextItem>)
67
+ # @param status [Ittybit::Automations::AutomationsCreateRequestStatus]
55
68
  # @param request_options [Ittybit::RequestOptions]
56
69
  # @return [Ittybit::AutomationResponse]
57
70
  # @example
@@ -60,8 +73,14 @@ module Ittybit
60
73
  # environment: Ittybit::Environment::DEFAULT,
61
74
  # token: "YOUR_AUTH_TOKEN"
62
75
  # )
63
- # api.automations.create
64
- def create(request_options: nil)
76
+ # api.automations.create(
77
+ # name: "My Example Automation",
78
+ # description: "This workflow will run whenever new media is created.",
79
+ # trigger: { kind: "event", event: "media.created" },
80
+ # workflow: [{ kind: DESCRIPTION }, { kind: IMAGE, ref: "thumbnail" }, { kind: CONDITIONS, next_: [{ kind: "subtitle", ref: "subtitle" }] }],
81
+ # status: ACTIVE
82
+ # )
83
+ def create(trigger:, workflow:, name: nil, description: nil, status: nil, request_options: nil)
65
84
  response = @request_client.conn.post do |req|
66
85
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
67
86
  req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
@@ -74,15 +93,20 @@ module Ittybit
74
93
  unless request_options.nil? || request_options&.additional_query_parameters.nil?
75
94
  req.params = { **(request_options&.additional_query_parameters || {}) }.compact
76
95
  end
77
- unless request_options.nil? || request_options&.additional_body_parameters.nil?
78
- req.body = { **(request_options&.additional_body_parameters || {}) }.compact
79
- end
96
+ req.body = {
97
+ **(request_options&.additional_body_parameters || {}),
98
+ name: name,
99
+ description: description,
100
+ trigger: trigger,
101
+ workflow: workflow,
102
+ status: status
103
+ }.compact
80
104
  req.url "#{@request_client.get_url(request_options: request_options)}/automations"
81
105
  end
82
106
  Ittybit::AutomationResponse.from_json(json_object: response.body)
83
107
  end
84
108
 
85
- # Retrieves a specific automation by its ID
109
+ # Retrieve the automation object for a automation with the given ID.
86
110
  #
87
111
  # @param id [String]
88
112
  # @param request_options [Ittybit::RequestOptions]
@@ -115,43 +139,20 @@ module Ittybit
115
139
  Ittybit::AutomationResponse.from_json(json_object: response.body)
116
140
  end
117
141
 
118
- # Updates an existing automation by its ID
142
+ # Permanently removes an automation from the system. This action cannot be undone.
119
143
  #
120
144
  # @param id [String]
121
- # @param name [String]
122
- # @param description [String]
123
- # @param trigger [Hash] Defines the trigger event and conditions. To clear/remove a trigger, provide
124
- # null. To update, provide the new trigger object.Request of type Ittybit::Automations::AutomationsUpdateRequestTrigger, as a Hash
125
- # * :event (String)
126
- # * :conditions (Array<Ittybit::Automations::AutomationsUpdateRequestTriggerConditionsItem>)
127
- # @param workflow [Array<Hash>] The updated sequence of tasks for the automation.Request of type Array<Ittybit::WorkflowTaskStep>, as a Hash
128
- # * :kind (Ittybit::WorkflowTaskStepKind)
129
- # * :ref (String)
130
- # * :format (String)
131
- # * :start (Float)
132
- # * :end_ (Float)
133
- # * :width (Integer)
134
- # * :height (Integer)
135
- # * :fit (String)
136
- # * :background (String)
137
- # * :quality (Integer)
138
- # * :next_ (Array<Object>)
139
145
  # @param request_options [Ittybit::RequestOptions]
140
- # @return [Ittybit::AutomationResponse]
146
+ # @return [Ittybit::ConfirmationResponse]
141
147
  # @example
142
148
  # api = Ittybit::Client.new(
143
149
  # base_url: "https://api.example.com",
144
150
  # environment: Ittybit::Environment::DEFAULT,
145
151
  # token: "YOUR_AUTH_TOKEN"
146
152
  # )
147
- # api.automations.update(
148
- # id: "id",
149
- # name: "Updated Transcoder Example",
150
- # trigger: { event: "upload.completed", conditions: [{ prop: "file.type", value: "image/*" }] },
151
- # workflow: [{ kind: IMAGE, format: "webp" }]
152
- # )
153
- def update(id:, name:, description: nil, trigger: nil, workflow: nil, request_options: nil)
154
- response = @request_client.conn.put do |req|
153
+ # api.automations.delete(id: "id")
154
+ def delete(id:, request_options: nil)
155
+ response = @request_client.conn.delete do |req|
155
156
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
156
157
  req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
157
158
  req.headers["ACCEPT_VERSION"] = request_options.version unless request_options&.version.nil?
@@ -163,32 +164,44 @@ module Ittybit
163
164
  unless request_options.nil? || request_options&.additional_query_parameters.nil?
164
165
  req.params = { **(request_options&.additional_query_parameters || {}) }.compact
165
166
  end
166
- req.body = {
167
- **(request_options&.additional_body_parameters || {}),
168
- name: name,
169
- description: description,
170
- trigger: trigger,
171
- workflow: workflow
172
- }.compact
167
+ unless request_options.nil? || request_options&.additional_body_parameters.nil?
168
+ req.body = { **(request_options&.additional_body_parameters || {}) }.compact
169
+ end
173
170
  req.url "#{@request_client.get_url(request_options: request_options)}/automations/#{id}"
174
171
  end
175
- Ittybit::AutomationResponse.from_json(json_object: response.body)
172
+ Ittybit::ConfirmationResponse.from_json(json_object: response.body)
176
173
  end
177
174
 
178
- # Deletes an automation by its ID
175
+ # Updates an automation's `name`, `description`, `trigger`, `workflow`, or
176
+ # `status`. Only the specified fields will be updated.
179
177
  #
180
178
  # @param id [String]
179
+ # @param name [String]
180
+ # @param description [String]
181
+ # @param trigger [Hash] Request of type Ittybit::Automations::AutomationsUpdateRequestTrigger, as a Hash
182
+ # * :kind (String)
183
+ # * :event (String)
184
+ # @param workflow [Array<Hash>] Request of type Array<Ittybit::WorkflowTaskStep>, as a Hash
185
+ # * :kind (Ittybit::WorkflowTaskStepKind)
186
+ # * :ref (String)
187
+ # * :next_ (Array<Ittybit::WorkflowTaskStepNextItem>)
188
+ # @param status [Ittybit::Automations::AutomationsUpdateRequestStatus]
181
189
  # @param request_options [Ittybit::RequestOptions]
182
- # @return [Void]
190
+ # @return [Ittybit::AutomationResponse]
183
191
  # @example
184
192
  # api = Ittybit::Client.new(
185
193
  # base_url: "https://api.example.com",
186
194
  # environment: Ittybit::Environment::DEFAULT,
187
195
  # token: "YOUR_AUTH_TOKEN"
188
196
  # )
189
- # api.automations.delete(id: "id")
190
- def delete(id:, request_options: nil)
191
- @request_client.conn.delete do |req|
197
+ # api.automations.update(
198
+ # id: "id",
199
+ # name: "My Updated Automation",
200
+ # workflow: [{ kind: NSFW }, { kind: DESCRIPTION }, { kind: IMAGE, ref: "big_thumbnail" }, { kind: CONDITIONS, next_: [{ kind: "subtitle", ref: "subtitle" }] }],
201
+ # status: ACTIVE
202
+ # )
203
+ def update(id:, name: nil, description: nil, trigger: nil, workflow: nil, status: nil, request_options: nil)
204
+ response = @request_client.conn.patch do |req|
192
205
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
193
206
  req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
194
207
  req.headers["ACCEPT_VERSION"] = request_options.version unless request_options&.version.nil?
@@ -200,11 +213,17 @@ module Ittybit
200
213
  unless request_options.nil? || request_options&.additional_query_parameters.nil?
201
214
  req.params = { **(request_options&.additional_query_parameters || {}) }.compact
202
215
  end
203
- unless request_options.nil? || request_options&.additional_body_parameters.nil?
204
- req.body = { **(request_options&.additional_body_parameters || {}) }.compact
205
- end
216
+ req.body = {
217
+ **(request_options&.additional_body_parameters || {}),
218
+ name: name,
219
+ description: description,
220
+ trigger: trigger,
221
+ workflow: workflow,
222
+ status: status
223
+ }.compact
206
224
  req.url "#{@request_client.get_url(request_options: request_options)}/automations/#{id}"
207
225
  end
226
+ Ittybit::AutomationResponse.from_json(json_object: response.body)
208
227
  end
209
228
  end
210
229
 
@@ -218,8 +237,9 @@ module Ittybit
218
237
  @request_client = request_client
219
238
  end
220
239
 
221
- # Retrieves a list of all automations for the current project
240
+ # Retrieves a paginated list of all automations for the current project
222
241
  #
242
+ # @param limit [Integer]
223
243
  # @param request_options [Ittybit::RequestOptions]
224
244
  # @return [Ittybit::AutomationListResponse]
225
245
  # @example
@@ -229,7 +249,7 @@ module Ittybit
229
249
  # token: "YOUR_AUTH_TOKEN"
230
250
  # )
231
251
  # api.automations.list
232
- def list(request_options: nil)
252
+ def list(limit: nil, request_options: nil)
233
253
  Async do
234
254
  response = @request_client.conn.get do |req|
235
255
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -240,9 +260,7 @@ module Ittybit
240
260
  **@request_client.get_headers,
241
261
  **(request_options&.additional_headers || {})
242
262
  }.compact
243
- unless request_options.nil? || request_options&.additional_query_parameters.nil?
244
- req.params = { **(request_options&.additional_query_parameters || {}) }.compact
245
- end
263
+ req.params = { **(request_options&.additional_query_parameters || {}), "limit": limit }.compact
246
264
  unless request_options.nil? || request_options&.additional_body_parameters.nil?
247
265
  req.body = { **(request_options&.additional_body_parameters || {}) }.compact
248
266
  end
@@ -252,8 +270,18 @@ module Ittybit
252
270
  end
253
271
  end
254
272
 
255
- # Creates a new automation for the current project
273
+ # Creates a new automation.
256
274
  #
275
+ # @param name [String]
276
+ # @param description [String]
277
+ # @param trigger [Hash] Request of type Ittybit::Automations::AutomationsCreateRequestTrigger, as a Hash
278
+ # * :kind (String)
279
+ # * :event (String)
280
+ # @param workflow [Array<Hash>] Request of type Array<Ittybit::WorkflowTaskStep>, as a Hash
281
+ # * :kind (Ittybit::WorkflowTaskStepKind)
282
+ # * :ref (String)
283
+ # * :next_ (Array<Ittybit::WorkflowTaskStepNextItem>)
284
+ # @param status [Ittybit::Automations::AutomationsCreateRequestStatus]
257
285
  # @param request_options [Ittybit::RequestOptions]
258
286
  # @return [Ittybit::AutomationResponse]
259
287
  # @example
@@ -262,8 +290,14 @@ module Ittybit
262
290
  # environment: Ittybit::Environment::DEFAULT,
263
291
  # token: "YOUR_AUTH_TOKEN"
264
292
  # )
265
- # api.automations.create
266
- def create(request_options: nil)
293
+ # api.automations.create(
294
+ # name: "My Example Automation",
295
+ # description: "This workflow will run whenever new media is created.",
296
+ # trigger: { kind: "event", event: "media.created" },
297
+ # workflow: [{ kind: DESCRIPTION }, { kind: IMAGE, ref: "thumbnail" }, { kind: CONDITIONS, next_: [{ kind: "subtitle", ref: "subtitle" }] }],
298
+ # status: ACTIVE
299
+ # )
300
+ def create(trigger:, workflow:, name: nil, description: nil, status: nil, request_options: nil)
267
301
  Async do
268
302
  response = @request_client.conn.post do |req|
269
303
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -277,16 +311,21 @@ module Ittybit
277
311
  unless request_options.nil? || request_options&.additional_query_parameters.nil?
278
312
  req.params = { **(request_options&.additional_query_parameters || {}) }.compact
279
313
  end
280
- unless request_options.nil? || request_options&.additional_body_parameters.nil?
281
- req.body = { **(request_options&.additional_body_parameters || {}) }.compact
282
- end
314
+ req.body = {
315
+ **(request_options&.additional_body_parameters || {}),
316
+ name: name,
317
+ description: description,
318
+ trigger: trigger,
319
+ workflow: workflow,
320
+ status: status
321
+ }.compact
283
322
  req.url "#{@request_client.get_url(request_options: request_options)}/automations"
284
323
  end
285
324
  Ittybit::AutomationResponse.from_json(json_object: response.body)
286
325
  end
287
326
  end
288
327
 
289
- # Retrieves a specific automation by its ID
328
+ # Retrieve the automation object for a automation with the given ID.
290
329
  #
291
330
  # @param id [String]
292
331
  # @param request_options [Ittybit::RequestOptions]
@@ -321,44 +360,21 @@ module Ittybit
321
360
  end
322
361
  end
323
362
 
324
- # Updates an existing automation by its ID
363
+ # Permanently removes an automation from the system. This action cannot be undone.
325
364
  #
326
365
  # @param id [String]
327
- # @param name [String]
328
- # @param description [String]
329
- # @param trigger [Hash] Defines the trigger event and conditions. To clear/remove a trigger, provide
330
- # null. To update, provide the new trigger object.Request of type Ittybit::Automations::AutomationsUpdateRequestTrigger, as a Hash
331
- # * :event (String)
332
- # * :conditions (Array<Ittybit::Automations::AutomationsUpdateRequestTriggerConditionsItem>)
333
- # @param workflow [Array<Hash>] The updated sequence of tasks for the automation.Request of type Array<Ittybit::WorkflowTaskStep>, as a Hash
334
- # * :kind (Ittybit::WorkflowTaskStepKind)
335
- # * :ref (String)
336
- # * :format (String)
337
- # * :start (Float)
338
- # * :end_ (Float)
339
- # * :width (Integer)
340
- # * :height (Integer)
341
- # * :fit (String)
342
- # * :background (String)
343
- # * :quality (Integer)
344
- # * :next_ (Array<Object>)
345
366
  # @param request_options [Ittybit::RequestOptions]
346
- # @return [Ittybit::AutomationResponse]
367
+ # @return [Ittybit::ConfirmationResponse]
347
368
  # @example
348
369
  # api = Ittybit::Client.new(
349
370
  # base_url: "https://api.example.com",
350
371
  # environment: Ittybit::Environment::DEFAULT,
351
372
  # token: "YOUR_AUTH_TOKEN"
352
373
  # )
353
- # api.automations.update(
354
- # id: "id",
355
- # name: "Updated Transcoder Example",
356
- # trigger: { event: "upload.completed", conditions: [{ prop: "file.type", value: "image/*" }] },
357
- # workflow: [{ kind: IMAGE, format: "webp" }]
358
- # )
359
- def update(id:, name:, description: nil, trigger: nil, workflow: nil, request_options: nil)
374
+ # api.automations.delete(id: "id")
375
+ def delete(id:, request_options: nil)
360
376
  Async do
361
- response = @request_client.conn.put do |req|
377
+ response = @request_client.conn.delete do |req|
362
378
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
363
379
  req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
364
380
  req.headers["ACCEPT_VERSION"] = request_options.version unless request_options&.version.nil?
@@ -370,34 +386,46 @@ module Ittybit
370
386
  unless request_options.nil? || request_options&.additional_query_parameters.nil?
371
387
  req.params = { **(request_options&.additional_query_parameters || {}) }.compact
372
388
  end
373
- req.body = {
374
- **(request_options&.additional_body_parameters || {}),
375
- name: name,
376
- description: description,
377
- trigger: trigger,
378
- workflow: workflow
379
- }.compact
389
+ unless request_options.nil? || request_options&.additional_body_parameters.nil?
390
+ req.body = { **(request_options&.additional_body_parameters || {}) }.compact
391
+ end
380
392
  req.url "#{@request_client.get_url(request_options: request_options)}/automations/#{id}"
381
393
  end
382
- Ittybit::AutomationResponse.from_json(json_object: response.body)
394
+ Ittybit::ConfirmationResponse.from_json(json_object: response.body)
383
395
  end
384
396
  end
385
397
 
386
- # Deletes an automation by its ID
398
+ # Updates an automation's `name`, `description`, `trigger`, `workflow`, or
399
+ # `status`. Only the specified fields will be updated.
387
400
  #
388
401
  # @param id [String]
402
+ # @param name [String]
403
+ # @param description [String]
404
+ # @param trigger [Hash] Request of type Ittybit::Automations::AutomationsUpdateRequestTrigger, as a Hash
405
+ # * :kind (String)
406
+ # * :event (String)
407
+ # @param workflow [Array<Hash>] Request of type Array<Ittybit::WorkflowTaskStep>, as a Hash
408
+ # * :kind (Ittybit::WorkflowTaskStepKind)
409
+ # * :ref (String)
410
+ # * :next_ (Array<Ittybit::WorkflowTaskStepNextItem>)
411
+ # @param status [Ittybit::Automations::AutomationsUpdateRequestStatus]
389
412
  # @param request_options [Ittybit::RequestOptions]
390
- # @return [Void]
413
+ # @return [Ittybit::AutomationResponse]
391
414
  # @example
392
415
  # api = Ittybit::Client.new(
393
416
  # base_url: "https://api.example.com",
394
417
  # environment: Ittybit::Environment::DEFAULT,
395
418
  # token: "YOUR_AUTH_TOKEN"
396
419
  # )
397
- # api.automations.delete(id: "id")
398
- def delete(id:, request_options: nil)
420
+ # api.automations.update(
421
+ # id: "id",
422
+ # name: "My Updated Automation",
423
+ # workflow: [{ kind: NSFW }, { kind: DESCRIPTION }, { kind: IMAGE, ref: "big_thumbnail" }, { kind: CONDITIONS, next_: [{ kind: "subtitle", ref: "subtitle" }] }],
424
+ # status: ACTIVE
425
+ # )
426
+ def update(id:, name: nil, description: nil, trigger: nil, workflow: nil, status: nil, request_options: nil)
399
427
  Async do
400
- @request_client.conn.delete do |req|
428
+ response = @request_client.conn.patch do |req|
401
429
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
402
430
  req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
403
431
  req.headers["ACCEPT_VERSION"] = request_options.version unless request_options&.version.nil?
@@ -409,11 +437,17 @@ module Ittybit
409
437
  unless request_options.nil? || request_options&.additional_query_parameters.nil?
410
438
  req.params = { **(request_options&.additional_query_parameters || {}) }.compact
411
439
  end
412
- unless request_options.nil? || request_options&.additional_body_parameters.nil?
413
- req.body = { **(request_options&.additional_body_parameters || {}) }.compact
414
- end
440
+ req.body = {
441
+ **(request_options&.additional_body_parameters || {}),
442
+ name: name,
443
+ description: description,
444
+ trigger: trigger,
445
+ workflow: workflow,
446
+ status: status
447
+ }.compact
415
448
  req.url "#{@request_client.get_url(request_options: request_options)}/automations/#{id}"
416
449
  end
450
+ Ittybit::AutomationResponse.from_json(json_object: response.body)
417
451
  end
418
452
  end
419
453
  end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ittybit
4
+ class Automations
5
+ class AutomationsCreateRequestStatus
6
+ ACTIVE = "active"
7
+ PAUSED = "paused"
8
+ end
9
+ end
10
+ end
@@ -5,11 +5,11 @@ require "json"
5
5
 
6
6
  module Ittybit
7
7
  class Automations
8
- class AutomationsUpdateRequestTriggerConditionsItem
8
+ class AutomationsCreateRequestTrigger
9
9
  # @return [String]
10
- attr_reader :prop
10
+ attr_reader :kind
11
11
  # @return [String]
12
- attr_reader :value
12
+ attr_reader :event
13
13
  # @return [OpenStruct] Additional properties unmapped to the current class definition
14
14
  attr_reader :additional_properties
15
15
  # @return [Object]
@@ -18,36 +18,34 @@ module Ittybit
18
18
 
19
19
  OMIT = Object.new
20
20
 
21
- # @param prop [String]
22
- # @param value [String]
21
+ # @param kind [String]
22
+ # @param event [String]
23
23
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
24
- # @return [Ittybit::Automations::AutomationsUpdateRequestTriggerConditionsItem]
25
- def initialize(prop:, value:, additional_properties: nil)
26
- @prop = prop
27
- @value = value
24
+ # @return [Ittybit::Automations::AutomationsCreateRequestTrigger]
25
+ def initialize(kind:, event:, additional_properties: nil)
26
+ @kind = kind
27
+ @event = event
28
28
  @additional_properties = additional_properties
29
- @_field_set = { "prop": prop, "value": value }
29
+ @_field_set = { "kind": kind, "event": event }
30
30
  end
31
31
 
32
- # Deserialize a JSON object to an instance of
33
- # AutomationsUpdateRequestTriggerConditionsItem
32
+ # Deserialize a JSON object to an instance of AutomationsCreateRequestTrigger
34
33
  #
35
34
  # @param json_object [String]
36
- # @return [Ittybit::Automations::AutomationsUpdateRequestTriggerConditionsItem]
35
+ # @return [Ittybit::Automations::AutomationsCreateRequestTrigger]
37
36
  def self.from_json(json_object:)
38
37
  struct = JSON.parse(json_object, object_class: OpenStruct)
39
38
  parsed_json = JSON.parse(json_object)
40
- prop = parsed_json["prop"]
41
- value = parsed_json["value"]
39
+ kind = parsed_json["kind"]
40
+ event = parsed_json["event"]
42
41
  new(
43
- prop: prop,
44
- value: value,
42
+ kind: kind,
43
+ event: event,
45
44
  additional_properties: struct
46
45
  )
47
46
  end
48
47
 
49
- # Serialize an instance of AutomationsUpdateRequestTriggerConditionsItem to a JSON
50
- # object
48
+ # Serialize an instance of AutomationsCreateRequestTrigger to a JSON object
51
49
  #
52
50
  # @return [String]
53
51
  def to_json(*_args)
@@ -61,8 +59,8 @@ module Ittybit
61
59
  # @param obj [Object]
62
60
  # @return [Void]
63
61
  def self.validate_raw(obj:)
64
- obj.prop.is_a?(String) != false || raise("Passed value for field obj.prop is not the expected type, validation failed.")
65
- obj.value.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
62
+ obj.kind.is_a?(String) != false || raise("Passed value for field obj.kind is not the expected type, validation failed.")
63
+ obj.event.is_a?(String) != false || raise("Passed value for field obj.event is not the expected type, validation failed.")
66
64
  end
67
65
  end
68
66
  end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ittybit
4
+ class Automations
5
+ class AutomationsUpdateRequestStatus
6
+ ACTIVE = "active"
7
+ PAUSED = "paused"
8
+ end
9
+ end
10
+ end
@@ -1,18 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "automations_update_request_trigger_conditions_item"
4
3
  require "ostruct"
5
4
  require "json"
6
5
 
7
6
  module Ittybit
8
7
  class Automations
9
- # Defines the trigger event and conditions. To clear/remove a trigger, provide
10
- # null. To update, provide the new trigger object.
11
8
  class AutomationsUpdateRequestTrigger
12
- # @return [String] The event that triggers the automation
9
+ # @return [String]
10
+ attr_reader :kind
11
+ # @return [String]
13
12
  attr_reader :event
14
- # @return [Array<Ittybit::Automations::AutomationsUpdateRequestTriggerConditionsItem>] Conditions that must be met for the trigger to activate.
15
- attr_reader :conditions
16
13
  # @return [OpenStruct] Additional properties unmapped to the current class definition
17
14
  attr_reader :additional_properties
18
15
  # @return [Object]
@@ -21,17 +18,15 @@ module Ittybit
21
18
 
22
19
  OMIT = Object.new
23
20
 
24
- # @param event [String] The event that triggers the automation
25
- # @param conditions [Array<Ittybit::Automations::AutomationsUpdateRequestTriggerConditionsItem>] Conditions that must be met for the trigger to activate.
21
+ # @param kind [String]
22
+ # @param event [String]
26
23
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
27
24
  # @return [Ittybit::Automations::AutomationsUpdateRequestTrigger]
28
- def initialize(event: OMIT, conditions: OMIT, additional_properties: nil)
29
- @event = event if event != OMIT
30
- @conditions = conditions if conditions != OMIT
25
+ def initialize(kind:, event:, additional_properties: nil)
26
+ @kind = kind
27
+ @event = event
31
28
  @additional_properties = additional_properties
32
- @_field_set = { "event": event, "conditions": conditions }.reject do |_k, v|
33
- v == OMIT
34
- end
29
+ @_field_set = { "kind": kind, "event": event }
35
30
  end
36
31
 
37
32
  # Deserialize a JSON object to an instance of AutomationsUpdateRequestTrigger
@@ -41,14 +36,11 @@ module Ittybit
41
36
  def self.from_json(json_object:)
42
37
  struct = JSON.parse(json_object, object_class: OpenStruct)
43
38
  parsed_json = JSON.parse(json_object)
39
+ kind = parsed_json["kind"]
44
40
  event = parsed_json["event"]
45
- conditions = parsed_json["conditions"]&.map do |item|
46
- item = item.to_json
47
- Ittybit::Automations::AutomationsUpdateRequestTriggerConditionsItem.from_json(json_object: item)
48
- end
49
41
  new(
42
+ kind: kind,
50
43
  event: event,
51
- conditions: conditions,
52
44
  additional_properties: struct
53
45
  )
54
46
  end
@@ -67,8 +59,8 @@ module Ittybit
67
59
  # @param obj [Object]
68
60
  # @return [Void]
69
61
  def self.validate_raw(obj:)
70
- obj.event&.is_a?(String) != false || raise("Passed value for field obj.event is not the expected type, validation failed.")
71
- obj.conditions&.is_a?(Array) != false || raise("Passed value for field obj.conditions is not the expected type, validation failed.")
62
+ obj.kind.is_a?(String) != false || raise("Passed value for field obj.kind is not the expected type, validation failed.")
63
+ obj.event.is_a?(String) != false || raise("Passed value for field obj.event is not the expected type, validation failed.")
72
64
  end
73
65
  end
74
66
  end
@@ -48,7 +48,7 @@ module Ittybit
48
48
  Ittybit::MediaListResponse.from_json(json_object: response.body)
49
49
  end
50
50
 
51
- # Creates a new media item.
51
+ # Creates a new media item. See [Media Object](/docs/media) for more details.
52
52
  #
53
53
  # @param title [String]
54
54
  # @param alt [String]
@@ -246,7 +246,7 @@ module Ittybit
246
246
  end
247
247
  end
248
248
 
249
- # Creates a new media item.
249
+ # Creates a new media item. See [Media Object](/docs/media) for more details.
250
250
  #
251
251
  # @param title [String]
252
252
  # @param alt [String]