activitysmith 1.4.0 → 1.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34f1236d70e7c0a571966c66fee6c6c336a4bb21c7dd139640e87c9221eee214
4
- data.tar.gz: dc381048f626f8bee8d38309f802665f1b500d5867d762cc03d1d33285e5b18e
3
+ metadata.gz: c57318695ada7f8c3d33082a4a60616ddbc0616919f66cd8d9f8bf752b393f4b
4
+ data.tar.gz: b16241c1481014632938a841c71c483dc2fa70a22ede37668e1851ae367732de
5
5
  SHA512:
6
- metadata.gz: 81ba38f68b643bd772b070cb1fe41a1508be65fee8a333dc2ab9612d3b1086862aa832523c2386b62c7704debf148df1a572ee8928e3c790c6c856dbf8c5a707
7
- data.tar.gz: 5e4ff4d86a8ab98de278ebf84e6356b66592b14086cc0bcc324c0d7c08b1f5144264d9f152f7efa9175b45f26991cc4993e7cb6ddd70cf883e1122aaf7263f50
6
+ metadata.gz: 2cb2947432a4e3b44523632d5b49443e8703c097365be08e087d69f3745457240d940f0eb9a91261b43a7a16d15cf31532bd03203e27bda0c79ea6ce5cec1379
7
+ data.tar.gz: 726fe1d3ecf9edaad5d428ea24ba0c41a5174cd2d51232605fe89343c2f750c5732e36c39b40a6e49b79a49da353229d2bfa0f3644fb2840180341dded57ae86
data/README.md CHANGED
@@ -18,6 +18,8 @@ See [API reference](https://activitysmith.com/docs/api-reference/introduction).
18
18
  - [Start & Update Live Activity](#start--update-live-activity)
19
19
  - [End Live Activity](#end-live-activity)
20
20
  - [Live Activity Action](#live-activity-action)
21
+ - [Icons and Badges](#icons-and-badges)
22
+ - [Live Activity Colors](#live-activity-colors)
21
23
  - [Channels](#channels)
22
24
  - [Widgets](#widgets)
23
25
 
@@ -264,14 +266,6 @@ activitysmith.live_activities.stream(
264
266
  )
265
267
  ```
266
268
 
267
- The `icon` symbol value is an Apple SF Symbol name. Browse the catalog with one of these tools:
268
-
269
- - [ActivitySmith app](https://apps.apple.com/us/app/activitysmith/id6752254835) - Open Settings -> SF Symbols to browse 45 hand-picked icons ready to use
270
- - [SF Symbols](https://developer.apple.com/sf-symbols/) - Apple's official macOS app
271
- - [Interactful](https://apps.apple.com/app/interactful/id1528095640) - free third-party iOS app listing all SF Symbols under Foundations -> Iconography
272
-
273
- `icon` and `badge` are optional. If you omit either one, that element is not shown in the Live Activity.
274
-
275
269
  ### End Live Activity
276
270
 
277
271
  Call `end_stream(...)` with the same `stream_key` to dismiss the Live Activity. You can include final values before it is removed. By default, iOS removes the Live Activity after two minutes. Set `auto_dismiss_minutes` to choose a different dismissal time, including `0` for immediate dismissal.
@@ -358,6 +352,79 @@ activitysmith.live_activities.stream(
358
352
  )
359
353
  ```
360
354
 
355
+ ### Icons and Badges
356
+
357
+ Add more context to Live Activities with icons and badges.
358
+
359
+ #### Icon
360
+
361
+ Supported Live Activity types: `stats`, `metrics`, `progress`, `segmented_progress`, and `alert`.
362
+
363
+ <p align="center">
364
+ <img
365
+ src="https://cdn.activitysmith.com/features/metrics-live-activity-with-icon.png"
366
+ alt="Metrics Live Activity with an SF Symbol icon on the iPhone Lock Screen"
367
+ width="680"
368
+ />
369
+ </p>
370
+
371
+ ```ruby
372
+ activitysmith.live_activities.stream(
373
+ "prod-web-1",
374
+ {
375
+ content_state: ActivitySmith::LiveActivities.content_state(
376
+ title: "Server Health",
377
+ subtitle: "prod-web-1",
378
+ type: "metrics",
379
+ icon: ActivitySmith::LiveActivities.alert_icon("server.rack", color: "blue"),
380
+ metrics: [
381
+ { label: "CPU", value: 18, unit: "%" },
382
+ { label: "MEM", value: 42, unit: "%" }
383
+ ]
384
+ )
385
+ }
386
+ )
387
+ ```
388
+
389
+ The `icon` symbol value is an Apple SF Symbol name. Browse the catalog with one of these tools:
390
+
391
+ - [ActivitySmith app](https://apps.apple.com/us/app/activitysmith/id6752254835) - Open Settings -> SF Symbols to browse 45 hand-picked icons ready to use
392
+ - [SF Symbols](https://developer.apple.com/sf-symbols/) - Apple's official macOS app
393
+ - [Interactful](https://apps.apple.com/app/interactful/id1528095640) - free third-party iOS app listing all SF Symbols under Foundations -> Iconography
394
+
395
+ #### Badge
396
+
397
+ Badges are supported by `alert`, `progress`, and `segmented_progress` Live Activities.
398
+
399
+ <p align="center">
400
+ <img
401
+ src="https://cdn.activitysmith.com/features/progress-live-activity-with-badge.png"
402
+ alt="Progress Live Activity with a badge on the iPhone Lock Screen"
403
+ width="680"
404
+ />
405
+ </p>
406
+
407
+ ```ruby
408
+ activitysmith.live_activities.stream(
409
+ "nightly-database-backup",
410
+ {
411
+ content_state: ActivitySmith::LiveActivities.content_state(
412
+ title: "Nightly Database Backup",
413
+ subtitle: "verify restore",
414
+ type: "progress",
415
+ badge: ActivitySmith::LiveActivities.alert_badge("S3", color: "cyan"),
416
+ percentage: 62
417
+ )
418
+ }
419
+ )
420
+ ```
421
+
422
+ ### Live Activity Colors
423
+
424
+ Choose from these colors for the Live Activity accent, including progress bars and action buttons, or apply them to an individual icon or badge:
425
+
426
+ `lime`, `green`, `cyan`, `blue`, `purple`, `magenta`, `red`, `orange`, `yellow`, `gray`
427
+
361
428
  ## Channels
362
429
 
363
430
  Channels are used to target specific team members or devices. Can be used for both push notifications and live activities.
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module OpenapiClient
17
- # End 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 and stats include a non-empty metrics array. For alert include message, with optional icon and badge. Type is optional when ending an existing activity. You can send an updated number_of_steps here if the workflow changed after start.
17
+ # End 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 and stats include a non-empty metrics array. For alert include message. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, and segmented_progress. Type is optional when ending an existing activity. You can send an updated number_of_steps here if the workflow changed after start.
18
18
  class ContentStateEnd
19
19
  attr_accessor :title
20
20
 
@@ -23,7 +23,7 @@ module OpenapiClient
23
23
  # Total number of steps. Use for type=segmented_progress. Optional on end, and safe to change if the final workflow used more or fewer steps than originally planned.
24
24
  attr_accessor :number_of_steps
25
25
 
26
- # Current step. Use for type=segmented_progress.
26
+ # Current completed step count. Use for type=segmented_progress. Must be less than or equal to number_of_steps when number_of_steps is provided.
27
27
  attr_accessor :current_step
28
28
 
29
29
  # Progress percentage (0–100). Use for type=progress. Takes precedence over value/upper_limit if both are provided.
@@ -41,10 +41,10 @@ module OpenapiClient
41
41
  # Alert message. Use for type=alert.
42
42
  attr_accessor :message
43
43
 
44
- # Optional SF Symbol icon for type=alert.
44
+ # Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, and stats.
45
45
  attr_accessor :icon
46
46
 
47
- # Optional badge for type=alert.
47
+ # Optional badge. Supported by alert, progress, and segmented_progress.
48
48
  attr_accessor :badge
49
49
 
50
50
  # Optional. When omitted, the API uses the existing Live Activity type.
@@ -240,8 +240,8 @@ module OpenapiClient
240
240
  invalid_properties.push('invalid value for "number_of_steps", must be greater than or equal to 1.')
241
241
  end
242
242
 
243
- if !@current_step.nil? && @current_step < 1
244
- invalid_properties.push('invalid value for "current_step", must be greater than or equal to 1.')
243
+ if !@current_step.nil? && @current_step < 0
244
+ invalid_properties.push('invalid value for "current_step", must be greater than or equal to 0.')
245
245
  end
246
246
 
247
247
  if !@percentage.nil? && @percentage > 100
@@ -277,7 +277,7 @@ module OpenapiClient
277
277
  warn '[DEPRECATED] the `valid?` method is obsolete'
278
278
  return false if @title.nil?
279
279
  return false if !@number_of_steps.nil? && @number_of_steps < 1
280
- return false if !@current_step.nil? && @current_step < 1
280
+ return false if !@current_step.nil? && @current_step < 0
281
281
  return false if !@percentage.nil? && @percentage > 100
282
282
  return false if !@percentage.nil? && @percentage < 0
283
283
  return false if !@metrics.nil? && @metrics.length > 8
@@ -314,8 +314,8 @@ module OpenapiClient
314
314
  fail ArgumentError, 'current_step cannot be nil'
315
315
  end
316
316
 
317
- if current_step < 1
318
- fail ArgumentError, 'invalid value for "current_step", must be greater than or equal to 1.'
317
+ if current_step < 0
318
+ fail ArgumentError, 'invalid value for "current_step", must be greater than or equal to 0.'
319
319
  end
320
320
 
321
321
  @current_step = current_step
@@ -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 metrics and stats include a non-empty metrics array. For alert include message, with optional icon and badge. 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 and stats include a non-empty metrics array. For alert include message. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, and segmented_progress. 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
 
@@ -23,7 +23,7 @@ module OpenapiClient
23
23
  # Total number of steps. Use for type=segmented_progress. This value can be increased or decreased later when updating or ending the same activity.
24
24
  attr_accessor :number_of_steps
25
25
 
26
- # Current step. Use for type=segmented_progress.
26
+ # Current completed step count. Use for type=segmented_progress. Set 0 when the activity has started but no segment is complete yet. Must be less than or equal to number_of_steps.
27
27
  attr_accessor :current_step
28
28
 
29
29
  # Progress percentage (0–100). Use for type=progress. Takes precedence over value/upper_limit if both are provided.
@@ -41,10 +41,10 @@ module OpenapiClient
41
41
  # Required for type=alert.
42
42
  attr_accessor :message
43
43
 
44
- # Optional SF Symbol icon for type=alert.
44
+ # Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, and stats.
45
45
  attr_accessor :icon
46
46
 
47
- # Optional badge for type=alert.
47
+ # Optional badge. Supported by alert, progress, and segmented_progress.
48
48
  attr_accessor :badge
49
49
 
50
50
  attr_accessor :type
@@ -230,8 +230,8 @@ module OpenapiClient
230
230
  invalid_properties.push('invalid value for "number_of_steps", must be greater than or equal to 1.')
231
231
  end
232
232
 
233
- if !@current_step.nil? && @current_step < 1
234
- invalid_properties.push('invalid value for "current_step", must be greater than or equal to 1.')
233
+ if !@current_step.nil? && @current_step < 0
234
+ invalid_properties.push('invalid value for "current_step", must be greater than or equal to 0.')
235
235
  end
236
236
 
237
237
  if !@percentage.nil? && @percentage > 100
@@ -267,7 +267,7 @@ module OpenapiClient
267
267
  warn '[DEPRECATED] the `valid?` method is obsolete'
268
268
  return false if @title.nil?
269
269
  return false if !@number_of_steps.nil? && @number_of_steps < 1
270
- return false if !@current_step.nil? && @current_step < 1
270
+ return false if !@current_step.nil? && @current_step < 0
271
271
  return false if !@percentage.nil? && @percentage > 100
272
272
  return false if !@percentage.nil? && @percentage < 0
273
273
  return false if !@metrics.nil? && @metrics.length > 8
@@ -304,8 +304,8 @@ module OpenapiClient
304
304
  fail ArgumentError, 'current_step cannot be nil'
305
305
  end
306
306
 
307
- if current_step < 1
308
- fail ArgumentError, 'invalid value for "current_step", must be greater than or equal to 1.'
307
+ if current_step < 0
308
+ fail ArgumentError, 'invalid value for "current_step", must be greater than or equal to 0.'
309
309
  end
310
310
 
311
311
  @current_step = current_step
@@ -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. For metrics and stats include a non-empty metrics array. For alert include message, with optional icon and badge. 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 and stats include a non-empty metrics array. For alert include message. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, and segmented_progress. 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
 
@@ -23,7 +23,7 @@ module OpenapiClient
23
23
  # Total number of steps. Use for type=segmented_progress. Optional on update, and safe to change if the workflow gains or loses steps.
24
24
  attr_accessor :number_of_steps
25
25
 
26
- # Current step. Use for type=segmented_progress.
26
+ # Current completed step count. Use for type=segmented_progress. Set 0 when no segment is complete yet. Must be less than or equal to number_of_steps when number_of_steps is provided.
27
27
  attr_accessor :current_step
28
28
 
29
29
  # Progress percentage (0–100). Use for type=progress. Takes precedence over value/upper_limit if both are provided.
@@ -41,10 +41,10 @@ module OpenapiClient
41
41
  # Alert message. Use for type=alert.
42
42
  attr_accessor :message
43
43
 
44
- # Optional SF Symbol icon for type=alert.
44
+ # Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, and stats.
45
45
  attr_accessor :icon
46
46
 
47
- # Optional badge for type=alert.
47
+ # Optional badge. Supported by alert, progress, and segmented_progress.
48
48
  attr_accessor :badge
49
49
 
50
50
  # Optional. When omitted, the API uses the existing Live Activity type.
@@ -229,8 +229,8 @@ module OpenapiClient
229
229
  invalid_properties.push('invalid value for "number_of_steps", must be greater than or equal to 1.')
230
230
  end
231
231
 
232
- if !@current_step.nil? && @current_step < 1
233
- invalid_properties.push('invalid value for "current_step", must be greater than or equal to 1.')
232
+ if !@current_step.nil? && @current_step < 0
233
+ invalid_properties.push('invalid value for "current_step", must be greater than or equal to 0.')
234
234
  end
235
235
 
236
236
  if !@percentage.nil? && @percentage > 100
@@ -262,7 +262,7 @@ module OpenapiClient
262
262
  warn '[DEPRECATED] the `valid?` method is obsolete'
263
263
  return false if @title.nil?
264
264
  return false if !@number_of_steps.nil? && @number_of_steps < 1
265
- return false if !@current_step.nil? && @current_step < 1
265
+ return false if !@current_step.nil? && @current_step < 0
266
266
  return false if !@percentage.nil? && @percentage > 100
267
267
  return false if !@percentage.nil? && @percentage < 0
268
268
  return false if !@metrics.nil? && @metrics.length > 8
@@ -298,8 +298,8 @@ module OpenapiClient
298
298
  fail ArgumentError, 'current_step cannot be nil'
299
299
  end
300
300
 
301
- if current_step < 1
302
- fail ArgumentError, 'invalid value for "current_step", must be greater than or equal to 1.'
301
+ if current_step < 0
302
+ fail ArgumentError, 'invalid value for "current_step", must be greater than or equal to 0.'
303
303
  end
304
304
 
305
305
  @current_step = current_step
@@ -21,7 +21,7 @@ module OpenapiClient
21
21
 
22
22
  attr_accessor :type
23
23
 
24
- # HTTPS URL. For open_url it is opened in browser. For webhook it is called by ActivitySmith backend.
24
+ # Action URL. For open_url, use an HTTPS or shortcuts:// URL. For webhook, use an HTTPS URL called by the ActivitySmith backend.
25
25
  attr_accessor :url
26
26
 
27
27
  # Webhook HTTP method. Used only when type=webhook.
@@ -30,28 +30,6 @@ module OpenapiClient
30
30
  # Optional webhook payload body. Used only when type=webhook.
31
31
  attr_accessor :body
32
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
33
  # Attribute mapping from ruby-style variable name to JSON key.
56
34
  def self.attribute_map
57
35
  {
@@ -117,6 +95,7 @@ module OpenapiClient
117
95
  else
118
96
  self.url = nil
119
97
  end
98
+ validate_action_url!
120
99
 
121
100
  if attributes.key?(:'method')
122
101
  self.method = attributes[:'method']
@@ -131,6 +110,16 @@ module OpenapiClient
131
110
  end
132
111
  end
133
112
 
113
+ def validate_action_url!
114
+ return if @url.nil? || @type.nil?
115
+ if @type == LiveActivityActionType::OPEN_URL && @url !~ /\A(https|shortcuts):\/\//
116
+ fail ArgumentError, 'invalid value for "url", open_url must use https or shortcuts.'
117
+ end
118
+ if @type == LiveActivityActionType::WEBHOOK && @url !~ /\Ahttps:\/\//
119
+ fail ArgumentError, 'invalid value for "url", webhook must use https.'
120
+ end
121
+ end
122
+
134
123
  # Show invalid properties with the reasons. Usually used together with valid?
135
124
  # @return Array for valid properties with the reasons
136
125
  def list_invalid_properties
@@ -147,10 +136,11 @@ module OpenapiClient
147
136
  if @url.nil?
148
137
  invalid_properties.push('invalid value for "url", url cannot be nil.')
149
138
  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}.")
139
+ if !@url.nil? && @type == LiveActivityActionType::OPEN_URL && @url !~ /\A(https|shortcuts):\/\//
140
+ invalid_properties.push('invalid value for "url", open_url must use https or shortcuts.')
141
+ end
142
+ if !@url.nil? && @type == LiveActivityActionType::WEBHOOK && @url !~ /\Ahttps:\/\//
143
+ invalid_properties.push('invalid value for "url", webhook must use https.')
154
144
  end
155
145
 
156
146
  invalid_properties
@@ -163,25 +153,11 @@ module OpenapiClient
163
153
  return false if @title.nil?
164
154
  return false if @type.nil?
165
155
  return false if @url.nil?
166
- return false if @url !~ Regexp.new(/^https:\/\//)
156
+ return false if !@url.nil? && @type == LiveActivityActionType::OPEN_URL && @url !~ /\A(https|shortcuts):\/\//
157
+ return false if !@url.nil? && @type == LiveActivityActionType::WEBHOOK && @url !~ /\Ahttps:\/\//
167
158
  true
168
159
  end
169
160
 
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
161
  # Checks equality by comparing each attribute.
186
162
  # @param [Object] Object to be compared
187
163
  def ==(o)
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module OpenapiClient
17
- # Optional badge for Alert Live Activities.
17
+ # Optional badge for Live Activities.
18
18
  class LiveActivityAlertBadge
19
19
  attr_accessor :title
20
20
 
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module OpenapiClient
17
- # Optional SF Symbol icon for Alert Live Activities.
17
+ # Optional SF Symbol icon for Live Activities.
18
18
  class LiveActivityAlertIcon
19
19
  # Apple SF Symbol name.
20
20
  attr_accessor :symbol
@@ -20,7 +20,7 @@ module OpenapiClient
20
20
 
21
21
  attr_accessor :type
22
22
 
23
- # HTTPS URL. For open_url it is opened in browser. For webhook it is called by ActivitySmith backend.
23
+ # Action URL. For open_url, use an HTTPS or shortcuts:// URL. For webhook, use an HTTPS URL called by the ActivitySmith backend.
24
24
  attr_accessor :url
25
25
 
26
26
  # Webhook HTTP method. Used only when type=webhook.
@@ -29,28 +29,6 @@ module OpenapiClient
29
29
  # Optional webhook payload body. Used only when type=webhook.
30
30
  attr_accessor :body
31
31
 
32
- class EnumAttributeValidator
33
- attr_reader :datatype
34
- attr_reader :allowable_values
35
-
36
- def initialize(datatype, allowable_values)
37
- @allowable_values = allowable_values.map do |value|
38
- case datatype.to_s
39
- when /Integer/i
40
- value.to_i
41
- when /Float/i
42
- value.to_f
43
- else
44
- value
45
- end
46
- end
47
- end
48
-
49
- def valid?(value)
50
- !value || allowable_values.include?(value)
51
- end
52
- end
53
-
54
32
  # Attribute mapping from ruby-style variable name to JSON key.
55
33
  def self.attribute_map
56
34
  {
@@ -116,6 +94,7 @@ module OpenapiClient
116
94
  else
117
95
  self.url = nil
118
96
  end
97
+ validate_action_url!
119
98
 
120
99
  if attributes.key?(:'method')
121
100
  self.method = attributes[:'method']
@@ -130,6 +109,16 @@ module OpenapiClient
130
109
  end
131
110
  end
132
111
 
112
+ def validate_action_url!
113
+ return if @url.nil? || @type.nil?
114
+ if @type == PushNotificationActionType::OPEN_URL && @url !~ /\A(https|shortcuts):\/\//
115
+ fail ArgumentError, 'invalid value for "url", open_url must use https or shortcuts.'
116
+ end
117
+ if @type == PushNotificationActionType::WEBHOOK && @url !~ /\Ahttps:\/\//
118
+ fail ArgumentError, 'invalid value for "url", webhook must use https.'
119
+ end
120
+ end
121
+
133
122
  # Show invalid properties with the reasons. Usually used together with valid?
134
123
  # @return Array for valid properties with the reasons
135
124
  def list_invalid_properties
@@ -146,10 +135,11 @@ module OpenapiClient
146
135
  if @url.nil?
147
136
  invalid_properties.push('invalid value for "url", url cannot be nil.')
148
137
  end
149
-
150
- pattern = Regexp.new(/^https:\/\//)
151
- if @url !~ pattern
152
- invalid_properties.push("invalid value for \"url\", must conform to the pattern #{pattern}.")
138
+ if !@url.nil? && @type == PushNotificationActionType::OPEN_URL && @url !~ /\A(https|shortcuts):\/\//
139
+ invalid_properties.push('invalid value for "url", open_url must use https or shortcuts.')
140
+ end
141
+ if !@url.nil? && @type == PushNotificationActionType::WEBHOOK && @url !~ /\Ahttps:\/\//
142
+ invalid_properties.push('invalid value for "url", webhook must use https.')
153
143
  end
154
144
 
155
145
  invalid_properties
@@ -162,25 +152,11 @@ module OpenapiClient
162
152
  return false if @title.nil?
163
153
  return false if @type.nil?
164
154
  return false if @url.nil?
165
- return false if @url !~ Regexp.new(/^https:\/\//)
155
+ return false if !@url.nil? && @type == PushNotificationActionType::OPEN_URL && @url !~ /\A(https|shortcuts):\/\//
156
+ return false if !@url.nil? && @type == PushNotificationActionType::WEBHOOK && @url !~ /\Ahttps:\/\//
166
157
  true
167
158
  end
168
159
 
169
- # Custom attribute writer method with validation
170
- # @param [Object] url Value to be assigned
171
- def url=(url)
172
- if url.nil?
173
- fail ArgumentError, 'url cannot be nil'
174
- end
175
-
176
- pattern = Regexp.new(/^https:\/\//)
177
- if url !~ pattern
178
- fail ArgumentError, "invalid value for \"url\", must conform to the pattern #{pattern}."
179
- end
180
-
181
- @url = url
182
- end
183
-
184
160
  # Checks equality by comparing each attribute.
185
161
  # @param [Object] Object to be compared
186
162
  def ==(o)
@@ -24,7 +24,7 @@ module OpenapiClient
24
24
  # Optional HTTPS URL for an image, audio file, or video that users can preview or play when they expand the notification. If `redirection` is omitted, tapping the notification opens this URL. Cannot be combined with `actions`.
25
25
  attr_accessor :media
26
26
 
27
- # Optional HTTPS URL opened when user taps the notification body. Overrides the default tap target from `media` when both are provided.
27
+ # Optional HTTPS or shortcuts:// URL opened when user taps the notification body. Overrides the default tap target from `media` when both are provided.
28
28
  attr_accessor :redirection
29
29
 
30
30
  # Optional interactive actions shown when users expand the notification. Cannot be combined with `media`.
@@ -157,7 +157,7 @@ module OpenapiClient
157
157
  invalid_properties.push("invalid value for \"media\", must conform to the pattern #{pattern}.")
158
158
  end
159
159
 
160
- pattern = Regexp.new(/^https:\/\//)
160
+ pattern = Regexp.new(/^(https|shortcuts):\/\//)
161
161
  if !@redirection.nil? && @redirection !~ pattern
162
162
  invalid_properties.push("invalid value for \"redirection\", must conform to the pattern #{pattern}.")
163
163
  end
@@ -175,7 +175,7 @@ module OpenapiClient
175
175
  warn '[DEPRECATED] the `valid?` method is obsolete'
176
176
  return false if @title.nil?
177
177
  return false if !@media.nil? && @media !~ Regexp.new(/^https:\/\//)
178
- return false if !@redirection.nil? && @redirection !~ Regexp.new(/^https:\/\//)
178
+ return false if !@redirection.nil? && @redirection !~ Regexp.new(/^(https|shortcuts):\/\//)
179
179
  return false if !@actions.nil? && @actions.length > 4
180
180
  true
181
181
  end
@@ -202,7 +202,7 @@ module OpenapiClient
202
202
  fail ArgumentError, 'redirection cannot be nil'
203
203
  end
204
204
 
205
- pattern = Regexp.new(/^https:\/\//)
205
+ pattern = Regexp.new(/^(https|shortcuts):\/\//)
206
206
  if redirection !~ pattern
207
207
  fail ArgumentError, "invalid value for \"redirection\", must conform to the pattern #{pattern}."
208
208
  end
@@ -23,7 +23,7 @@ module OpenapiClient
23
23
  # Use for segmented_progress.
24
24
  attr_accessor :number_of_steps
25
25
 
26
- # Use for segmented_progress.
26
+ # Use for segmented_progress. Set 0 when no segment is complete yet. Must be less than or equal to number_of_steps when number_of_steps is provided.
27
27
  attr_accessor :current_step
28
28
 
29
29
  # Use for progress. Takes precedence over value/upper_limit if both are provided.
@@ -53,10 +53,10 @@ module OpenapiClient
53
53
  # Required for type=alert.
54
54
  attr_accessor :message
55
55
 
56
- # Optional SF Symbol icon for type=alert.
56
+ # Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, and stats.
57
57
  attr_accessor :icon
58
58
 
59
- # Optional badge for type=alert.
59
+ # Optional badge. Supported by alert, progress, and segmented_progress.
60
60
  attr_accessor :badge
61
61
 
62
62
  # Optional. Seconds before the ended Live Activity is dismissed.
@@ -247,8 +247,8 @@ module OpenapiClient
247
247
  invalid_properties.push('invalid value for "number_of_steps", must be greater than or equal to 1.')
248
248
  end
249
249
 
250
- if !@current_step.nil? && @current_step < 1
251
- invalid_properties.push('invalid value for "current_step", must be greater than or equal to 1.')
250
+ if !@current_step.nil? && @current_step < 0
251
+ invalid_properties.push('invalid value for "current_step", must be greater than or equal to 0.')
252
252
  end
253
253
 
254
254
  if !@percentage.nil? && @percentage > 100
@@ -288,7 +288,7 @@ module OpenapiClient
288
288
  warn '[DEPRECATED] the `valid?` method is obsolete'
289
289
  return false if @title.nil?
290
290
  return false if !@number_of_steps.nil? && @number_of_steps < 1
291
- return false if !@current_step.nil? && @current_step < 1
291
+ return false if !@current_step.nil? && @current_step < 0
292
292
  return false if !@percentage.nil? && @percentage > 100
293
293
  return false if !@percentage.nil? && @percentage < 0
294
294
  type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert"])
@@ -326,8 +326,8 @@ module OpenapiClient
326
326
  fail ArgumentError, 'current_step cannot be nil'
327
327
  end
328
328
 
329
- if current_step < 1
330
- fail ArgumentError, 'invalid value for "current_step", must be greater than or equal to 1.'
329
+ if current_step < 0
330
+ fail ArgumentError, 'invalid value for "current_step", must be greater than or equal to 0.'
331
331
  end
332
332
 
333
333
  @current_step = current_step
@@ -11,5 +11,5 @@ Generator version: 7.7.0
11
11
  =end
12
12
 
13
13
  module OpenapiClient
14
- VERSION = '1.3.1'
14
+ VERSION = '1.6.0'
15
15
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActivitySmith
4
- VERSION = "1.4.0"
4
+ VERSION = "1.6.0"
5
5
  end
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.0
4
+ version: 1.6.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-28 00:00:00.000000000 Z
11
+ date: 2026-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json