activitysmith 0.1.7 → 1.1.0

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 (24) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +337 -77
  3. data/generated/activitysmith_openapi/api/live_activities_api.rb +168 -6
  4. data/generated/activitysmith_openapi/models/activity_metric.rb +293 -0
  5. data/generated/activitysmith_openapi/models/content_state_end.rb +47 -4
  6. data/generated/activitysmith_openapi/models/content_state_start.rb +50 -7
  7. data/generated/activitysmith_openapi/models/content_state_update.rb +50 -7
  8. data/generated/activitysmith_openapi/models/live_activity_action.rb +323 -0
  9. data/generated/activitysmith_openapi/models/live_activity_action_type.rb +40 -0
  10. data/generated/activitysmith_openapi/models/live_activity_end_request.rb +13 -4
  11. data/generated/activitysmith_openapi/models/live_activity_start_request.rb +10 -1
  12. data/generated/activitysmith_openapi/models/live_activity_stream_delete_request.rb +233 -0
  13. data/generated/activitysmith_openapi/models/live_activity_stream_delete_response.rb +332 -0
  14. data/generated/activitysmith_openapi/models/live_activity_stream_put_response.rb +361 -0
  15. data/generated/activitysmith_openapi/models/live_activity_stream_request.rb +280 -0
  16. data/generated/activitysmith_openapi/models/live_activity_update_request.rb +13 -4
  17. data/generated/activitysmith_openapi/models/live_activity_webhook_method.rb +40 -0
  18. data/generated/activitysmith_openapi/models/not_found_error.rb +237 -0
  19. data/generated/activitysmith_openapi/models/stream_content_state.rb +538 -0
  20. data/generated/activitysmith_openapi/version.rb +1 -1
  21. data/generated/activitysmith_openapi.rb +10 -0
  22. data/lib/activitysmith/live_activities.rb +19 -0
  23. data/lib/activitysmith/version.rb +1 -1
  24. metadata +12 -2
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module OpenapiClient
17
- # Start payload requires title and type. For segmented_progress include number_of_steps and current_step. For progress include percentage or value with upper_limit. For segmented_progress, number_of_steps is not locked and can be changed in later update or end calls.
17
+ # Start payload requires title and type. For segmented_progress include number_of_steps and current_step. For progress include percentage or value with upper_limit. For metrics include a non-empty metrics array. Legacy counter/timer/countdown types also use current_step and number_of_steps. For segmented_progress, number_of_steps is not locked and can be changed in later update or end calls.
18
18
  class ContentStateStart
19
19
  attr_accessor :title
20
20
 
@@ -35,6 +35,9 @@ module OpenapiClient
35
35
  # Maximum progress value. Use with value for type=progress.
36
36
  attr_accessor :upper_limit
37
37
 
38
+ # Use for type=metrics.
39
+ attr_accessor :metrics
40
+
38
41
  attr_accessor :type
39
42
 
40
43
  # Optional. Accent color for the Live Activity. Defaults to blue.
@@ -43,6 +46,9 @@ module OpenapiClient
43
46
  # Optional. Overrides color for the current step. Only applies to type=segmented_progress.
44
47
  attr_accessor :step_color
45
48
 
49
+ # Optional. Colors for completed steps. When used with segmented_progress, the array length should match current_step.
50
+ attr_accessor :step_colors
51
+
46
52
  class EnumAttributeValidator
47
53
  attr_reader :datatype
48
54
  attr_reader :allowable_values
@@ -75,9 +81,11 @@ module OpenapiClient
75
81
  :'percentage' => :'percentage',
76
82
  :'value' => :'value',
77
83
  :'upper_limit' => :'upper_limit',
84
+ :'metrics' => :'metrics',
78
85
  :'type' => :'type',
79
86
  :'color' => :'color',
80
- :'step_color' => :'step_color'
87
+ :'step_color' => :'step_color',
88
+ :'step_colors' => :'step_colors'
81
89
  }
82
90
  end
83
91
 
@@ -96,9 +104,11 @@ module OpenapiClient
96
104
  :'percentage' => :'Float',
97
105
  :'value' => :'Float',
