activitysmith 1.3.1 → 1.4.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 +36 -1
- data/generated/activitysmith_openapi/api/live_activities_api.rb +6 -6
- data/generated/activitysmith_openapi/models/activity_metric.rb +2 -2
- data/generated/activitysmith_openapi/models/content_state_end.rb +58 -11
- data/generated/activitysmith_openapi/models/content_state_start.rb +58 -11
- data/generated/activitysmith_openapi/models/content_state_update.rb +58 -11
- data/generated/activitysmith_openapi/models/live_activity_alert_badge.rb +273 -0
- data/generated/activitysmith_openapi/models/live_activity_alert_icon.rb +274 -0
- data/generated/activitysmith_openapi/models/live_activity_color.rb +48 -0
- data/generated/activitysmith_openapi/models/stream_content_state.rb +58 -11
- data/generated/activitysmith_openapi.rb +3 -0
- data/lib/activitysmith/live_activities.rb +57 -10
- data/lib/activitysmith/version.rb +1 -1
- metadata +5 -2
|
@@ -14,7 +14,7 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
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
|
|
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, stats, and alert types.
|
|
18
18
|
class StreamContentState
|
|
19
19
|
attr_accessor :title
|
|
20
20
|
|
|
@@ -38,7 +38,7 @@ module OpenapiClient
|
|
|
38
38
|
# Required on the first PUT or whenever the stream cannot infer the current activity type.
|
|
39
39
|
attr_accessor :type
|
|
40
40
|
|
|
41
|
-
# Optional. Accent color for
|
|
41
|
+
# Optional. Accent color for progress, segmented_progress, and metrics Live Activities. For Alert Live Activities, this tints the action button when action is included.
|
|
42
42
|
attr_accessor :color
|
|
43
43
|
|
|
44
44
|
# Optional. Overrides color for the current step. Only applies to segmented_progress.
|
|
@@ -50,6 +50,15 @@ module OpenapiClient
|
|
|
50
50
|
# Use for metrics and stats activities.
|
|
51
51
|
attr_accessor :metrics
|
|
52
52
|
|
|
53
|
+
# Required for type=alert.
|
|
54
|
+
attr_accessor :message
|
|
55
|
+
|
|
56
|
+
# Optional SF Symbol icon for type=alert.
|
|
57
|
+
attr_accessor :icon
|
|
58
|
+
|
|
59
|
+
# Optional badge for type=alert.
|
|
60
|
+
attr_accessor :badge
|
|
61
|
+
|
|
53
62
|
# Optional. Seconds before the ended Live Activity is dismissed.
|
|
54
63
|
attr_accessor :auto_dismiss_seconds
|
|
55
64
|
|
|
@@ -93,6 +102,9 @@ module OpenapiClient
|
|
|
93
102
|
:'step_color' => :'step_color',
|
|
94
103
|
:'step_colors' => :'step_colors',
|
|
95
104
|
:'metrics' => :'metrics',
|
|
105
|
+
:'message' => :'message',
|
|
106
|
+
:'icon' => :'icon',
|
|
107
|
+
:'badge' => :'badge',
|
|
96
108
|
:'auto_dismiss_seconds' => :'auto_dismiss_seconds',
|
|
97
109
|
:'auto_dismiss_minutes' => :'auto_dismiss_minutes'
|
|
98
110
|
}
|
|
@@ -118,6 +130,9 @@ module OpenapiClient
|
|
|
118
130
|
:'step_color' => :'String',
|
|
119
131
|
:'step_colors' => :'Array<String>',
|
|
120
132
|
:'metrics' => :'Array<ActivityMetric>',
|
|
133
|
+
:'message' => :'String',
|
|
134
|
+
:'icon' => :'LiveActivityAlertIcon',
|
|
135
|
+
:'badge' => :'LiveActivityAlertBadge',
|
|
121
136
|
:'auto_dismiss_seconds' => :'Integer',
|
|
122
137
|
:'auto_dismiss_minutes' => :'Integer'
|
|
123
138
|
}
|
|
@@ -180,8 +195,6 @@ module OpenapiClient
|
|
|
180
195
|
|
|
181
196
|
if attributes.key?(:'color')
|
|
182
197
|
self.color = attributes[:'color']
|
|
183
|
-
else
|
|
184
|
-
self.color = 'blue'
|
|
185
198
|
end
|
|
186
199
|
|
|
187
200
|
if attributes.key?(:'step_color')
|
|
@@ -200,6 +213,18 @@ module OpenapiClient
|
|
|
200
213
|
end
|
|
201
214
|
end
|
|
202
215
|
|
|
216
|
+
if attributes.key?(:'message')
|
|
217
|
+
self.message = attributes[:'message']
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
if attributes.key?(:'icon')
|
|
221
|
+
self.icon = attributes[:'icon']
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
if attributes.key?(:'badge')
|
|
225
|
+
self.badge = attributes[:'badge']
|
|
226
|
+
end
|
|
227
|
+
|
|
203
228
|
if attributes.key?(:'auto_dismiss_seconds')
|
|
204
229
|
self.auto_dismiss_seconds = attributes[:'auto_dismiss_seconds']
|
|
205
230
|
end
|
|
@@ -242,6 +267,10 @@ module OpenapiClient
|
|
|
242
267
|
invalid_properties.push('invalid value for "metrics", number of items must be greater than or equal to 1.')
|
|
243
268
|
end
|
|
244
269
|
|
|
270
|
+
if !@message.nil? && @message.to_s.length < 1
|
|
271
|
+
invalid_properties.push('invalid value for "message", the character length must be great than or equal to 1.')
|
|
272
|
+
end
|
|
273
|
+
|
|
245
274
|
if !@auto_dismiss_seconds.nil? && @auto_dismiss_seconds < 0
|
|
246
275
|
invalid_properties.push('invalid value for "auto_dismiss_seconds", must be greater than or equal to 0.')
|
|
247
276
|
end
|
|
@@ -262,14 +291,15 @@ module OpenapiClient
|
|
|
262
291
|
return false if !@current_step.nil? && @current_step < 1
|
|
263
292
|
return false if !@percentage.nil? && @percentage > 100
|
|
264
293
|
return false if !@percentage.nil? && @percentage < 0
|
|
265
|
-
type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats"])
|
|
294
|
+
type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert"])
|
|
266
295
|
return false unless type_validator.valid?(@type)
|
|
267
|
-
color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
|
|
296
|
+
color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
|
|
268
297
|
return false unless color_validator.valid?(@color)
|
|
269
|
-
step_color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
|
|
298
|
+
step_color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
|
|
270
299
|
return false unless step_color_validator.valid?(@step_color)
|
|
271
300
|
return false if !@metrics.nil? && @metrics.length > 8
|
|
272
301
|
return false if !@metrics.nil? && @metrics.length < 1
|
|
302
|
+
return false if !@message.nil? && @message.to_s.length < 1
|
|
273
303
|
return false if !@auto_dismiss_seconds.nil? && @auto_dismiss_seconds < 0
|
|
274
304
|
return false if !@auto_dismiss_minutes.nil? && @auto_dismiss_minutes < 0
|
|
275
305
|
true
|
|
@@ -324,7 +354,7 @@ module OpenapiClient
|
|
|
324
354
|
# Custom attribute writer method checking allowed values (enum).
|
|
325
355
|
# @param [Object] type Object to be assigned
|
|
326
356
|
def type=(type)
|
|
327
|
-
validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats"])
|
|
357
|
+
validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert"])
|
|
328
358
|
unless validator.valid?(type)
|
|
329
359
|
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
|
330
360
|
end
|
|
@@ -334,7 +364,7 @@ module OpenapiClient
|
|
|
334
364
|
# Custom attribute writer method checking allowed values (enum).
|
|
335
365
|
# @param [Object] color Object to be assigned
|
|
336
366
|
def color=(color)
|
|
337
|
-
validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
|
|
367
|
+
validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
|
|
338
368
|
unless validator.valid?(color)
|
|
339
369
|
fail ArgumentError, "invalid value for \"color\", must be one of #{validator.allowable_values}."
|
|
340
370
|
end
|
|
@@ -344,7 +374,7 @@ module OpenapiClient
|
|
|
344
374
|
# Custom attribute writer method checking allowed values (enum).
|
|
345
375
|
# @param [Object] step_color Object to be assigned
|
|
346
376
|
def step_color=(step_color)
|
|
347
|
-
validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
|
|
377
|
+
validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
|
|
348
378
|
unless validator.valid?(step_color)
|
|
349
379
|
fail ArgumentError, "invalid value for \"step_color\", must be one of #{validator.allowable_values}."
|
|
350
380
|
end
|
|
@@ -369,6 +399,20 @@ module OpenapiClient
|
|
|
369
399
|
@metrics = metrics
|
|
370
400
|
end
|
|
371
401
|
|
|
402
|
+
# Custom attribute writer method with validation
|
|
403
|
+
# @param [Object] message Value to be assigned
|
|
404
|
+
def message=(message)
|
|
405
|
+
if message.nil?
|
|
406
|
+
fail ArgumentError, 'message cannot be nil'
|
|
407
|
+
end
|
|
408
|
+
|
|
409
|
+
if message.to_s.length < 1
|
|
410
|
+
fail ArgumentError, 'invalid value for "message", the character length must be great than or equal to 1.'
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
@message = message
|
|
414
|
+
end
|
|
415
|
+
|
|
372
416
|
# Custom attribute writer method with validation
|
|
373
417
|
# @param [Object] auto_dismiss_seconds Value to be assigned
|
|
374
418
|
def auto_dismiss_seconds=(auto_dismiss_seconds)
|
|
@@ -414,6 +458,9 @@ module OpenapiClient
|
|
|
414
458
|
step_color == o.step_color &&
|
|
415
459
|
step_colors == o.step_colors &&
|
|
416
460
|
metrics == o.metrics &&
|
|
461
|
+
message == o.message &&
|
|
462
|
+
icon == o.icon &&
|
|
463
|
+
badge == o.badge &&
|
|
417
464
|
auto_dismiss_seconds == o.auto_dismiss_seconds &&
|
|
418
465
|
auto_dismiss_minutes == o.auto_dismiss_minutes
|
|
419
466
|
end
|
|
@@ -427,7 +474,7 @@ module OpenapiClient
|
|
|
427
474
|
# Calculates hash code according to all attributes.
|
|
428
475
|
# @return [Integer] Hash code
|
|
429
476
|
def hash
|
|
430
|
-
[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
|
|
477
|
+
[title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, type, color, step_color, step_colors, metrics, message, icon, badge, auto_dismiss_seconds, auto_dismiss_minutes].hash
|
|
431
478
|
end
|
|
432
479
|
|
|
433
480
|
# Builds the object from hash
|
|
@@ -28,6 +28,9 @@ require 'activitysmith_openapi/models/content_state_update'
|
|
|
28
28
|
require 'activitysmith_openapi/models/forbidden_error'
|
|
29
29
|
require 'activitysmith_openapi/models/live_activity_action'
|
|
30
30
|
require 'activitysmith_openapi/models/live_activity_action_type'
|
|
31
|
+
require 'activitysmith_openapi/models/live_activity_alert_badge'
|
|
32
|
+
require 'activitysmith_openapi/models/live_activity_alert_icon'
|
|
33
|
+
require 'activitysmith_openapi/models/live_activity_color'
|
|
31
34
|
require 'activitysmith_openapi/models/live_activity_end_request'
|
|
32
35
|
require 'activitysmith_openapi/models/live_activity_end_response'
|
|
33
36
|
require 'activitysmith_openapi/models/live_activity_limit_error'
|
|
@@ -6,52 +6,92 @@ module ActivitySmith
|
|
|
6
6
|
TYPE_PROGRESS = "progress"
|
|
7
7
|
TYPE_METRICS = "metrics"
|
|
8
8
|
TYPE_STATS = "stats"
|
|
9
|
+
TYPE_ALERT = "alert"
|
|
10
|
+
|
|
11
|
+
class << self
|
|
12
|
+
def content_state(title:, type: nil, subtitle: nil, message: nil, icon: nil, badge: nil, color: nil, **fields)
|
|
13
|
+
{
|
|
14
|
+
title: title,
|
|
15
|
+
type: type,
|
|
16
|
+
subtitle: subtitle,
|
|
17
|
+
message: message,
|
|
18
|
+
icon: icon,
|
|
19
|
+
badge: badge,
|
|
20
|
+
color: color
|
|
21
|
+
}.merge(fields).compact
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def alert_icon(symbol, color: nil)
|
|
25
|
+
{ symbol: symbol, color: color }.compact
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def alert_badge(title, color: nil)
|
|
29
|
+
{ title: title, color: color }.compact
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
|
9
33
|
|
|
10
34
|
def initialize(api)
|
|
11
35
|
@api = api
|
|
12
36
|
end
|
|
13
37
|
|
|
14
38
|
def start(request, opts = {})
|
|
15
|
-
@api.start_live_activity(normalize_channels_target(request), opts)
|
|
39
|
+
@api.start_live_activity(normalize_live_activity_request(normalize_channels_target(request)), opts)
|
|
16
40
|
end
|
|
17
41
|
|
|
18
42
|
def update(request, opts = {})
|
|
19
|
-
@api.update_live_activity(request, opts)
|
|
43
|
+
@api.update_live_activity(normalize_live_activity_request(request), opts)
|
|
20
44
|
end
|
|
21
45
|
|
|
22
46
|
def end(request, opts = {})
|
|
23
|
-
@api.end_live_activity(request, opts)
|
|
47
|
+
@api.end_live_activity(normalize_live_activity_request(request), opts)
|
|
24
48
|
end
|
|
25
49
|
|
|
26
50
|
def stream(stream_key, request, opts = {})
|
|
27
|
-
@api.reconcile_live_activity_stream(
|
|
51
|
+
@api.reconcile_live_activity_stream(
|
|
52
|
+
stream_key,
|
|
53
|
+
normalize_live_activity_request(normalize_channels_target(request)),
|
|
54
|
+
opts
|
|
55
|
+
)
|
|
28
56
|
end
|
|
29
57
|
|
|
30
58
|
def end_stream(stream_key, request = nil, opts = {})
|
|
31
|
-
@api.end_live_activity_stream(
|
|
59
|
+
@api.end_live_activity_stream(
|
|
60
|
+
stream_key,
|
|
61
|
+
{ live_activity_stream_delete_request: normalize_live_activity_request(request) }.merge(opts)
|
|
62
|
+
)
|
|
32
63
|
end
|
|
33
64
|
|
|
34
65
|
# Backward-compatible aliases.
|
|
35
66
|
def start_live_activity(live_activity_start_request, opts = {})
|
|
36
|
-
@api.start_live_activity(
|
|
67
|
+
@api.start_live_activity(
|
|
68
|
+
normalize_live_activity_request(normalize_channels_target(live_activity_start_request)),
|
|
69
|
+
opts
|
|
70
|
+
)
|
|
37
71
|
end
|
|
38
72
|
|
|
39
73
|
def update_live_activity(live_activity_update_request, opts = {})
|
|
40
|
-
@api.update_live_activity(live_activity_update_request, opts)
|
|
74
|
+
@api.update_live_activity(normalize_live_activity_request(live_activity_update_request), opts)
|
|
41
75
|
end
|
|
42
76
|
|
|
43
77
|
def end_live_activity(live_activity_end_request, opts = {})
|
|
44
|
-
@api.end_live_activity(live_activity_end_request, opts)
|
|
78
|
+
@api.end_live_activity(normalize_live_activity_request(live_activity_end_request), opts)
|
|
45
79
|
end
|
|
46
80
|
|
|
47
81
|
def reconcile_live_activity_stream(stream_key, live_activity_stream_request, opts = {})
|
|
48
|
-
@api.reconcile_live_activity_stream(
|
|
82
|
+
@api.reconcile_live_activity_stream(
|
|
83
|
+
stream_key,
|
|
84
|
+
normalize_live_activity_request(normalize_channels_target(live_activity_stream_request)),
|
|
85
|
+
opts
|
|
86
|
+
)
|
|
49
87
|
end
|
|
50
88
|
|
|
51
89
|
def end_live_activity_stream(stream_key, live_activity_stream_delete_request = nil, opts = {})
|
|
52
90
|
@api.end_live_activity_stream(
|
|
53
91
|
stream_key,
|
|
54
|
-
{
|
|
92
|
+
{
|
|
93
|
+
live_activity_stream_delete_request: normalize_live_activity_request(live_activity_stream_delete_request)
|
|
94
|
+
}.merge(opts)
|
|
55
95
|
)
|
|
56
96
|
end
|
|
57
97
|
|
|
@@ -67,6 +107,13 @@ module ActivitySmith
|
|
|
67
107
|
|
|
68
108
|
private
|
|
69
109
|
|
|
110
|
+
def normalize_live_activity_request(request)
|
|
111
|
+
return request unless request.is_a?(Hash)
|
|
112
|
+
|
|
113
|
+
hash = request.dup
|
|
114
|
+
hash
|
|
115
|
+
end
|
|
116
|
+
|
|
70
117
|
def normalize_channels_target(request)
|
|
71
118
|
return request unless request.is_a?(Hash)
|
|
72
119
|
|
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: 1.
|
|
4
|
+
version: 1.4.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-05-
|
|
11
|
+
date: 2026-05-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: json
|
|
@@ -93,6 +93,9 @@ files:
|
|
|
93
93
|
- generated/activitysmith_openapi/models/forbidden_error.rb
|
|
94
94
|
- generated/activitysmith_openapi/models/live_activity_action.rb
|
|
95
95
|
- generated/activitysmith_openapi/models/live_activity_action_type.rb
|
|
96
|
+
- generated/activitysmith_openapi/models/live_activity_alert_badge.rb
|
|
97
|
+
- generated/activitysmith_openapi/models/live_activity_alert_icon.rb
|
|
98
|
+
- generated/activitysmith_openapi/models/live_activity_color.rb
|
|
96
99
|
- generated/activitysmith_openapi/models/live_activity_end_request.rb
|
|
97
100
|
- generated/activitysmith_openapi/models/live_activity_end_response.rb
|
|
98
101
|
- generated/activitysmith_openapi/models/live_activity_limit_error.rb
|