zyphr 0.1.39 → 0.1.41

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.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +35 -14
  3. data/docs/AddWorkflowStep201Response.md +20 -0
  4. data/docs/AddWorkflowStepRequest.md +30 -0
  5. data/docs/AuthRegistrationApi.md +1 -1
  6. data/docs/CreateWorkflow201Response.md +20 -0
  7. data/docs/CreateWorkflowRequest.md +26 -0
  8. data/docs/DeleteWorkflow200Response.md +20 -0
  9. data/docs/{TopicDeleteResponseData.md → DeleteWorkflow200ResponseData.md} +2 -2
  10. data/docs/DeleteWorkflowStep200Response.md +20 -0
  11. data/docs/DeleteWorkflowStep200ResponseData.md +22 -0
  12. data/docs/ListWorkflowExecutions200Response.md +20 -0
  13. data/docs/{SmsListResponseMeta.md → ListWorkflowExecutions200ResponseMeta.md} +2 -2
  14. data/docs/ListWorkflows200Response.md +20 -0
  15. data/docs/ListWorkflows200ResponseMeta.md +32 -0
  16. data/docs/ReorderWorkflowStepsRequest.md +18 -0
  17. data/docs/SignInWithGameCenterRequest.md +1 -1
  18. data/docs/SmsListResponse.md +1 -1
  19. data/docs/TopicDeleteResponse.md +1 -1
  20. data/docs/TriggerWorkflow202Response.md +20 -0
  21. data/docs/TriggerWorkflow202ResponseData.md +22 -0
  22. data/docs/TriggerWorkflowRequest.md +24 -0
  23. data/docs/UpdateWorkflowRequest.md +24 -0
  24. data/docs/UpdateWorkflowStatusRequest.md +18 -0
  25. data/docs/UpdateWorkflowStepRequest.md +20 -0
  26. data/docs/Workflow.md +42 -0
  27. data/docs/WorkflowStatus.md +15 -0
  28. data/docs/WorkflowStep.md +38 -0
  29. data/docs/WorkflowStepType.md +15 -0
  30. data/docs/WorkflowsApi.md +901 -0
  31. data/lib/zyphr/api/auth_registration_api.rb +2 -2
  32. data/lib/zyphr/api/workflows_api.rb +897 -0
  33. data/lib/zyphr/models/add_workflow_step201_response.rb +229 -0
  34. data/lib/zyphr/models/add_workflow_step_request.rb +384 -0
  35. data/lib/zyphr/models/create_workflow201_response.rb +229 -0
  36. data/lib/zyphr/models/create_workflow_request.rb +292 -0
  37. data/lib/zyphr/models/delete_workflow200_response.rb +229 -0
  38. data/lib/zyphr/models/{topic_delete_response_data.rb → delete_workflow200_response_data.rb} +3 -3
  39. data/lib/zyphr/models/delete_workflow_step200_response.rb +229 -0
  40. data/lib/zyphr/models/delete_workflow_step200_response_data.rb +238 -0
  41. data/lib/zyphr/models/list_workflow_executions200_response.rb +231 -0
  42. data/lib/zyphr/models/{sms_list_response_meta.rb → list_workflow_executions200_response_meta.rb} +3 -3
  43. data/lib/zyphr/models/list_workflows200_response.rb +231 -0
  44. data/lib/zyphr/models/list_workflows200_response_meta.rb +284 -0
  45. data/lib/zyphr/models/reorder_workflow_steps_request.rb +249 -0
  46. data/lib/zyphr/models/sign_in_with_game_center_request.rb +1 -1
  47. data/lib/zyphr/models/sms_list_response.rb +1 -1
  48. data/lib/zyphr/models/topic_delete_response.rb +1 -1
  49. data/lib/zyphr/models/trigger_workflow202_response.rb +229 -0
  50. data/lib/zyphr/models/trigger_workflow202_response_data.rb +240 -0
  51. data/lib/zyphr/models/trigger_workflow_request.rb +272 -0
  52. data/lib/zyphr/models/update_workflow_request.rb +269 -0
  53. data/lib/zyphr/models/{v1_muse_subjects_suggest_post_request.rb → update_workflow_status_request.rb} +19 -86
  54. data/lib/zyphr/models/update_workflow_step_request.rb +232 -0
  55. data/lib/zyphr/models/workflow.rb +514 -0
  56. data/lib/zyphr/models/workflow_status.rb +42 -0
  57. data/lib/zyphr/models/workflow_step.rb +505 -0
  58. data/lib/zyphr/models/workflow_step_type.rb +47 -0
  59. data/lib/zyphr.rb +24 -4
  60. data/spec/api/auth_registration_api_spec.rb +1 -1
  61. data/spec/api/workflows_api_spec.rb +192 -0
  62. data/spec/models/add_workflow_step201_response_spec.rb +42 -0
  63. data/spec/models/add_workflow_step_request_spec.rb +76 -0
  64. data/spec/models/create_workflow201_response_spec.rb +42 -0
  65. data/spec/models/{v1_muse_subjects_suggest_post_request_spec.rb → create_workflow_request_spec.rb} +16 -14
  66. data/spec/models/{topic_delete_response_data_spec.rb → delete_workflow200_response_data_spec.rb} +6 -6
  67. data/spec/models/delete_workflow200_response_spec.rb +42 -0
  68. data/spec/models/delete_workflow_step200_response_data_spec.rb +48 -0
  69. data/spec/models/delete_workflow_step200_response_spec.rb +42 -0
  70. data/spec/models/{sms_list_response_meta_spec.rb → list_workflow_executions200_response_meta_spec.rb} +6 -6
  71. data/spec/models/list_workflow_executions200_response_spec.rb +42 -0
  72. data/spec/models/list_workflows200_response_meta_spec.rb +78 -0
  73. data/spec/models/list_workflows200_response_spec.rb +42 -0
  74. data/spec/models/reorder_workflow_steps_request_spec.rb +36 -0
  75. data/spec/models/trigger_workflow202_response_data_spec.rb +48 -0
  76. data/spec/models/trigger_workflow202_response_spec.rb +42 -0
  77. data/spec/models/trigger_workflow_request_spec.rb +54 -0
  78. data/spec/models/update_workflow_request_spec.rb +54 -0
  79. data/spec/models/update_workflow_status_request_spec.rb +36 -0
  80. data/spec/models/update_workflow_step_request_spec.rb +42 -0
  81. data/spec/models/workflow_spec.rb +108 -0
  82. data/spec/models/workflow_status_spec.rb +30 -0
  83. data/spec/models/workflow_step_spec.rb +100 -0
  84. data/spec/models/workflow_step_type_spec.rb +30 -0
  85. data/zyphr.gemspec +1 -1
  86. metadata +97 -17
  87. data/docs/MuseApi.md +0 -681
  88. data/docs/V1MuseSubjectsSuggestPostRequest.md +0 -24
  89. data/lib/zyphr/api/muse_api.rb +0 -644
  90. data/spec/api/muse_api_spec.rb +0 -156