98
106
  :'upper_limit' => :'Float',
107
+ :'metrics' => :'Array<ActivityMetric>',
99
108
  :'type' => :'String',
100
109
  :'color' => :'String',
101
- :'step_color' => :'String'
110
+ :'step_color' => :'String',
111
+ :'step_colors' => :'Array<String>'
102
112
  }
103
113
  end
104
114
 
@@ -153,6 +163,12 @@ module OpenapiClient
153
163
  self.upper_limit = attributes[:'upper_limit']
154
164
  end
155
165
 
166
+ if attributes.key?(:'metrics')
167
+ if (value = attributes[:'metrics']).is_a?(Array)
168
+ self.metrics = value
169
+ end
170
+ end
171
+
156
172
  if attributes.key?(:'type')
157
173
  self.type = attributes[:'type']
158
174
  else
@@ -168,6 +184,12 @@ module OpenapiClient
168
184
  if attributes.key?(:'step_color')
169
185
  self.step_color = attributes[:'step_color']
170
186
  end
187
+
188
+ if attributes.key?(:'step_colors')
189
+ if (value = attributes[:'step_colors']).is_a?(Array)
190
+ self.step_colors = value
191
+ end
192
+ end
171
193
  end
172
194
 
173
195
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -195,6 +217,10 @@ module OpenapiClient
195
217
  invalid_properties.push('invalid value for "percentage", must be greater than or equal to 0.')
196
218
  end
197
219
 
220
+ if !@metrics.nil? && @metrics.length < 1
221
+ invalid_properties.push('invalid value for "metrics", number of items must be greater than or equal to 1.')
222
+ end
223
+
198
224
  if @type.nil?
199
225
  invalid_properties.push('invalid value for "type", type cannot be nil.')
200
226
  end
@@ -211,8 +237,9 @@ module OpenapiClient
211
237
  return false if !@current_step.nil? && @current_step < 1
212
238
  return false if !@percentage.nil? && @percentage > 100
213
239
  return false if !@percentage.nil? && @percentage < 0
240
+ return false if !@metrics.nil? && @metrics.length < 1
214
241
  return false if @type.nil?
215
- type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress"])
242
+ type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "counter", "timer", "countdown"])
216
243
  return false unless type_validator.valid?(@type)
217
244
  color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
218
245
  return false unless color_validator.valid?(@color)
@@ -267,10 +294,24 @@ module OpenapiClient
267
294
  @percentage = percentage
268
295
  end
269
296
 
297
+ # Custom attribute writer method with validation
298
+ # @param [Object] metrics Value to be assigned
299
+ def metrics=(metrics)
300
+ if metrics.nil?
301
+ fail ArgumentError, 'metrics cannot be nil'
302
+ end
303
+
304
+ if metrics.length < 1
305
+ fail ArgumentError, 'invalid value for "metrics", number of items must be greater than or equal to 1.'
306
+ end
307
+
308
+ @metrics = metrics
309
+ end
310
+
270
311
  # Custom attribute writer method checking allowed values (enum).
271
312
  # @param [Object] type Object to be assigned
272
313
  def type=(type)
273
- validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress"])
314
+ validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "counter", "timer", "countdown"])
274
315
  unless validator.valid?(type)
275
316
  fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
276
317
  end
@@ -309,9 +350,11 @@ module OpenapiClient
309
350
  percentage == o.percentage &&
310
351
  value == o.value &&
311
352
  upper_limit == o.upper_limit &&
353
+ metrics == o.metrics &&
312
354
  type == o.type &&
313
355
  color == o.color &&
314
- step_color == o.step_color
356
+ step_color == o.step_color &&
357
+ step_colors == o.step_colors
315
358
  end
316
359
 
317
360
  # @see the `==` method
@@ -323,7 +366,7 @@ module OpenapiClient
323
366
  # Calculates hash code according to all attributes.
324
367
  # @return [Integer] Hash code
325
368
  def hash
326
- [title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, type, color, step_color].hash
369
+ [title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, metrics, type, color, step_color, step_colors].hash
327
370
  end
328
371
 
