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.
- checksums.yaml +4 -4
- data/README.md +337 -77
- data/generated/activitysmith_openapi/api/live_activities_api.rb +168 -6
- data/generated/activitysmith_openapi/models/activity_metric.rb +293 -0
- data/generated/activitysmith_openapi/models/content_state_end.rb +47 -4
- data/generated/activitysmith_openapi/models/content_state_start.rb +50 -7
- data/generated/activitysmith_openapi/models/content_state_update.rb +50 -7
- data/generated/activitysmith_openapi/models/live_activity_action.rb +323 -0
- data/generated/activitysmith_openapi/models/live_activity_action_type.rb +40 -0
- data/generated/activitysmith_openapi/models/live_activity_end_request.rb +13 -4
- data/generated/activitysmith_openapi/models/live_activity_start_request.rb +10 -1
- data/generated/activitysmith_openapi/models/live_activity_stream_delete_request.rb +233 -0
- data/generated/activitysmith_openapi/models/live_activity_stream_delete_response.rb +332 -0
- data/generated/activitysmith_openapi/models/live_activity_stream_put_response.rb +361 -0
- data/generated/activitysmith_openapi/models/live_activity_stream_request.rb +280 -0
- data/generated/activitysmith_openapi/models/live_activity_update_request.rb +13 -4
- data/generated/activitysmith_openapi/models/live_activity_webhook_method.rb +40 -0
- data/generated/activitysmith_openapi/models/not_found_error.rb +237 -0
- data/generated/activitysmith_openapi/models/stream_content_state.rb +538 -0
- data/generated/activitysmith_openapi/version.rb +1 -1
- data/generated/activitysmith_openapi.rb +10 -0
- data/lib/activitysmith/live_activities.rb +19 -0
- data/lib/activitysmith/version.rb +1 -1
- metadata +12 -2
|
@@ -0,0 +1,538 @@
|
|
|
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
|
+
# Current state for a managed Live Activity stream. Include type on the first PUT, and whenever the stream may need to start a fresh activity. Supports segmented_progress, progress, metrics, and the legacy counter/timer/countdown step-based types.
|
|
18
|
+
class StreamContentState
|
|
19
|
+
attr_accessor :title
|
|
20
|
+
|
|
21
|
+
attr_accessor :subtitle
|
|
22
|
+
|
|
23
|
+
# Use for segmented_progress, counter, timer, and countdown.
|
|
24
|
+
attr_accessor :number_of_steps
|
|
25
|
+
|
|
26
|
+
# Use for segmented_progress, counter, timer, and countdown.
|
|
27
|
+
attr_accessor :current_step
|
|
28
|
+
|
|
29
|
+
# Use for progress. Takes precedence over value/upper_limit if both are provided.
|
|
30
|
+
attr_accessor :percentage
|
|
31
|
+
|
|
32
|
+
# Current progress value. Use with upper_limit for progress.
|
|
33
|
+
attr_accessor :value
|
|
34
|
+
|
|
35
|
+
# Maximum progress value. Use with value for progress.
|
|
36
|
+
attr_accessor :upper_limit
|
|
37
|
+
|
|
38
|
+
# Required on the first PUT or whenever the stream cannot infer the current activity type.
|
|
39
|
+
attr_accessor :type
|
|
40
|
+
|
|
41
|
+
# Optional. Accent color for the Live Activity. Defaults to blue.
|
|
42
|
+
attr_accessor :color
|
|
43
|
+
|
|
44
|
+
# Optional. Overrides color for the current step. Only applies to segmented_progress.
|
|
45
|
+
attr_accessor :step_color
|
|
46
|
+
|
|
47
|
+
# Optional. Colors for completed steps. When used with segmented_progress, the array length should match current_step.
|
|
48
|
+
attr_accessor :step_colors
|
|
49
|
+
|
|
50
|
+
# Use for metrics activities.
|
|
51
|
+
attr_accessor :metrics
|
|
52
|
+
|
|
53
|
+
# Optional. Seconds before the ended Live Activity is dismissed.
|
|
54
|
+
attr_accessor :auto_dismiss_seconds
|
|
55
|
+
|
|
56
|
+
# Optional. Minutes before the ended Live Activity is dismissed.
|
|
57
|
+
attr_accessor :auto_dismiss_minutes
|
|
58
|
+
|
|
59
|
+
class EnumAttributeValidator
|
|
60
|
+
attr_reader :datatype
|
|
61
|
+
attr_reader :allowable_values
|
|
62
|
+
|
|
63
|
+
def initialize(datatype, allowable_values)
|
|
64
|
+
@allowable_values = allowable_values.map do |value|
|
|
65
|
+
case datatype.to_s
|
|
66
|
+
when /Integer/i
|
|
67
|
+
value.to_i
|
|
68
|
+
when /Float/i
|
|
69
|
+
value.to_f
|
|
70
|
+
else
|
|
71
|
+
value
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def valid?(value)
|
|
77
|
+
!value || allowable_values.include?(value)
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
82
|
+
def self.attribute_map
|
|
83
|
+
{
|
|
84
|
+
:'title' => :'title',
|
|
85
|
+
:'subtitle' => :'subtitle',
|
|
86
|
+
:'number_of_steps' => :'number_of_steps',
|
|
87
|
+
:'current_step' => :'current_step',
|
|
88
|
+
:'percentage' => :'percentage',
|
|
89
|
+
:'value' => :'value',
|
|
90
|
+
:'upper_limit' => :'upper_limit',
|
|
91
|
+
:'type' => :'type',
|
|
92
|
+
:'color' => :'color',
|
|
93
|
+
:'step_color' => :'step_color',
|
|
94
|
+
:'step_colors' => :'step_colors',
|
|
95
|
+
:'metrics' => :'metrics',
|
|
96
|
+
:'auto_dismiss_seconds' => :'auto_dismiss_seconds',
|
|
97
|
+
:'auto_dismiss_minutes' => :'auto_dismiss_minutes'
|
|
98
|
+
}
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Returns all the JSON keys this model knows about
|
|
102
|
+
def self.acceptable_attributes
|
|
103
|
+
attribute_map.values
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Attribute type mapping.
|
|
107
|
+
def self.openapi_types
|
|
108
|
+
{
|
|
109
|
+
:'title' => :'String',
|
|
110
|
+
:'subtitle' => :'String',
|
|
111
|
+
:'number_of_steps' => :'Integer',
|
|
112
|
+
:'current_step' => :'Integer',
|
|
113
|
+
:'percentage' => :'Float',
|
|
114
|
+
:'value' => :'Float',
|
|
115
|
+
:'upper_limit' => :'Float',
|
|
116
|
+
:'type' => :'String',
|
|
117
|
+
:'color' => :'String',
|
|
118
|
+
:'step_color' => :'String',
|
|
119
|
+
:'step_colors' => :'Array<String>',
|
|
120
|
+
:'metrics' => :'Array<ActivityMetric>',
|
|
121
|
+
:'auto_dismiss_seconds' => :'Integer',
|
|
122
|
+
:'auto_dismiss_minutes' => :'Integer'
|
|
123
|
+
}
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# List of attributes with nullable: true
|
|
127
|
+
def self.openapi_nullable
|
|
128
|
+
Set.new([
|
|
129
|
+
])
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Initializes the object
|
|
133
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
134
|
+
def initialize(attributes = {})
|
|
135
|
+
if (!attributes.is_a?(Hash))
|
|
136
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::StreamContentState` initialize method"
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
140
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
141
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
142
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::StreamContentState`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
143
|
+
end
|
|
144
|
+
h[k.to_sym] = v
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if attributes.key?(:'title')
|
|
148
|
+
self.title = attributes[:'title']
|
|
149
|
+
else
|
|
150
|
+
self.title = nil
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
if attributes.key?(:'subtitle')
|
|
154
|
+
self.subtitle = attributes[:'subtitle']
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
if attributes.key?(:'number_of_steps')
|
|
158
|
+
self.number_of_steps = attributes[:'number_of_steps']
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
if attributes.key?(:'current_step')
|
|
162
|
+
self.current_step = attributes[:'current_step']
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
if attributes.key?(:'percentage')
|
|
166
|
+
self.percentage = attributes[:'percentage']
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
if attributes.key?(:'value')
|
|
170
|
+
self.value = attributes[:'value']
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
if attributes.key?(:'upper_limit')
|
|
174
|
+
self.upper_limit = attributes[:'upper_limit']
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
if attributes.key?(:'type')
|
|
178
|
+
self.type = attributes[:'type']
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
if attributes.key?(:'color')
|
|
182
|
+
self.color = attributes[:'color']
|
|
183
|
+
else
|
|
184
|
+
self.color = 'blue'
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
if attributes.key?(:'step_color')
|
|
188
|
+
self.step_color = attributes[:'step_color']
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
if attributes.key?(:'step_colors')
|
|
192
|
+
if (value = attributes[:'step_colors']).is_a?(Array)
|
|
193
|
+
self.step_colors = value
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
if attributes.key?(:'metrics')
|
|
198
|
+
if (value = attributes[:'metrics']).is_a?(Array)
|
|
199
|
+
self.metrics = value
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
if attributes.key?(:'auto_dismiss_seconds')
|
|
204
|
+
self.auto_dismiss_seconds = attributes[:'auto_dismiss_seconds']
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
if attributes.key?(:'auto_dismiss_minutes')
|
|
208
|
+
self.auto_dismiss_minutes = attributes[:'auto_dismiss_minutes']
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
213
|
+
# @return Array for valid properties with the reasons
|
|
214
|
+
def list_invalid_properties
|
|
215
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
216
|
+
invalid_properties = Array.new
|
|
217
|
+
if @title.nil?
|
|
218
|
+
invalid_properties.push('invalid value for "title", title cannot be nil.')
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
if !@number_of_steps.nil? && @number_of_steps < 1
|
|
222
|
+
invalid_properties.push('invalid value for "number_of_steps", must be greater than or equal to 1.')
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
if !@current_step.nil? && @current_step < 1
|
|
226
|
+
invalid_properties.push('invalid value for "current_step", must be greater than or equal to 1.')
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
if !@percentage.nil? && @percentage > 100
|
|
230
|
+
invalid_properties.push('invalid value for "percentage", must be smaller than or equal to 100.')
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
if !@percentage.nil? && @percentage < 0
|
|
234
|
+
invalid_properties.push('invalid value for "percentage", must be greater than or equal to 0.')
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
if !@metrics.nil? && @metrics.length < 1
|
|
238
|
+
invalid_properties.push('invalid value for "metrics", number of items must be greater than or equal to 1.')
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
if !@auto_dismiss_seconds.nil? && @auto_dismiss_seconds < 0
|
|
242
|
+
invalid_properties.push('invalid value for "auto_dismiss_seconds", must be greater than or equal to 0.')
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
if !@auto_dismiss_minutes.nil? && @auto_dismiss_minutes < 0
|
|
246
|
+
invalid_properties.push('invalid value for "auto_dismiss_minutes", must be greater than or equal to 0.')
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
invalid_properties
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
# Check to see if the all the properties in the model are valid
|
|
253
|
+
# @return true if the model is valid
|
|
254
|
+
def valid?
|
|
255
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
256
|
+
return false if @title.nil?
|
|
257
|
+
return false if !@number_of_steps.nil? && @number_of_steps < 1
|
|
258
|
+
return false if !@current_step.nil? && @current_step < 1
|
|
259
|
+
return false if !@percentage.nil? && @percentage > 100
|
|
260
|
+
return false if !@percentage.nil? && @percentage < 0
|
|
261
|
+
type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "counter", "timer", "countdown"])
|
|
262
|
+
return false unless type_validator.valid?(@type)
|
|
263
|
+
color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
|
|
264
|
+
return false unless color_validator.valid?(@color)
|
|
265
|
+
step_color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
|
|
266
|
+
return false unless step_color_validator.valid?(@step_color)
|
|
267
|
+
return false if !@metrics.nil? && @metrics.length < 1
|
|
268
|
+
return false if !@auto_dismiss_seconds.nil? && @auto_dismiss_seconds < 0
|
|
269
|
+
return false if !@auto_dismiss_minutes.nil? && @auto_dismiss_minutes < 0
|
|
270
|
+
true
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
# Custom attribute writer method with validation
|
|
274
|
+
# @param [Object] number_of_steps Value to be assigned
|
|
275
|
+
def number_of_steps=(number_of_steps)
|
|
276
|
+
if number_of_steps.nil?
|
|
277
|
+
fail ArgumentError, 'number_of_steps cannot be nil'
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
if number_of_steps < 1
|
|
281
|
+
fail ArgumentError, 'invalid value for "number_of_steps", must be greater than or equal to 1.'
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
@number_of_steps = number_of_steps
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
# Custom attribute writer method with validation
|
|
288
|
+
# @param [Object] current_step Value to be assigned
|
|
289
|
+
def current_step=(current_step)
|
|
290
|
+
if current_step.nil?
|
|
291
|
+
fail ArgumentError, 'current_step cannot be nil'
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
if current_step < 1
|
|
295
|
+
fail ArgumentError, 'invalid value for "current_step", must be greater than or equal to 1.'
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
@current_step = current_step
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
# Custom attribute writer method with validation
|
|
302
|
+
# @param [Object] percentage Value to be assigned
|
|
303
|
+
def percentage=(percentage)
|
|
304
|
+
if percentage.nil?
|
|
305
|
+
fail ArgumentError, 'percentage cannot be nil'
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
if percentage > 100
|
|
309
|
+
fail ArgumentError, 'invalid value for "percentage", must be smaller than or equal to 100.'
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
if percentage < 0
|
|
313
|
+
fail ArgumentError, 'invalid value for "percentage", must be greater than or equal to 0.'
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
@percentage = percentage
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
320
|
+
# @param [Object] type Object to be assigned
|
|
321
|
+
def type=(type)
|
|
322
|
+
validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "counter", "timer", "countdown"])
|
|
323
|
+
unless validator.valid?(type)
|
|
324
|
+
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
|
325
|
+
end
|
|
326
|
+
@type = type
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
330
|
+
# @param [Object] color Object to be assigned
|
|
331
|
+
def color=(color)
|
|
332
|
+
validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
|
|
333
|
+
unless validator.valid?(color)
|
|
334
|
+
fail ArgumentError, "invalid value for \"color\", must be one of #{validator.allowable_values}."
|
|
335
|
+
end
|
|
336
|
+
@color = color
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
340
|
+
# @param [Object] step_color Object to be assigned
|
|
341
|
+
def step_color=(step_color)
|
|
342
|
+
validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
|
|
343
|
+
unless validator.valid?(step_color)
|
|
344
|
+
fail ArgumentError, "invalid value for \"step_color\", must be one of #{validator.allowable_values}."
|
|
345
|
+
end
|
|
346
|
+
@step_color = step_color
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
# Custom attribute writer method with validation
|
|
350
|
+
# @param [Object] metrics Value to be assigned
|
|
351
|
+
def metrics=(metrics)
|
|
352
|
+
if metrics.nil?
|
|
353
|
+
fail ArgumentError, 'metrics cannot be nil'
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
if metrics.length < 1
|
|
357
|
+
fail ArgumentError, 'invalid value for "metrics", number of items must be greater than or equal to 1.'
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
@metrics = metrics
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
# Custom attribute writer method with validation
|
|
364
|
+
# @param [Object] auto_dismiss_seconds Value to be assigned
|
|
365
|
+
def auto_dismiss_seconds=(auto_dismiss_seconds)
|
|
366
|
+
if auto_dismiss_seconds.nil?
|
|
367
|
+
fail ArgumentError, 'auto_dismiss_seconds cannot be nil'
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
if auto_dismiss_seconds < 0
|
|
371
|
+
fail ArgumentError, 'invalid value for "auto_dismiss_seconds", must be greater than or equal to 0.'
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
@auto_dismiss_seconds = auto_dismiss_seconds
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
# Custom attribute writer method with validation
|
|
378
|
+
# @param [Object] auto_dismiss_minutes Value to be assigned
|
|
379
|
+
def auto_dismiss_minutes=(auto_dismiss_minutes)
|
|
380
|
+
if auto_dismiss_minutes.nil?
|
|
381
|
+
fail ArgumentError, 'auto_dismiss_minutes cannot be nil'
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
if auto_dismiss_minutes < 0
|
|
385
|
+
fail ArgumentError, 'invalid value for "auto_dismiss_minutes", must be greater than or equal to 0.'
|
|
386
|
+
end
|
|
387
|
+
|
|
388
|
+
@auto_dismiss_minutes = auto_dismiss_minutes
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
# Checks equality by comparing each attribute.
|
|
392
|
+
# @param [Object] Object to be compared
|
|
393
|
+
def ==(o)
|
|
394
|
+
return true if self.equal?(o)
|
|
395
|
+
self.class == o.class &&
|
|
396
|
+
title == o.title &&
|
|
397
|
+
subtitle == o.subtitle &&
|
|
398
|
+
number_of_steps == o.number_of_steps &&
|
|
399
|
+
current_step == o.current_step &&
|
|
400
|
+
percentage == o.percentage &&
|
|
401
|
+
value == o.value &&
|
|
402
|
+
upper_limit == o.upper_limit &&
|
|
403
|
+
type == o.type &&
|
|
404
|
+
color == o.color &&
|
|
405
|
+
step_color == o.step_color &&
|
|
406
|
+
step_colors == o.step_colors &&
|
|
407
|
+
metrics == o.metrics &&
|
|
408
|
+
auto_dismiss_seconds == o.auto_dismiss_seconds &&
|
|
409
|
+
auto_dismiss_minutes == o.auto_dismiss_minutes
|
|
410
|
+
end
|
|
411
|
+
|
|
412
|
+
# @see the `==` method
|
|
413
|
+
# @param [Object] Object to be compared
|
|
414
|
+
def eql?(o)
|
|
415
|
+
self == o
|
|
416
|
+
end
|
|
417
|
+
|
|
418
|
+
# Calculates hash code according to all attributes.
|
|
419
|
+
# @return [Integer] Hash code
|
|
420
|
+
def hash
|
|
421
|
+
[title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, type, color, step_color, step_colors, metrics, auto_dismiss_seconds, auto_dismiss_minutes].hash
|
|
422
|
+
end
|
|
423
|
+
|
|
424
|
+
# Builds the object from hash
|
|
425
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
426
|
+
# @return [Object] Returns the model itself
|
|
427
|
+
def self.build_from_hash(attributes)
|
|
428
|
+
return nil unless attributes.is_a?(Hash)
|
|
429
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
430
|
+
transformed_hash = {}
|
|
431
|
+
openapi_types.each_pair do |key, type|
|
|
432
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
433
|
+
transformed_hash["#{key}"] = nil
|
|
434
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
435
|
+
# check to ensure the input is an array given that the attribute
|
|
436
|
+
# is documented as an array but the input is not
|
|
437
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
438
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
439
|
+
end
|
|
440
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
441
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
442
|
+
end
|
|
443
|
+
end
|
|
444
|
+
new(transformed_hash)
|
|
445
|
+
end
|
|
446
|
+
|
|
447
|
+
# Deserializes the data based on type
|
|
448
|
+
# @param string type Data type
|
|
449
|
+
# @param string value Value to be deserialized
|
|
450
|
+
# @return [Object] Deserialized data
|
|
451
|
+
def self._deserialize(type, value)
|
|
452
|
+
case type.to_sym
|
|
453
|
+
when :Time
|
|
454
|
+
Time.parse(value)
|
|
455
|
+
when :Date
|
|
456
|
+
Date.parse(value)
|
|
457
|
+
when :String
|
|
458
|
+
value.to_s
|
|
459
|
+
when :Integer
|
|
460
|
+
value.to_i
|
|
461
|
+
when :Float
|
|
462
|
+
value.to_f
|
|
463
|
+
when :Boolean
|
|
464
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
465
|
+
true
|
|
466
|
+
else
|
|
467
|
+
false
|
|
468
|
+
end
|
|
469
|
+
when :Object
|
|
470
|
+
# generic object (usually a Hash), return directly
|
|
471
|
+
value
|
|
472
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
473
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
474
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
475
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
476
|
+
k_type = Regexp.last_match[:k_type]
|
|
477
|
+
v_type = Regexp.last_match[:v_type]
|
|
478
|
+
{}.tap do |hash|
|
|
479
|
+
value.each do |k, v|
|
|
480
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
481
|
+
end
|
|
482
|
+
end
|
|
483
|
+
else # model
|
|
484
|
+
# models (e.g. Pet) or oneOf
|
|
485
|
+
klass = OpenapiClient.const_get(type)
|
|
486
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
487
|
+
end
|
|
488
|
+
end
|
|
489
|
+
|
|
490
|
+
# Returns the string representation of the object
|
|
491
|
+
# @return [String] String presentation of the object
|
|
492
|
+
def to_s
|
|
493
|
+
to_hash.to_s
|
|
494
|
+
end
|
|
495
|
+
|
|
496
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
497
|
+
# @return [Hash] Returns the object in the form of hash
|
|
498
|
+
def to_body
|
|
499
|
+
to_hash
|
|
500
|
+
end
|
|
501
|
+
|
|
502
|
+
# Returns the object in the form of hash
|
|
503
|
+
# @return [Hash] Returns the object in the form of hash
|
|
504
|
+
def to_hash
|
|
505
|
+
hash = {}
|
|
506
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
507
|
+
value = self.send(attr)
|
|
508
|
+
if value.nil?
|
|
509
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
510
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
511
|
+
end
|
|
512
|
+
|
|
513
|
+
hash[param] = _to_hash(value)
|
|
514
|
+
end
|
|
515
|
+
hash
|
|
516
|
+
end
|
|
517
|
+
|
|
518
|
+
# Outputs non-array value in the form of hash
|
|
519
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
520
|
+
# @param [Object] value Any valid value
|
|
521
|
+
# @return [Hash] Returns the value in the form of hash
|
|
522
|
+
def _to_hash(value)
|
|
523
|
+
if value.is_a?(Array)
|
|
524
|
+
value.compact.map { |v| _to_hash(v) }
|
|
525
|
+
elsif value.is_a?(Hash)
|
|
526
|
+
{}.tap do |hash|
|
|
527
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
528
|
+
end
|
|
529
|
+
elsif value.respond_to? :to_hash
|
|
530
|
+
value.to_hash
|
|
531
|
+
else
|
|
532
|
+
value
|
|
533
|
+
end
|
|
534
|
+
end
|
|
535
|
+
|
|
536
|
+
end
|
|
537
|
+
|
|
538
|
+
end
|
|
@@ -17,6 +17,7 @@ require 'activitysmith_openapi/version'
|
|
|
17
17
|
require 'activitysmith_openapi/configuration'
|
|
18
18
|
|
|
19
19
|
# Models
|
|
20
|
+
require 'activitysmith_openapi/models/activity_metric'
|
|
20
21
|
require 'activitysmith_openapi/models/alert_payload'
|
|
21
22
|
require 'activitysmith_openapi/models/bad_request_error'
|
|
22
23
|
require 'activitysmith_openapi/models/channel_target'
|
|
@@ -24,14 +25,22 @@ require 'activitysmith_openapi/models/content_state_end'
|
|
|
24
25
|
require 'activitysmith_openapi/models/content_state_start'
|
|
25
26
|
require 'activitysmith_openapi/models/content_state_update'
|
|
26
27
|
require 'activitysmith_openapi/models/forbidden_error'
|
|
28
|
+
require 'activitysmith_openapi/models/live_activity_action'
|
|
29
|
+
require 'activitysmith_openapi/models/live_activity_action_type'
|
|
27
30
|
require 'activitysmith_openapi/models/live_activity_end_request'
|
|
28
31
|
require 'activitysmith_openapi/models/live_activity_end_response'
|
|
29
32
|
require 'activitysmith_openapi/models/live_activity_limit_error'
|
|
30
33
|
require 'activitysmith_openapi/models/live_activity_start_request'
|
|
31
34
|
require 'activitysmith_openapi/models/live_activity_start_response'
|
|
35
|
+
require 'activitysmith_openapi/models/live_activity_stream_delete_request'
|
|
36
|
+
require 'activitysmith_openapi/models/live_activity_stream_delete_response'
|
|
37
|
+
require 'activitysmith_openapi/models/live_activity_stream_put_response'
|
|
38
|
+
require 'activitysmith_openapi/models/live_activity_stream_request'
|
|
32
39
|
require 'activitysmith_openapi/models/live_activity_update_request'
|
|
33
40
|
require 'activitysmith_openapi/models/live_activity_update_response'
|
|
41
|
+
require 'activitysmith_openapi/models/live_activity_webhook_method'
|
|
34
42
|
require 'activitysmith_openapi/models/no_recipients_error'
|
|
43
|
+
require 'activitysmith_openapi/models/not_found_error'
|
|
35
44
|
require 'activitysmith_openapi/models/push_notification_action'
|
|
36
45
|
require 'activitysmith_openapi/models/push_notification_action_type'
|
|
37
46
|
require 'activitysmith_openapi/models/push_notification_request'
|
|
@@ -39,6 +48,7 @@ require 'activitysmith_openapi/models/push_notification_response'
|
|
|
39
48
|
require 'activitysmith_openapi/models/push_notification_webhook_method'
|
|
40
49
|
require 'activitysmith_openapi/models/rate_limit_error'
|
|
41
50
|
require 'activitysmith_openapi/models/send_push_notification429_response'
|
|
51
|
+
require 'activitysmith_openapi/models/stream_content_state'
|
|
42
52
|
|
|
43
53
|
# APIs
|
|
44
54
|
require 'activitysmith_openapi/api/live_activities_api'
|
|
@@ -18,6 +18,14 @@ module ActivitySmith
|
|
|
18
18
|
@api.end_live_activity(request, opts)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
+
def stream(stream_key, request, opts = {})
|
|
22
|
+
@api.reconcile_live_activity_stream(stream_key, normalize_channels_target(request), opts)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def end_stream(stream_key, request = nil, opts = {})
|
|
26
|
+
@api.end_live_activity_stream(stream_key, { live_activity_stream_delete_request: request }.merge(opts))
|
|
27
|
+
end
|
|
28
|
+
|
|
21
29
|
# Backward-compatible aliases.
|
|
22
30
|
def start_live_activity(live_activity_start_request, opts = {})
|
|
23
31
|
@api.start_live_activity(normalize_channels_target(live_activity_start_request), opts)
|
|
@@ -31,6 +39,17 @@ module ActivitySmith
|
|
|
31
39
|
@api.end_live_activity(live_activity_end_request, opts)
|
|
32
40
|
end
|
|
33
41
|
|
|
42
|
+
def reconcile_live_activity_stream(stream_key, live_activity_stream_request, opts = {})
|
|
43
|
+
@api.reconcile_live_activity_stream(stream_key, normalize_channels_target(live_activity_stream_request), opts)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def end_live_activity_stream(stream_key, live_activity_stream_delete_request = nil, opts = {})
|
|
47
|
+
@api.end_live_activity_stream(
|
|
48
|
+
stream_key,
|
|
49
|
+
{ live_activity_stream_delete_request: live_activity_stream_delete_request }.merge(opts)
|
|
50
|
+
)
|
|
51
|
+
end
|
|
52
|
+
|
|
34
53
|
def method_missing(name, *args, &block)
|
|
35
54
|
return @api.public_send(name, *args, &block) if @api.respond_to?(name)
|
|
36
55
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activitysmith
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ActivitySmith
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-03-
|
|
11
|
+
date: 2026-03-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: json
|
|
@@ -81,6 +81,7 @@ files:
|
|
|
81
81
|
- generated/activitysmith_openapi/api_client.rb
|
|
82
82
|
- generated/activitysmith_openapi/api_error.rb
|
|
83
83
|
- generated/activitysmith_openapi/configuration.rb
|
|
84
|
+
- generated/activitysmith_openapi/models/activity_metric.rb
|
|
84
85
|
- generated/activitysmith_openapi/models/alert_payload.rb
|
|
85
86
|
- generated/activitysmith_openapi/models/bad_request_error.rb
|
|
86
87
|
- generated/activitysmith_openapi/models/channel_target.rb
|
|
@@ -88,14 +89,22 @@ files:
|
|
|
88
89
|
- generated/activitysmith_openapi/models/content_state_start.rb
|
|
89
90
|
- generated/activitysmith_openapi/models/content_state_update.rb
|
|
90
91
|
- generated/activitysmith_openapi/models/forbidden_error.rb
|
|
92
|
+
- generated/activitysmith_openapi/models/live_activity_action.rb
|
|
93
|
+
- generated/activitysmith_openapi/models/live_activity_action_type.rb
|
|
91
94
|
- generated/activitysmith_openapi/models/live_activity_end_request.rb
|
|
92
95
|
- generated/activitysmith_openapi/models/live_activity_end_response.rb
|
|
93
96
|
- generated/activitysmith_openapi/models/live_activity_limit_error.rb
|
|
94
97
|
- generated/activitysmith_openapi/models/live_activity_start_request.rb
|
|
95
98
|
- generated/activitysmith_openapi/models/live_activity_start_response.rb
|
|
99
|
+
- generated/activitysmith_openapi/models/live_activity_stream_delete_request.rb
|
|
100
|
+
- generated/activitysmith_openapi/models/live_activity_stream_delete_response.rb
|
|
101
|
+
- generated/activitysmith_openapi/models/live_activity_stream_put_response.rb
|
|
102
|
+
- generated/activitysmith_openapi/models/live_activity_stream_request.rb
|
|
96
103
|
- generated/activitysmith_openapi/models/live_activity_update_request.rb
|
|
97
104
|
- generated/activitysmith_openapi/models/live_activity_update_response.rb
|
|
105
|
+
- generated/activitysmith_openapi/models/live_activity_webhook_method.rb
|
|
98
106
|
- generated/activitysmith_openapi/models/no_recipients_error.rb
|
|
107
|
+
- generated/activitysmith_openapi/models/not_found_error.rb
|
|
99
108
|
- generated/activitysmith_openapi/models/push_notification_action.rb
|
|
100
109
|
- generated/activitysmith_openapi/models/push_notification_action_type.rb
|
|
101
110
|
- generated/activitysmith_openapi/models/push_notification_request.rb
|
|
@@ -103,6 +112,7 @@ files:
|
|
|
103
112
|
- generated/activitysmith_openapi/models/push_notification_webhook_method.rb
|
|
104
113
|
- generated/activitysmith_openapi/models/rate_limit_error.rb
|
|
105
114
|
- generated/activitysmith_openapi/models/send_push_notification429_response.rb
|
|
115
|
+
- generated/activitysmith_openapi/models/stream_content_state.rb
|
|
106
116
|
- generated/activitysmith_openapi/version.rb
|
|
107
117
|
- lib/activitysmith.rb
|
|
108
118
|
- lib/activitysmith/client.rb
|