activitysmith 0.1.5 → 0.1.6

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: 0d8716c7c9794439454c8ed5a182522c0a0eb32449d198dadea37652609f4469
4
- data.tar.gz: 6b84b2f13f5930404ea1fdf8fa8adc73082aa9b3b6d2564dd119819e5f0c0c3d
3
+ metadata.gz: 01ceddf3ae5045d286636cd3fa23783c922dc649b79e04ec96920994fbbf20e4
4
+ data.tar.gz: 3beeee49f2549b2d76db40ad5ab3e68ebc47b19513090780ac1dbc8891599edb
5
5
  SHA512:
6
- metadata.gz: cad0ad010c8285ef38626df955773b4988a307736e95f399473a2d516ff39ecfce39849e81817a5e5ebfcd5150b668fbd3489869a6dbec7ffb5ae34190c1b5ea
7
- data.tar.gz: 0d502d03eb228e205234bec172022c65e87ba6375072152baef435eed94091a05382d7c0eb479315214685ebb6d768c64ce843dfe8194f33fcf7ec7f9164a288
6
+ metadata.gz: 82dac88237bf62fd4b7d9895d235a65d6b85cda0818a36808b6851779977e70b13e2f5e1066104f1590fda9b3d4f250198cb85da57c3a18fe3027ea5b0c9142f
7
+ data.tar.gz: f0f9ed517c2fbe3e870061ce4ae7240b4efa93e66965f5c0779a79b9bbb0b5784fcb5e86eeba4d8d65a842a670f4aaa8d9895a0fbea5e0685789fa961c11139f
data/README.md CHANGED
@@ -40,10 +40,34 @@ puts response.success
40
40
  puts response.devices_notified
41
41
  ```
42
42
 
43
- ### Start a Live Activity
43
+ ## Live Activities
44
+
45
+ Live Activities come in two UI types, but the lifecycle stays the same:
46
+ start the activity, keep the returned `activity_id`, update it as state
47
+ changes, then end it when the work is done.
48
+
49
+ - `segmented_progress`: best for jobs tracked in steps
50
+ - `progress`: best for jobs tracked as a percentage or numeric range
51
+
52
+ ### Shared flow
53
+
54
+ 1. Call `activitysmith.live_activities.start(...)`.
55
+ 2. Save the returned `activity_id`.
56
+ 3. Call `activitysmith.live_activities.update(...)` as progress changes.
57
+ 4. Call `activitysmith.live_activities.end(...)` when the work is finished.
58
+
59
+ ### Segmented Progress Type
60
+
61
+ Use `segmented_progress` when progress is easier to follow as steps instead of a
62
+ raw percentage. It fits jobs like backups, deployments, ETL pipelines, and
63
+ checklists where "step 2 of 3" is more useful than "67%".
64
+ `number_of_steps` is dynamic, so you can increase or decrease it later if the
65
+ workflow changes.
66
+
67
+ #### Start
44
68
 
45
69
  <p align="center">
46
- <img src="https://cdn.activitysmith.com/features/start-live-activity.png" alt="Start live activity example" width="680" />
70
+ <img src="https://cdn.activitysmith.com/features/start-live-activity.png" alt="Segmented progress start example" width="680" />
47
71
  </p>
48
72
 
49
73
  ```ruby