329
372
  # Builds the object from hash
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module OpenapiClient
17
- # Update payload requires title. For segmented_progress include current_step and optionally number_of_steps. For progress include percentage or value with upper_limit. Type is optional when updating an existing activity. You can increase or decrease number_of_steps during updates.
17
+ # Update payload requires title. For segmented_progress include current_step and optionally number_of_steps. For progress include percentage or value with upper_limit. For metrics include a non-empty metrics array. Legacy counter/timer/countdown types also use current_step and number_of_steps. Type is optional when updating an existing activity. You can increase or decrease number_of_steps during updates.
18
18
  class ContentStateUpdate
19
19
  attr_accessor :title
20
20
 
@@ -35,6 +35,9 @@ module OpenapiClient
35
35
  # Maximum progress value. Use with value for type=progress.
36
36
  attr_accessor :upper_limit
37
37
 
38
+ # Use for type=metrics.
39
+ attr_accessor :metrics
40
+
38
41
  # Optional. When omitted, the API uses the existing Live Activity type.
39
42
  attr_accessor :type
40
43
 
@@ -44,6 +47,9 @@ module OpenapiClient
44
47
  # Optional. Overrides color for the current step. Only applies to type=segmented_progress.
45
48
  attr_accessor :step_color
46
49
 
50
+ # Optional. Colors for completed steps. When used with segmented_progress, the array length should match current_step.
51
+ attr_accessor :step_colors
52
+
47
53
  class EnumAttributeValidator
48
54
  attr_reader :datatype
49
55
  attr_reader :allowable_values
@@ -76,9 +82,11 @@ module OpenapiClient
76
82
  :'percentage' => :'percentage',
77
83
  :'value' => :'value',
78
84
  :'upper_limit' => :'upper_limit',
85
+ :'metrics' => :'metrics',
79
86
  :'type' => :'type',
80
87
  :'color' => :'color',
81
- :'step_color' => :'step_color'
88
+ :'step_color' => :'step_color',
89
+ :'step_colors' => :'step_colors'
82
90
  }
83
91
  end
84
92
 
@@ -97,9 +105,11 @@ module OpenapiClient
97
105
  :'percentage' => :'Float',
98
106
  :'value' => :'Float',
99
107
  :'upper_limit' => :'Float',
108
+ :'metrics' => :'Array<ActivityMetric>',
100
109
  :'type' => :'String',
101
110
  :'color' => :'String',
102
- :'step_color' => :'String'
111
+ :'step_color' => :'String',
112
+ :'step_colors' => :'Array<String>'
103
113
  }
104
114
  end
105
115
 
@@ -154,6 +164,12 @@ module OpenapiClient
154
164
  self.upper_limit = attributes[:'upper_limit']
155
165
  end
156
166
 
167
+ if attributes.key?(:'metrics')
168
+ if (value = attributes[:'metrics']).is_a?(Array)
169
+ self.metrics = value
170
+ end
171
+ end
172
+
157
173
  if attributes.key?(:'type')
158
174
  self.type = attributes[:'type']
159
175
  end
@@ -167,6 +183,12 @@ module OpenapiClient
167
183
  if attributes.key?(:'step_color')
168
184
  self.step_color = attributes[:'step_color']
169
185
  end
186
+
187
+ if attributes.key?(:'step_colors')
188
+ if (value = attributes[:'step_colors']).is_a?(Array)
189
+ self.step_colors = value
190
+ end
191
+ end
170
192
  end
171
193
 
172
194
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -194,6 +216,10 @@ module OpenapiClient
194
216
  invalid_properties.push('invalid value for "percentage", must be greater than or equal to 0.')
195
217
  end
196
218
 
219
+ if !@metrics.nil? && @metrics.length < 1
220
+ invalid_properties.push('invalid value for "metrics", number of items must be greater than or equal to 1.')
221
+ end
222
+
197
223
  invalid_properties
198
224
  end
199
225
 
@@ -206,7 +232,8 @@ module OpenapiClient
206
232
  return false if !@current_step.nil? && @current_step < 1
207
233
  return false if !@percentage.nil? && @percentage > 100
208
234
  return false if !@percentage.nil? && @percentage < 0