@@ -0,0 +1,514 @@
1
+ =begin
2
+ #Zyphr API
3
+
4
+ #Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Account Sending Status Every authenticated response carries the account's current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: support@zyphr.dev
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.12.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zyphr
17
+ class Workflow
18
+ attr_accessor :id
19
+
20
+ attr_accessor :account_id
21
+
22
+ # Unique workflow key within the project.
23
+ attr_accessor :key
24
+
25
+ attr_accessor :name
26
+
27
+ attr_accessor :description
28
+
29
+ attr_accessor :status
30
+
31
+ attr_accessor :is_critical
32
+
33
+ attr_accessor :trigger_schema
34
+
35
+ attr_accessor :tags
36
+
37
+ # Number of steps in the workflow (present in list responses).
38
+ attr_accessor :step_count
39
+
40
+ # Ordered workflow steps (present when fetching a single workflow).
41
+ attr_accessor :steps
42
+
43
+ attr_accessor :created_at
44
+
45
+ attr_accessor :updated_at
46
+
47
+ class EnumAttributeValidator
48
+ attr_reader :datatype
49
+ attr_reader :allowable_values
50
+
51
+ def initialize(datatype, allowable_values)
52
+ @allowable_values = allowable_values.map do |value|
53
+ case datatype.to_s
54
+ when /Integer/i
55
+ value.to_i
56
+ when /Float/i
57
+ value.to_f
58
+ else
59
+ value
60
+ end
61
+ end
62
+ end
63
+
64
+ def valid?(value)
65
+ !value || allowable_values.include?(value)
66
+ end
67
+ end
68
+
69
+ # Attribute mapping from ruby-style variable name to JSON key.
70
+ def self.attribute_map
71
+ {
72
+ :'id' => :'id',
73
+ :'account_id' => :'account_id',
74
+ :'key' => :'key',
75
+ :'name' => :'name',
76
+ :'description' => :'description',
77
+ :'status' => :'status',
78
+ :'is_critical' => :'is_critical',
79
+ :'trigger_schema' => :'trigger_schema',
80
+ :'tags' => :'tags',
81
+ :'step_count' => :'step_count',
82
+ :'steps' => :'steps',
83
+ :'created_at' => :'created_at',
84
+ :'updated_at' => :'updated_at'
85
+ }
86
+ end
87
+
88
+ # Returns attribute mapping this model knows about
89
+ def self.acceptable_attribute_map
90
+ attribute_map
91
+ end
92
+
93
+ # Returns all the JSON keys this model knows about
94
+ def self.acceptable_attributes
95
+ acceptable_attribute_map.values
96
+ end
97
+
98
+ # Attribute type mapping.
99
+ def self.openapi_types
100
+ {
101
+ :'id' => :'String',
102
+ :'account_id' => :'String',
103
+ :'key' => :'String',
104
+ :'name' => :'String',
105
+ :'description' => :'String',
106
+ :'status' => :'WorkflowStatus',
107
+ :'is_critical' => :'Boolean',
108
+ :'trigger_schema' => :'Hash<String, Object>',
109
+ :'tags' => :'Array<String>',
110
+ :'step_count' => :'Integer',
111
+ :'steps' => :'Array<WorkflowStep>',
112
+ :'created_at' => :'Time',
113
+ :'updated_at' => :'Time'
114
+ }
115
+ end
116
+
117
+ # List of attributes with nullable: true
118
+ def self.openapi_nullable
119
+ Set.new([
120
+ :'description',
121
+ :'trigger_schema',
122
+ ])
123
+ end
124
+
125
+ # Initializes the object
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ def initialize(attributes = {})
128
+ if (!attributes.is_a?(Hash))
129
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::Workflow` initialize method"
130
+ end
131
+
132
+ # check to see if the attribute exists and convert string to symbol for hash key
133
+ acceptable_attribute_map = self.class.acceptable_attribute_map
134
+ attributes = attributes.each_with_object({}) { |(k, v), h|
135
+ if (!acceptable_attribute_map.key?(k.to_sym))
136
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::Workflow`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
137
+ end
138
+ h[k.to_sym] = v
139
+ }
140
+
141
+ if attributes.key?(:'id')
142
+ self.id = attributes[:'id']
143
+ else
144
+ self.id = nil
145
+ end
146
+
147
+ if attributes.key?(:'account_id')
148
+ self.account_id = attributes[:'account_id']
149
+ else
150
+ self.account_id = nil
151
+ end
152
+
153
+ if attributes.key?(:'key')
154
+ self.key = attributes[:'key']
155
+ else
156
+ self.key = nil
157
+ end
158
+
159
+ if attributes.key?(:'name')
160
+ self.name = attributes[:'name']
161
+ else
162
+ self.name = nil
163
+ end
164
+
165
+ if attributes.key?(:'description')
166
+ self.description = attributes[:'description']
167
+ end
168
+
169
+ if attributes.key?(:'status')
170
+ self.status = attributes[:'status']
171
+ else
172
+ self.status = nil
173
+ end
174
+
175
+ if attributes.key?(:'is_critical')
176
+ self.is_critical = attributes[:'is_critical']
177
+ else
178
+ self.is_critical = nil
179
+ end
180
+
181
+ if attributes.key?(:'trigger_schema')
182
+ if (value = attributes[:'trigger_schema']).is_a?(Hash)
183
+ self.trigger_schema = value
184
+ end
185
+ end
186
+
187
+ if attributes.key?(:'tags')
188
+ if (value = attributes[:'tags']).is_a?(Array)
189
+ self.tags = value
190
+ end
191
+ else
192
+ self.tags = nil
193
+ end
194
+
195
+ if attributes.key?(:'step_count')
196
+ self.step_count = attributes[:'step_count']
197
+ end
198
+
199
+ if attributes.key?(:'steps')
200
+ if (value = attributes[:'steps']).is_a?(Array)
201
+ self.steps = value
202
+ end
203
+ end
204
+
205
+ if attributes.key?(:'created_at')
206
+ self.created_at = attributes[:'created_at']
207
+ else
208
+ self.created_at = nil
209
+ end
210
+
211
+ if attributes.key?(:'updated_at')
212
+ self.updated_at = attributes[:'updated_at']
213
+ else
214
+ self.updated_at = nil
215
+ end
216
+ end
217
+
218
+ # Show invalid properties with the reasons. Usually used together with valid?
219
+ # @return Array for valid properties with the reasons
220
+ def list_invalid_properties
221
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
222
+ invalid_properties = Array.new
223
+ if @id.nil?
224
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
225
+ end
226
+
227
+ if @account_id.nil?
228
+ invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
229
+ end
230
+
231
+ if @key.nil?
232
+ invalid_properties.push('invalid value for "key", key cannot be nil.')
233
+ end
234
+
235
+ if @name.nil?
236
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
237
+ end
238
+
239
+ if @status.nil?
240
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
241
+ end
242
+
243
+ if @is_critical.nil?
244
+ invalid_properties.push('invalid value for "is_critical", is_critical cannot be nil.')
245
+ end
246
+
247
+ if @tags.nil?
248
+ invalid_properties.push('invalid value for "tags", tags cannot be nil.')
249
+ end
250
+
251
+ if @created_at.nil?
252
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
253
+ end
254
+
255
+ if @updated_at.nil?
256
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
257
+ end
258
+
259
+ invalid_properties
260
+ end
261
+
262
+ # Check to see if the all the properties in the model are valid
263
+ # @return true if the model is valid
264
+ def valid?
265
+ warn '[DEPRECATED] the `valid?` method is obsolete'
266
+ return false if @id.nil?
267
+ return false if @account_id.nil?
268
+ return false if @key.nil?
269
+ return false if @name.nil?
270
+ return false if @status.nil?
271
+ return false if @is_critical.nil?
272
+ return false if @tags.nil?
273
+ return false if @created_at.nil?
274
+ return false if @updated_at.nil?
275
+ true
276
+ end
277
+
278
+ # Custom attribute writer method with validation
279
+ # @param [Object] id Value to be assigned
280
+ def id=(id)
281
+ if id.nil?
282
+ fail ArgumentError, 'id cannot be nil'
283
+ end
284
+
285
+ @id = id
286
+ end
287
+
288
+ # Custom attribute writer method with validation
289
+ # @param [Object] account_id Value to be assigned
290
+ def account_id=(account_id)
291
+ if account_id.nil?
292
+ fail ArgumentError, 'account_id cannot be nil'
293
+ end
294
+
295
+ @account_id = account_id
296
+ end
297
+
298
+ # Custom attribute writer method with validation
299
+ # @param [Object] key Value to be assigned
300
+ def key=(key)
301
+ if key.nil?
302
+ fail ArgumentError, 'key cannot be nil'
303
+ end
304
+
305
+ @key = key
306
+ end
307
+
308
+ # Custom attribute writer method with validation
309
+ # @param [Object] name Value to be assigned
310
+ def name=(name)
311
+ if name.nil?
312
+ fail ArgumentError, 'name cannot be nil'
313
+ end
314
+
315
+ @name = name
316
+ end
317
+
318
+ # Custom attribute writer method with validation
319
+ # @param [Object] status Value to be assigned
320
+ def status=(status)
321
+ if status.nil?
322
+ fail ArgumentError, 'status cannot be nil'
323
+ end
324
+
325
+ @status = status
326
+ end
327
+
328
+ # Custom attribute writer method with validation
329
+ # @param [Object] is_critical Value to be assigned
330
+ def is_critical=(is_critical)
331
+ if is_critical.nil?
332
+ fail ArgumentError, 'is_critical cannot be nil'
333
+ end
334
+
335
+ @is_critical = is_critical
336
+ end
337
+
338
+ # Custom attribute writer method with validation
339
+ # @param [Object] tags Value to be assigned
340
+ def tags=(tags)
341
+ if tags.nil?
342
+ fail ArgumentError, 'tags cannot be nil'
343
+ end
344
+
345
+ @tags = tags
346
+ end
347
+
348
+ # Custom attribute writer method with validation
349
+ # @param [Object] created_at Value to be assigned
350
+ def created_at=(created_at)
351
+ if created_at.nil?
352
+ fail ArgumentError, 'created_at cannot be nil'
353
+ end
354
+
355
+ @created_at = created_at
356
+ end
357
+
358
+ # Custom attribute writer method with validation
359
+ # @param [Object] updated_at Value to be assigned
360
+ def updated_at=(updated_at)
361
+ if updated_at.nil?
362
+ fail ArgumentError, 'updated_at cannot be nil'
363
+ end
364
+
365
+ @updated_at = updated_at
366
+ end
367
+
368
+ # Checks equality by comparing each attribute.
369
+ # @param [Object] Object to be compared
370
+ def ==(o)
371
+ return true if self.equal?(o)
372
+ self.class == o.class &&
373
+ id == o.id &&
374
+ account_id == o.account_id &&
375
+ key == o.key &&
376
+ name == o.name &&
377
+ description == o.description &&
378
+ status == o.status &&
379
+ is_critical == o.is_critical &&
380
+ trigger_schema == o.trigger_schema &&
381
+ tags == o.tags &&
382
+ step_count == o.step_count &&
383
+ steps == o.steps &&
384
+ created_at == o.created_at &&
385
+ updated_at == o.updated_at
386
+ end
387
+
388
+ # @see the `==` method
389
+ # @param [Object] Object to be compared
390
+ def eql?(o)
391
+ self == o
392
+ end
393
+
394
+ # Calculates hash code according to all attributes.
395
+ # @return [Integer] Hash code
396
+ def hash
397
+ [id, account_id, key, name, description, status, is_critical, trigger_schema, tags, step_count, steps, created_at, updated_at].hash
398
+ end
399
+
400
+ # Builds the object from hash
401
+ # @param [Hash] attributes Model attributes in the form of hash
402
+ # @return [Object] Returns the model itself
403
+ def self.build_from_hash(attributes)
404
+ return nil unless attributes.is_a?(Hash)
405
+ attributes = attributes.transform_keys(&:to_sym)
406
+ transformed_hash = {}
407
+ openapi_types.each_pair do |key, type|
408
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
409
+ transformed_hash["#{key}"] = nil
410
+ elsif type =~ /\AArray<(.*)>/i
411
+ # check to ensure the input is an array given that the attribute
412
+ # is documented as an array but the input is not
413
+ if attributes[attribute_map[key]].is_a?(Array)
414
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
415
+ end
416
+ elsif !attributes[attribute_map[key]].nil?
417
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
418
+ end
419
+ end
420
+ new(transformed_hash)
421
+ end
422
+
423
+ # Deserializes the data based on type
424
+ # @param string type Data type
425
+ # @param string value Value to be deserialized
426
+ # @return [Object] Deserialized data
427
+ def self._deserialize(type, value)
428
+ case type.to_sym
429
+ when :Time
430
+ Time.parse(value)
431
+ when :Date
432
+ Date.parse(value)
433
+ when :String
434
+ value.to_s
435
+ when :Integer
436
+ value.to_i
437
+ when :Float
438
+ value.to_f
439
+ when :Boolean
440
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
441
+ true
442
+ else
443
+ false
444
+ end
445
+ when :Object
446
+ # generic object (usually a Hash), return directly
447
+ value
448
+ when /\AArray<(?<inner_type>.+)>\z/
449
+ inner_type = Regexp.last_match[:inner_type]
450
+ value.map { |v| _deserialize(inner_type, v) }
451
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
452
+ k_type = Regexp.last_match[:k_type]
453
+ v_type = Regexp.last_match[:v_type]
454
+ {}.tap do |hash|
455
+ value.each do |k, v|
456
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
457
+ end
458
+ end
459
+ else # model
460
+ # models (e.g. Pet) or oneOf
461
+ klass = Zyphr.const_get(type)
462
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
463
+ end
464
+ end
465
+
466
+ # Returns the string representation of the object
467
+ # @return [String] String presentation of the object
468
+ def to_s
469
+ to_hash.to_s
470
+ end
471
+
472
+ # to_body is an alias to to_hash (backward compatibility)
473
+ # @return [Hash] Returns the object in the form of hash
474
+ def to_body
475
+ to_hash
476
+ end
477
+
478
+ # Returns the object in the form of hash
479
+ # @return [Hash] Returns the object in the form of hash
480
+ def to_hash
481
+ hash = {}
482
+ self.class.attribute_map.each_pair do |attr, param|
483
+ value = self.send(attr)
484
+ if value.nil?
485
+ is_nullable = self.class.openapi_nullable.include?(attr)
486
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
487
+ end
488
+
489
+ hash[param] = _to_hash(value)
490
+ end
491
+ hash
492
+ end
493
+
494
+ # Outputs non-array value in the form of hash
495
+ # For object, use to_hash. Otherwise, just return the value
496
+ # @param [Object] value Any valid value
497
+ # @return [Hash] Returns the value in the form of hash
498
+ def _to_hash(value)
499
+ if value.is_a?(Array)
500
+ value.compact.map { |v| _to_hash(v) }
501
+ elsif value.is_a?(Hash)
502
+ {}.tap do |hash|
503
+ value.each { |k, v| hash[k] = _to_hash(v) }
504
+ end
505
+ elsif value.respond_to? :to_hash
506
+ value.to_hash
507
+ else
508
+ value
509
+ end
510
+ end
511
+
512
+ end
513
+
514
+ end
@@ -0,0 +1,42 @@
1
+ =begin
2
+ #Zyphr API
3
+
4
+ #Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Account Sending Status Every authenticated response carries the account's current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: support@zyphr.dev
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.12.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zyphr
17
+ class WorkflowStatus
18
+ DRAFT = "draft".freeze
19
+ ACTIVE = "active".freeze
20
+ PAUSED = "paused".freeze
21
+ ARCHIVED = "archived".freeze
22
+
23
+ def self.all_vars
24
+ @all_vars ||= [DRAFT, ACTIVE, PAUSED, ARCHIVED].freeze
25
+ end
26
+
27
+ # Builds the enum from string
28
+ # @param [String] The enum value in the form of the string
29
+ # @return [String] The enum value
30
+ def self.build_from_hash(value)
31
+ new.build_from_hash(value)
32
+ end
33
+
34
+ # Builds the enum from string
35
+ # @param [String] The enum value in the form of the string
36
+ # @return [String] The enum value
37
+ def build_from_hash(value)
38
+ return value if WorkflowStatus.all_vars.include?(value)
39
+ raise "Invalid ENUM value #{value} for class #WorkflowStatus"
40
+ end
41
+ end
42
+ end