@@ -64,10 +88,10 @@ start = activitysmith.live_activities.start(
64
88
  activity_id = start.activity_id
65
89
  ```
66
90
 
67
- ### Update a Live Activity
91
+ #### Update
68
92
 
69
93
  <p align="center">
70
- <img src="https://cdn.activitysmith.com/features/update-live-activity.png" alt="Update live activity example" width="680" />
94
+ <img src="https://cdn.activitysmith.com/features/update-live-activity.png" alt="Segmented progress update example" width="680" />
71
95
  </p>
72
96
 
73
97
  ```ruby
@@ -77,6 +101,7 @@ update = activitysmith.live_activities.update(
77
101
  content_state: {
78
102
  title: "Nightly database backup",
79
103
  subtitle: "upload archive",
104
+ number_of_steps: 4,
80
105
  current_step: 2
81
106
  }
82
107
  }
@@ -85,10 +110,10 @@ update = activitysmith.live_activities.update(
85
110
  puts update.devices_notified
86
111
  ```
87
112
 
88
- ### End a Live Activity
113
+ #### End
89
114
 
90
115
  <p align="center">
91
- <img src="https://cdn.activitysmith.com/features/end-live-activity.png" alt="End live activity example" width="680" />
116
+ <img src="https://cdn.activitysmith.com/features/end-live-activity.png" alt="Segmented progress end example" width="680" />
92
117
  </p>
93
118
 
94
119
  ```ruby
@@ -98,7 +123,8 @@ finish = activitysmith.live_activities.end(
98
123
  content_state: {
99
124
  title: "Nightly database backup",
100
125
  subtitle: "verify restore",
101
- current_step: 3,
126
+ number_of_steps: 4,
127
+ current_step: 4,
102
128
  auto_dismiss_minutes: 2
103
129
  }
104
130
  }
@@ -107,6 +133,73 @@ finish = activitysmith.live_activities.end(
107
133
  puts finish.success
108
134
  ```
109
135
 
136
+ ### Progress Type
137
+
138
+ Use `progress` when the state is naturally continuous. It fits charging,
139
+ downloads, sync jobs, uploads, timers, and any flow where a percentage or
140
+ numeric range is the clearest signal.
141
+
142
+ #### Start
143
+
144
+ <p align="center">
145
+ <img src="https://cdn.activitysmith.com/features/progress-live-activity-start.png" alt="Progress start example" width="680" />
146
+ </p>
147
+
148
+ ```ruby
149
+ start = activitysmith.live_activities.start(
150
+ {
151
+ content_state: {
152
+ title: "EV Charging",
153
+ subtitle: "Added 30 mi range",
154
+ type: "progress",
155
+ percentage: 15,
156
+ color: "lime"
157
+ }
158
+ }
159
+ )
160
+
161
+ activity_id = start.activity_id
162
+ ```
163
+
164
+ #### Update
165
+
166
+ <p align="center">
167
+ <img src="https://cdn.activitysmith.com/features/progress-live-activity-update.png" alt="Progress update example" width="680" />
168
+ </p>
169
+
170
+ ```ruby
171
+ activitysmith.live_activities.update(
172
+ {
173
+ activity_id: activity_id,
174
+ content_state: {
175
+ title: "EV Charging",
176
+ subtitle: "Added 120 mi range",
177
+ percentage: 60
178
+ }
179
+ }
180
+ )
181
+ ```
182
+
183
+ #### End
184
+
185
+ <p align="center">
186
+ <img src="https://cdn.activitysmith.com/features/progress-live-activity-end.png" alt="Progress end example" width="680" />
187
+ </p>
188
+
189
+ ```ruby
190
+ activitysmith.live_activities.end(
191
+ {
192
+ activity_id: activity_id,
193
+ content_state: {
194
+ title: "EV Charging",
195
+ subtitle: "Added 200 mi range",
196
+ percentage: 100,
197
+ auto_dismiss_minutes: 2
198
+ }
199
+ }
200
+ )
201
+ ```
202
+
110
203
  ## Channels
111
204
 
112
205
  Channels are used to target specific team members or devices. Can be used for both push notifications and live activities.
@@ -20,7 +20,7 @@ module OpenapiClient
20
20
  @api_client = api_client
21
21
  end
22
22
  # End a Live Activity
23
- # Ends a Live Activity and archives its lifecycle.
23
+ # Ends a Live Activity and archives its lifecycle. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start.
24
24
  # @param live_activity_end_request [LiveActivityEndRequest]
25
25
  # @param [Hash] opts the optional parameters
26
26
  # @return [LiveActivityEndResponse]
@@ -30,7 +30,7 @@ module OpenapiClient
30
30
  end
31
31
 
32
32
  # End a Live Activity
33
- # Ends a Live Activity and archives its lifecycle.
33
+ # Ends a Live Activity and archives its lifecycle. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start.
34
34
  # @param live_activity_end_request [LiveActivityEndRequest]
35
35
  # @param [Hash] opts the optional parameters
36
36
  # @return [Array<(LiveActivityEndResponse, Integer, Hash)>] LiveActivityEndResponse data, response status code and response headers
@@ -88,7 +88,7 @@ module OpenapiClient
88
88
  end
89
89
 
90
90
  # Start a Live Activity
91
- # Starts a Live Activity on devices matched by API key scope and optional target channels.
91
+ # Starts a Live Activity on devices matched by API key scope and optional target channels. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes.
92
92
  # @param live_activity_start_request [LiveActivityStartRequest]
93
93
  # @param [Hash] opts the optional parameters
94
94
  # @return [LiveActivityStartResponse]
@@ -98,7 +98,7 @@ module OpenapiClient
98
98
  end
99
99
 
100
100
  # Start a Live Activity
101
- # Starts a Live Activity on devices matched by API key scope and optional target channels.
101
+ # Starts a Live Activity on devices matched by API key scope and optional target channels. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes.
102
102
  # @param live_activity_start_request [LiveActivityStartRequest]
103
103
  # @param [Hash] opts the optional parameters
104
104
  # @return [Array<(LiveActivityStartResponse, Integer, Hash)>] LiveActivityStartResponse data, response status code and response headers
@@ -156,7 +156,7 @@ module OpenapiClient
156
156
  end
157
157
 
158
158
  # Update a Live Activity
159
- # Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued.
159
+ # Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
160
160
  # @param live_activity_update_request [LiveActivityUpdateRequest]
161
161
  # @param [Hash] opts the optional parameters
162
162
  # @return [LiveActivityUpdateResponse]
@@ -166,7 +166,7 @@ module OpenapiClient
166
166
  end
167
167
 
168
168
  # Update a Live Activity
169
- # Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued.
169
+ # Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
170
170
  # @param live_activity_update_request [LiveActivityUpdateRequest]
171
171
  # @param [Hash] opts the optional parameters
172
172
  # @return [Array<(LiveActivityUpdateResponse, Integer, Hash)>] LiveActivityUpdateResponse data, response status code and response headers
@@ -14,20 +14,34 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module OpenapiClient
17
- # End payload. Required fields are title and current_step. number_of_steps is optional.
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. 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
 
21
21
  attr_accessor :subtitle
22
22
 
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.
23
24
  attr_accessor :number_of_steps
24
25
 
26
+ # Current step. Use for type=segmented_progress.
25
27
  attr_accessor :current_step
26
28
 
29
+ # Progress percentage (0–100). Use for type=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 type=progress.
33
+ attr_accessor :value
34
+
35
+ # Maximum progress value. Use with value for type=progress.
36
+ attr_accessor :upper_limit
37
+
38
+ # Optional. When omitted, the API uses the existing Live Activity type.
39
+ attr_accessor :type
40
+
27
41
  # Optional. Accent color for the Live Activity. Defaults to blue.
28
42
  attr_accessor :color
29
43
 
30
- # Optional. Overrides color for the current step.
44
+ # Optional. Overrides color for the current step. Only applies to type=segmented_progress.
31
45
  attr_accessor :step_color
32
46
 
33
47
  # Optional. Minutes before the ended Live Activity is dismissed. Default 3. Set 0 for immediate dismissal. iOS will dismiss ended Live Activities after ~4 hours max.
@@ -62,6 +76,10 @@ module OpenapiClient
62
76
  :'subtitle' => :'subtitle',
63
77
  :'number_of_steps' => :'number_of_steps',
64
78
  :'current_step' => :'current_step',
79
+ :'percentage' => :'percentage',
80
+ :'value' => :'value',
81
+ :'upper_limit' => :'upper_limit',
82
+ :'type' => :'type',
65
83
  :'color' => :'color',
66
84
  :'step_color' => :'step_color',
67
85
  :'auto_dismiss_minutes' => :'auto_dismiss_minutes'
@@ -80,6 +98,10 @@ module OpenapiClient
80
98
  :'subtitle' => :'String',
81
99
  :'number_of_steps' => :'Integer',
82
100
  :'current_step' => :'Integer',
101
+ :'percentage' => :'Float',
102
+ :'value' => :'Float',
103
+ :'upper_limit' => :'Float',
104
+ :'type' => :'String',
83
105
  :'color' => :'String',
84
106
  :'step_color' => :'String',
85
107
  :'auto_dismiss_minutes' => :'Integer'
@@ -123,8 +145,22 @@ module OpenapiClient
123
145
 
124
146
  if attributes.key?(:'current_step')
125
147
  self.current_step = attributes[:'current_step']
126
- else
127
- self.current_step = nil
148
+ end
149
+
150
+ if attributes.key?(:'percentage')
151
+ self.percentage = attributes[:'percentage']
152
+ end
153
+
154
+ if attributes.key?(:'value')
155
+ self.value = attributes[:'value']
156
+ end
157
+
158
+ if attributes.key?(:'upper_limit')
159
+ self.upper_limit = attributes[:'upper_limit']
160
+ end
161
+
162
+ if attributes.key?(:'type')
163
+ self.type = attributes[:'type']
128
164
  end
129
165
 
130
166
  if attributes.key?(:'color')
@@ -157,12 +193,16 @@ module OpenapiClient
157
193
  invalid_properties.push('invalid value for "number_of_steps", must be greater than or equal to 1.')
158
194
  end
159
195
 
160
- if @current_step.nil?
161
- invalid_properties.push('invalid value for "current_step", current_step cannot be nil.')
196
+ if !@current_step.nil? && @current_step < 1
197
+ invalid_properties.push('invalid value for "current_step", must be greater than or equal to 1.')
162
198
  end
163
199
 
164
- if @current_step < 1
165
- invalid_properties.push('invalid value for "current_step", must be greater than or equal to 1.')
200
+ if !@percentage.nil? && @percentage > 100
201
+ invalid_properties.push('invalid value for "percentage", must be smaller than or equal to 100.')
202
+ end
203
+
204
+ if !@percentage.nil? && @percentage < 0
205
+ invalid_properties.push('invalid value for "percentage", must be greater than or equal to 0.')
166
206
  end
167
207
 
168
208
  if !@auto_dismiss_minutes.nil? && @auto_dismiss_minutes < 0
@@ -178,8 +218,11 @@ module OpenapiClient
178
218
  warn '[DEPRECATED] the `valid?` method is obsolete'
179
219
  return false if @title.nil?
180
220
  return false if !@number_of_steps.nil? && @number_of_steps < 1
181
- return false if @current_step.nil?
182
- return false if @current_step < 1
221
+ return false if !@current_step.nil? && @current_step < 1
222
+ return false if !@percentage.nil? && @percentage > 100
223
+ return false if !@percentage.nil? && @percentage < 0
224
+ type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress"])
225
+ return false unless type_validator.valid?(@type)
183
226
  color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
184
227
  return false unless color_validator.valid?(@color)
185
228
  step_color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
@@ -216,6 +259,34 @@ module OpenapiClient
216
259
  @current_step = current_step
217
260
  end
218
261
 
262
+ # Custom attribute writer method with validation
263
+ # @param [Object] percentage Value to be assigned
264
+ def percentage=(percentage)
265
+ if percentage.nil?
266
+ fail ArgumentError, 'percentage cannot be nil'
267
+ end
268
+
269
+ if percentage > 100
270
+ fail ArgumentError, 'invalid value for "percentage", must be smaller than or equal to 100.'
271
+ end
272
+
273
+ if percentage < 0
274
+ fail ArgumentError, 'invalid value for "percentage", must be greater than or equal to 0.'
275
+ end
276
+
277
+ @percentage = percentage
278
+ end
279
+
280
+ # Custom attribute writer method checking allowed values (enum).
281
+ # @param [Object] type Object to be assigned
282
+ def type=(type)
283
+ validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress"])
284
+ unless validator.valid?(type)
285
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
286
+ end
287
+ @type = type
288
+ end
289
+
219
290
  # Custom attribute writer method checking allowed values (enum).
220
291
  # @param [Object] color Object to be assigned
221
292
  def color=(color)
@@ -259,6 +330,10 @@ module OpenapiClient
259
330
  subtitle == o.subtitle &&
260
331
  number_of_steps == o.number_of_steps &&
261
332
  current_step == o.current_step &&
333
+ percentage == o.percentage &&
334
+ value == o.value &&
335
+ upper_limit == o.upper_limit &&
336
+ type == o.type &&
262
337
  color == o.color &&
263
338
  step_color == o.step_color &&
264
339
  auto_dismiss_minutes == o.auto_dismiss_minutes
@@ -273,7 +348,7 @@ module OpenapiClient
273
348
  # Calculates hash code according to all attributes.
274
349
  # @return [Integer] Hash code
275
350
  def hash
276
- [title, subtitle, number_of_steps, current_step, color, step_color, auto_dismiss_minutes].hash
351
+ [title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, type, color, step_color, auto_dismiss_minutes].hash
277
352
  end
278
353
 
279
354
  # Builds the object from hash
@@ -14,22 +14,33 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module OpenapiClient
17
- # Start payload requires title, number_of_steps, current_step, and type.
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.
18
18
  class ContentStateStart
19
19
  attr_accessor :title
20
20
 
21
21
  attr_accessor :subtitle
22
22
 
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.
23
24
  attr_accessor :number_of_steps
24
25
 
26
+ # Current step. Use for type=segmented_progress.
25
27
  attr_accessor :current_step
26
28
 
29
+ # Progress percentage (0–100). Use for type=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 type=progress.
33
+ attr_accessor :value
34
+
35
+ # Maximum progress value. Use with value for type=progress.
36
+ attr_accessor :upper_limit
37
+
27
38
  attr_accessor :type
28
39
 
29
40
  # Optional. Accent color for the Live Activity. Defaults to blue.
30
41
  attr_accessor :color
31
42
 
32
- # Optional. Overrides color for the current step.
43
+ # Optional. Overrides color for the current step. Only applies to type=segmented_progress.
33
44
  attr_accessor :step_color
34
45
 
35
46
  class EnumAttributeValidator
@@ -61,6 +72,9 @@ module OpenapiClient
61
72
  :'subtitle' => :'subtitle',
62
73
  :'number_of_steps' => :'number_of_steps',
63
74
  :'current_step' => :'current_step',
75
+ :'percentage' => :'percentage',
76
+ :'value' => :'value',
77
+ :'upper_limit' => :'upper_limit',
64
78
  :'type' => :'type',
65
79
  :'color' => :'color',
66
80
  :'step_color' => :'step_color'
@@ -79,6 +93,9 @@ module OpenapiClient
79
93
  :'subtitle' => :'String',
80
94
  :'number_of_steps' => :'Integer',
81
95
  :'current_step' => :'Integer',
96
+ :'percentage' => :'Float',
97
+ :'value' => :'Float',
98
+ :'upper_limit' => :'Float',
82
99
  :'type' => :'String',
83
100
  :'color' => :'String',
84
101
  :'step_color' => :'String'
@@ -118,14 +135,22 @@ module OpenapiClient
118
135
 
119
136
  if attributes.key?(:'number_of_steps')
120
137
  self.number_of_steps = attributes[:'number_of_steps']
121
- else
122
- self.number_of_steps = nil
123
138
  end
124
139
 
125
140
  if attributes.key?(:'current_step')
126
141
  self.current_step = attributes[:'current_step']
127
- else
128
- self.current_step = nil
142
+ end
143
+
144
+ if attributes.key?(:'percentage')
145
+ self.percentage = attributes[:'percentage']
146
+ end
147
+
148
+ if attributes.key?(:'value')
149
+ self.value = attributes[:'value']
150
+ end
151
+
152
+ if attributes.key?(:'upper_limit')
153
+ self.upper_limit = attributes[:'upper_limit']
129
154
  end
130
155
 
131
156
  if attributes.key?(:'type')
@@ -154,20 +179,20 @@ module OpenapiClient
154
179
  invalid_properties.push('invalid value for "title", title cannot be nil.')
155
180
  end
156
181
 
157
- if @number_of_steps.nil?
158
- invalid_properties.push('invalid value for "number_of_steps", number_of_steps cannot be nil.')
182
+ if !@number_of_steps.nil? && @number_of_steps < 1
183
+ invalid_properties.push('invalid value for "number_of_steps", must be greater than or equal to 1.')
159
184
  end
160
185
 
161
- if @number_of_steps < 1
162
- invalid_properties.push('invalid value for "number_of_steps", must be greater than or equal to 1.')
186
+ if !@current_step.nil? && @current_step < 1
187
+ invalid_properties.push('invalid value for "current_step", must be greater than or equal to 1.')
163
188
  end
164
189
 
165
- if @current_step.nil?
166
- invalid_properties.push('invalid value for "current_step", current_step cannot be nil.')
190
+ if !@percentage.nil? && @percentage > 100
191
+ invalid_properties.push('invalid value for "percentage", must be smaller than or equal to 100.')
167
192
  end
168
193
 
169
- if @current_step < 1
170
- invalid_properties.push('invalid value for "current_step", must be greater than or equal to 1.')
194
+ if !@percentage.nil? && @percentage < 0
195
+ invalid_properties.push('invalid value for "percentage", must be greater than or equal to 0.')
171
196
  end
172
197
 
173
198
  if @type.nil?
@@ -182,12 +207,12 @@ module OpenapiClient
182
207
  def valid?
183
208
  warn '[DEPRECATED] the `valid?` method is obsolete'
184
209
  return false if @title.nil?
185
- return false if @number_of_steps.nil?
186
- return false if @number_of_steps < 1
187
- return false if @current_step.nil?
188
- return false if @current_step < 1
210
+ return false if !@number_of_steps.nil? && @number_of_steps < 1
211
+ return false if !@current_step.nil? && @current_step < 1
212
+ return false if !@percentage.nil? && @percentage > 100
213
+ return false if !@percentage.nil? && @percentage < 0
189
214
  return false if @type.nil?
190
- type_validator = EnumAttributeValidator.new('String', ["segmented_progress"])
215
+ type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress"])
191
216
  return false unless type_validator.valid?(@type)
192
217
  color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
193
218
  return false unless color_validator.valid?(@color)
@@ -224,10 +249,28 @@ module OpenapiClient
224
249
  @current_step = current_step
225
250
  end
226
251
 
252
+ # Custom attribute writer method with validation
253
+ # @param [Object] percentage Value to be assigned
254
+ def percentage=(percentage)
255
+ if percentage.nil?
256
+ fail ArgumentError, 'percentage cannot be nil'
257
+ end
258
+
259
+ if percentage > 100
260
+ fail ArgumentError, 'invalid value for "percentage", must be smaller than or equal to 100.'
261
+ end
262
+
263
+ if percentage < 0
264
+ fail ArgumentError, 'invalid value for "percentage", must be greater than or equal to 0.'
265
+ end
266
+
267
+ @percentage = percentage
268
+ end
269
+
227
270
  # Custom attribute writer method checking allowed values (enum).
228
271
  # @param [Object] type Object to be assigned
229
272
  def type=(type)
230
- validator = EnumAttributeValidator.new('String', ["segmented_progress"])
273
+ validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress"])
231
274
  unless validator.valid?(type)
232
275
  fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
233
276
  end
@@ -263,6 +306,9 @@ module OpenapiClient
263
306
  subtitle == o.subtitle &&
264
307
  number_of_steps == o.number_of_steps &&
265
308
  current_step == o.current_step &&
309
+ percentage == o.percentage &&
310
+ value == o.value &&
311
+ upper_limit == o.upper_limit &&
266
312
  type == o.type &&
267
313
  color == o.color &&
268
314
  step_color == o.step_color
@@ -277,7 +323,7 @@ module OpenapiClient
277
323
  # Calculates hash code according to all attributes.
278
324
  # @return [Integer] Hash code
279
325
  def hash
280
- [title, subtitle, number_of_steps, current_step, type, color, step_color].hash
326
+ [title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, type, color, step_color].hash
281
327
  end
282
328
 
283
329
  # Builds the object from hash
@@ -14,20 +14,34 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module OpenapiClient
17
- # Update payload. Required fields are title and current_step. number_of_steps is optional.
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.
18
18
  class ContentStateUpdate
19
19
  attr_accessor :title
20
20
 
21
21
  attr_accessor :subtitle
22
22
 
23
+ # Total number of steps. Use for type=segmented_progress. Optional on update, and safe to change if the workflow gains or loses steps.
23
24
  attr_accessor :number_of_steps
24
25
 
26
+ # Current step. Use for type=segmented_progress.
25
27
  attr_accessor :current_step
26
28
 
29
+ # Progress percentage (0–100). Use for type=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 type=progress.
33
+ attr_accessor :value
34
+
35
+ # Maximum progress value. Use with value for type=progress.
36
+ attr_accessor :upper_limit
37
+
38
+ # Optional. When omitted, the API uses the existing Live Activity type.
39
+ attr_accessor :type
40
+
27
41
  # Optional. Accent color for the Live Activity. Defaults to blue.
28
42
  attr_accessor :color
29
43
 
30
- # Optional. Overrides color for the current step.
44
+ # Optional. Overrides color for the current step. Only applies to type=segmented_progress.
31
45
  attr_accessor :step_color
32
46
 
33
47
  class EnumAttributeValidator
@@ -59,6 +73,10 @@ module OpenapiClient
59
73
  :'subtitle' => :'subtitle',
60
74
  :'number_of_steps' => :'number_of_steps',
61
75
  :'current_step' => :'current_step',
76
+ :'percentage' => :'percentage',
77
+ :'value' => :'value',
78
+ :'upper_limit' => :'upper_limit',
79
+ :'type' => :'type',
62
80
  :'color' => :'color',
63
81
  :'step_color' => :'step_color'
64
82
  }
@@ -76,6 +94,10 @@ module OpenapiClient
76
94
  :'subtitle' => :'String',
77
95
  :'number_of_steps' => :'Integer',
78
96
  :'current_step' => :'Integer',
97
+ :'percentage' => :'Float',
98
+ :'value' => :'Float',
99
+ :'upper_limit' => :'Float',
100
+ :'type' => :'String',
79
101
  :'color' => :'String',
80
102
  :'step_color' => :'String'
81
103
  }
@@ -118,8 +140,22 @@ module OpenapiClient
118
140
 
119
141
  if attributes.key?(:'current_step')
120
142
  self.current_step = attributes[:'current_step']
121
- else
122
- self.current_step = nil
143
+ end
144
+
145
+ if attributes.key?(:'percentage')
146
+ self.percentage = attributes[:'percentage']
147
+ end
148
+
149
+ if attributes.key?(:'value')
150
+ self.value = attributes[:'value']
151
+ end
152
+
153
+ if attributes.key?(:'upper_limit')
154
+ self.upper_limit = attributes[:'upper_limit']
155
+ end
156
+
157
+ if attributes.key?(:'type')
158
+ self.type = attributes[:'type']
123
159
  end
124
160
 
125
161
  if attributes.key?(:'color')
@@ -146,12 +182,16 @@ module OpenapiClient
146
182
  invalid_properties.push('invalid value for "number_of_steps", must be greater than or equal to 1.')
147
183
  end
148
184
 
149
- if @current_step.nil?
150
- invalid_properties.push('invalid value for "current_step", current_step cannot be nil.')
185
+ if !@current_step.nil? && @current_step < 1
186
+ invalid_properties.push('invalid value for "current_step", must be greater than or equal to 1.')
151
187
  end
152
188
 
153
- if @current_step < 1
154
- invalid_properties.push('invalid value for "current_step", must be greater than or equal to 1.')
189
+ if !@percentage.nil? && @percentage > 100
190
+ invalid_properties.push('invalid value for "percentage", must be smaller than or equal to 100.')
191
+ end
192
+
193
+ if !@percentage.nil? && @percentage < 0
194
+ invalid_properties.push('invalid value for "percentage", must be greater than or equal to 0.')
155
195
  end
156
196
 
157
197
  invalid_properties
@@ -163,8 +203,11 @@ module OpenapiClient
163
203
  warn '[DEPRECATED] the `valid?` method is obsolete'
164
204
  return false if @title.nil?
165
205
  return false if !@number_of_steps.nil? && @number_of_steps < 1
166
- return false if @current_step.nil?
167
- return false if @current_step < 1
206
+ return false if !@current_step.nil? && @current_step < 1
207
+ return false if !@percentage.nil? && @percentage > 100
208
+ return false if !@percentage.nil? && @percentage < 0
209
+ type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress"])
210
+ return false unless type_validator.valid?(@type)
168
211
  color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
169
212
  return false unless color_validator.valid?(@color)
170
213
  step_color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
@@ -200,6 +243,34 @@ module OpenapiClient
200
243
  @current_step = current_step
201
244
  end
202
245
 
246
+ # Custom attribute writer method with validation
247
+ # @param [Object] percentage Value to be assigned
248
+ def percentage=(percentage)
249
+ if percentage.nil?
250
+ fail ArgumentError, 'percentage cannot be nil'
251
+ end
252
+
253
+ if percentage > 100
254
+ fail ArgumentError, 'invalid value for "percentage", must be smaller than or equal to 100.'
255
+ end
256
+
257
+ if percentage < 0
258
+ fail ArgumentError, 'invalid value for "percentage", must be greater than or equal to 0.'
259
+ end
260
+
261
+ @percentage = percentage
262
+ end
263
+
264
+ # Custom attribute writer method checking allowed values (enum).
265
+ # @param [Object] type Object to be assigned
266
+ def type=(type)
267
+ validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress"])
268
+ unless validator.valid?(type)
269
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
270
+ end
271
+ @type = type
272
+ end
273
+
203
274
  # Custom attribute writer method checking allowed values (enum).
204
275
  # @param [Object] color Object to be assigned
205
276
  def color=(color)
@@ -229,6 +300,10 @@ module OpenapiClient
229
300
  subtitle == o.subtitle &&
230
301
  number_of_steps == o.number_of_steps &&
231
302
  current_step == o.current_step &&
303
+ percentage == o.percentage &&
304
+ value == o.value &&
305
+ upper_limit == o.upper_limit &&
306
+ type == o.type &&
232
307
  color == o.color &&
233
308
  step_color == o.step_color
234
309
  end
@@ -242,7 +317,7 @@ module OpenapiClient
242
317
  # Calculates hash code according to all attributes.
243
318
  # @return [Integer] Hash code
244
319
  def hash
245
- [title, subtitle, number_of_steps, current_step, color, step_color].hash
320
+ [title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, type, color, step_color].hash
246
321
  end
247
322
 
248
323
  # Builds the object from hash
@@ -14,6 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module OpenapiClient
17
+ # End an existing Live Activity by activity_id.
17
18
  class LiveActivityEndRequest
18
19
  attr_accessor :activity_id
19
20
 
@@ -14,6 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module OpenapiClient
17
+ # Returned after a Live Activity end event is sent or queued.
17
18
  class LiveActivityEndResponse
18
19
  attr_accessor :success
19
20
 
@@ -14,6 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module OpenapiClient
17
+ # Start a new Live Activity. The response includes activity_id for later update and end calls.
17
18
  class LiveActivityStartRequest
18
19
  attr_accessor :content_state
19
20
 
@@ -14,6 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module OpenapiClient
17
+ # Returned after a Live Activity starts. Save activity_id and use it for all later updates and for the final end call.
17
18
  class LiveActivityStartResponse
18
19
  attr_accessor :success
19
20
 
@@ -14,6 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module OpenapiClient
17
+ # Update an existing Live Activity by activity_id.
17
18
  class LiveActivityUpdateRequest
18
19
  attr_accessor :activity_id
19
20
 
@@ -14,6 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module OpenapiClient
17
+ # Returned after a Live Activity update is sent or queued.
17
18
  class LiveActivityUpdateResponse
18
19
  attr_accessor :success
19
20
 
@@ -11,5 +11,5 @@ Generator version: 7.7.0
11
11
  =end
12
12
 
13
13
  module OpenapiClient
14
- VERSION = '0.1.0'
14
+ VERSION = '0.1.6'
15
15
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActivitySmith
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.6"
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: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - ActivitySmith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-26 00:00:00.000000000 Z
11
+ date: 2026-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json