209
- type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress"])
235
+ return false if !@metrics.nil? && @metrics.length < 1
236
+ type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "counter", "timer", "countdown"])
210
237
  return false unless type_validator.valid?(@type)
211
238
  color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
212
239
  return false unless color_validator.valid?(@color)
@@ -261,10 +288,24 @@ module OpenapiClient
261
288
  @percentage = percentage
262
289
  end
263
290
 
291
+ # Custom attribute writer method with validation
292
+ # @param [Object] metrics Value to be assigned
293
+ def metrics=(metrics)
294
+ if metrics.nil?
295
+ fail ArgumentError, 'metrics cannot be nil'
296
+ end
297
+
298
+ if metrics.length < 1
299
+ fail ArgumentError, 'invalid value for "metrics", number of items must be greater than or equal to 1.'
300
+ end
301
+
302
+ @metrics = metrics
303
+ end
304
+
264
305
  # Custom attribute writer method checking allowed values (enum).
265
306
  # @param [Object] type Object to be assigned
266
307
  def type=(type)
267
- validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress"])
308
+ validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "counter", "timer", "countdown"])
268
309
  unless validator.valid?(type)
269
310
  fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
270
311
  end
@@ -303,9 +344,11 @@ module OpenapiClient
303
344
  percentage == o.percentage &&
304
345
  value == o.value &&
305
346
  upper_limit == o.upper_limit &&
347
+ metrics == o.metrics &&
306
348
  type == o.type &&
307
349
  color == o.color &&
308
- step_color == o.step_color
350
+ step_color == o.step_color &&
351
+ step_colors == o.step_colors
309
352
  end
310
353
 
311
354
  # @see the `==` method
@@ -317,7 +360,7 @@ module OpenapiClient
317
360
  # Calculates hash code according to all attributes.
318
361
  # @return [Integer] Hash code
319
362
  def hash
320
- [title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, type, color, step_color].hash
363
+ [title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, metrics, type, color, step_color, step_colors].hash
321
364
  end
322
365
 
323
366
  # Builds the object from hash
@@ -0,0 +1,323 @@
1
+ =begin
2
+ #ActivitySmith API
3
+
4
+ #Send push notifications and Live Activities to your own devices via a single API key.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.7.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpenapiClient
17
+ # Optional single action button shown in the Live Activity UI.
18
+ class LiveActivityAction
19
+ # Button title displayed in the Live Activity UI.
20
+ attr_accessor :title
21
+
22
+ attr_accessor :type
23
+
24
+ # HTTPS URL. For open_url it is opened in browser. For webhook it is called by ActivitySmith backend.
25
+ attr_accessor :url
26
+
27
+ # Webhook HTTP method. Used only when type=webhook.
28
+ attr_accessor :method
29
+
30
+ # Optional webhook payload body. Used only when type=webhook.
31
+ attr_accessor :body
32
+
33
+ class EnumAttributeValidator
34
+ attr_reader :datatype
35
+ attr_reader :allowable_values
36
+
37
+ def initialize(datatype, allowable_values)
38
+ @allowable_values = allowable_values.map do |value|
39
+ case datatype.to_s
40
+ when /Integer/i
41
+ value.to_i
42
+ when /Float/i
43
+ value.to_f
44
+ else
45
+ value
46
+ end
47
+ end
48
+ end
49
+
50
+ def valid?(value)
51
+ !value || allowable_values.include?(value)
52
+ end
53
+ end
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'title' => :'title',
59
+ :'type' => :'type',
60
+ :'url' => :'url',
61
+ :'method' => :'method',
62
+ :'body' => :'body'
63
+ }
64
+ end
65
+
66
+ # Returns all the JSON keys this model knows about
67
+ def self.acceptable_attributes
68
+ attribute_map.values
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.openapi_types
73
+ {
74
+ :'title' => :'String',
75
+ :'type' => :'LiveActivityActionType',
76
+ :'url' => :'String',
77
+ :'method' => :'LiveActivityWebhookMethod',
78
+ :'body' => :'Hash<String, Object>'
79
+ }
80
+ end
81
+
82
+ # List of attributes with nullable: true
83
+ def self.openapi_nullable
84
+ Set.new([
85
+ ])
86
+ end
87
+
88
+ # Initializes the object
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ def initialize(attributes = {})
91
+ if (!attributes.is_a?(Hash))
92
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::LiveActivityAction` initialize method"
93
+ end
94
+
95
+ # check to see if the attribute exists and convert string to symbol for hash key
96
+ attributes = attributes.each_with_object({}) { |(k, v), h|
97
+ if (!self.class.attribute_map.key?(k.to_sym))
98
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::LiveActivityAction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
99
+ end
100
+ h[k.to_sym] = v
101
+ }
102
+
103
+ if attributes.key?(:'title')
104
+ self.title = attributes[:'title']
105
+ else
106
+ self.title = nil
107
+ end
108
+
109
+ if attributes.key?(:'type')
110
+ self.type = attributes[:'type']
111
+ else
112
+ self.type = nil
113
+ end
114
+
115
+ if attributes.key?(:'url')
116
+ self.url = attributes[:'url']
117
+ else
118
+ self.url = nil
119
+ end
120
+
121
+ if attributes.key?(:'method')
122
+ self.method = attributes[:'method']
123
+ else
124
+ self.method = 'POST'
125
+ end
126
+
127
+ if attributes.key?(:'body')
128
+ if (value = attributes[:'body']).is_a?(Hash)
129
+ self.body = value
130
+ end
131
+ end
132
+ end
133
+
134
+ # Show invalid properties with the reasons. Usually used together with valid?
135
+ # @return Array for valid properties with the reasons
136
+ def list_invalid_properties
137
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
138
+ invalid_properties = Array.new
139
+ if @title.nil?
140
+ invalid_properties.push('invalid value for "title", title cannot be nil.')
141
+ end
142
+
143
+ if @type.nil?
144
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
145
+ end
146
+
147
+ if @url.nil?
148
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
149
+ end
150
+
151
+ pattern = Regexp.new(/^https:\/\//)
152
+ if @url !~ pattern
153
+ invalid_properties.push("invalid value for \"url\", must conform to the pattern #{pattern}.")
154
+ end
155
+
156
+ invalid_properties
157
+ end
158
+
159
+ # Check to see if the all the properties in the model are valid
160
+ # @return true if the model is valid
161
+ def valid?
162
+ warn '[DEPRECATED] the `valid?` method is obsolete'
163
+ return false if @title.nil?
164
+ return false if @type.nil?
165
+ return false if @url.nil?
166
+ return false if @url !~ Regexp.new(/^https:\/\//)
167
+ true
168
+ end
169
+
170
+ # Custom attribute writer method with validation
171
+ # @param [Object] url Value to be assigned
172
+ def url=(url)
173
+ if url.nil?
174
+ fail ArgumentError, 'url cannot be nil'
175
+ end
176
+
177
+ pattern = Regexp.new(/^https:\/\//)
178
+ if url !~ pattern
179
+ fail ArgumentError, "invalid value for \"url\", must conform to the pattern #{pattern}."
180
+ end
181
+
182
+ @url = url
183
+ end
184
+
185
+ # Checks equality by comparing each attribute.
186
+ # @param [Object] Object to be compared
187
+ def ==(o)
188
+ return true if self.equal?(o)
189
+ self.class == o.class &&
190
+ title == o.title &&
191
+ type == o.type &&
192
+ url == o.url &&
193
+ method == o.method &&
194
+ body == o.body
195
+ end
196
+
197
+ # @see the `==` method
198
+ # @param [Object] Object to be compared
199
+ def eql?(o)
200
+ self == o
201
+ end
202
+
203
+ # Calculates hash code according to all attributes.
204
+ # @return [Integer] Hash code
205
+ def hash
206
+ [title, type, url, method, body].hash
207
+ end
208
+
209
+ # Builds the object from hash
210
+ # @param [Hash] attributes Model attributes in the form of hash
211
+ # @return [Object] Returns the model itself
212
+ def self.build_from_hash(attributes)
213
+ return nil unless attributes.is_a?(Hash)
214
+ attributes = attributes.transform_keys(&:to_sym)
215
+ transformed_hash = {}
216
+ openapi_types.each_pair do |key, type|
217
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
218
+ transformed_hash["#{key}"] = nil
219
+ elsif type =~ /\AArray<(.*)>/i
220
+ # check to ensure the input is an array given that the attribute
221
+ # is documented as an array but the input is not
222
+ if attributes[attribute_map[key]].is_a?(Array)
223
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
224
+ end
225
+ elsif !attributes[attribute_map[key]].nil?
226
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
227
+ end
228
+ end
229
+ new(transformed_hash)
230
+ end
231
+
232
+ # Deserializes the data based on type
233
+ # @param string type Data type
234
+ # @param string value Value to be deserialized
235
+ # @return [Object] Deserialized data
236
+ def self._deserialize(type, value)
237
+ case type.to_sym
238
+ when :Time
239
+ Time.parse(value)
240
+ when :Date
241
+ Date.parse(value)
242
+ when :String
243
+ value.to_s
244
+ when :Integer
245
+ value.to_i
246
+ when :Float
247
+ value.to_f
248
+ when :Boolean
249
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
250
+ true
251
+ else
252
+ false
253
+ end
254
+ when :Object
255
+ # generic object (usually a Hash), return directly
256
+ value
257
+ when /\AArray<(?<inner_type>.+)>\z/
258
+ inner_type = Regexp.last_match[:inner_type]
259
+ value.map { |v| _deserialize(inner_type, v) }
260
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
261
+ k_type = Regexp.last_match[:k_type]
262
+ v_type = Regexp.last_match[:v_type]
263
+ {}.tap do |hash|
264
+ value.each do |k, v|
265
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
266
+ end
267
+ end
268
+ else # model
269
+ # models (e.g. Pet) or oneOf
270
+ klass = OpenapiClient.const_get(type)
271
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
272
+ end
273
+ end
274
+
275
+ # Returns the string representation of the object
276
+ # @return [String] String presentation of the object
277
+ def to_s
278
+ to_hash.to_s
279
+ end
280
+
281
+ # to_body is an alias to to_hash (backward compatibility)
282
+ # @return [Hash] Returns the object in the form of hash
283
+ def to_body
284
+ to_hash
285
+ end
286
+
287
+ # Returns the object in the form of hash
288
+ # @return [Hash] Returns the object in the form of hash
289
+ def to_hash
290
+ hash = {}
291
+ self.class.attribute_map.each_pair do |attr, param|
292
+ value = self.send(attr)
293
+ if value.nil?
294
+ is_nullable = self.class.openapi_nullable.include?(attr)
295
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
296
+ end
297
+
298
+ hash[param] = _to_hash(value)
299
+ end
300
+ hash
301
+ end
302
+
303
+ # Outputs non-array value in the form of hash
304
+ # For object, use to_hash. Otherwise, just return the value
305
+ # @param [Object] value Any valid value
306
+ # @return [Hash] Returns the value in the form of hash
307
+ def _to_hash(value)
308
+ if value.is_a?(Array)
309
+ value.compact.map { |v| _to_hash(v) }
310
+ elsif value.is_a?(Hash)
311
+ {}.tap do |hash|
312
+ value.each { |k, v| hash[k] = _to_hash(v) }
313
+ end
314
+ elsif value.respond_to? :to_hash
315
+ value.to_hash
316
+ else
317
+ value
318
+ end
319
+ end
320
+
321
+ end
322
+
323
+ end
@@ -0,0 +1,40 @@
1
+ =begin
2
+ #ActivitySmith API
3
+
4
+ #Send push notifications and Live Activities to your own devices via a single API key.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.7.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpenapiClient
17
+ class LiveActivityActionType
18
+ OPEN_URL = "open_url".freeze
19
+ WEBHOOK = "webhook".freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [OPEN_URL, WEBHOOK].freeze
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def self.build_from_hash(value)
29
+ new.build_from_hash(value)
30
+ end
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ return value if LiveActivityActionType.all_vars.include?(value)
37
+ raise "Invalid ENUM value #{value} for class #LiveActivityActionType"
38
+ end
39
+ end
40
+ end