activitysmith 1.2.0 → 1.3.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: 7049fc74d1e6413d076f29460c876e25eed8288a443f083d4f67286098efcb72
4
- data.tar.gz: 6240b7a43f373237b794dcbf04654211b5a1c97f3796b949f16bdf9a8a17d92b
3
+ metadata.gz: 4d97dda055e4f02cb5a23a068d6cf926aa298df90d535ed90b04f04a054274d5
4
+ data.tar.gz: 1f7207214477f6dad9a1421b57664f644d181234e061e554531f461f5cfd9ad7
5
5
  SHA512:
6
- metadata.gz: d033284e3d2e932d928096037880a61a34650e233578244cc70819b4d8bf04a019dc67b74c42d693a372978a2bf1e7882bb674aa8c6e4830b722642246dc8fbd
7
- data.tar.gz: be32ed8bc216d5710ab192b542df9e3f8ac4528e476acdccfb35502997cc561d14a603e839f5529e47b1b32a0273fd46f92ca468f2c1330b9f3acc95f2306ecc
6
+ metadata.gz: 4b458cd36f4170e00116fe5e443a4e4590ea9c1d1d9b493d49daced2b3bf41b70ed0a6e9d5a2fc5e0a625e07fdfb7b61ac84125d099f5abba024fa0f60678ce1
7
+ data.tar.gz: a544c93e039ed071d9f0627d406f6577ca63ed03db7d160f719e0b37a66ec725b15a8696cefa8ef971ed51aea66cdb18fb3e9e022b8eda98dda939f9c510248a
data/README.md CHANGED
@@ -17,6 +17,7 @@ See [API reference](https://activitysmith.com/docs/api-reference/introduction).
17
17
  - [Live Activities](#live-activities)
18
18
  - [Simple: Let ActivitySmith manage the Live Activity for you](#simple-let-activitysmith-manage-the-live-activity-for-you)
19
19
  - [Advanced: Full lifecycle control](#advanced-full-lifecycle-control)
20
+ - [Stats Type](#stats-type)
20
21
  - [Metrics Type](#metrics-type)
21
22
  - [Segmented Progress Type](#segmented-progress-type)
22
23
  - [Progress Type](#progress-type)
@@ -127,8 +128,9 @@ activitysmith.notifications.send(
127
128
  <img src="https://cdn.activitysmith.com/features/metrics-live-activity-action.png" alt="Metrics Live Activity screenshot" width="680" />
128
129
  </p>
129
130
 
130
- There are three types of Live Activities:
131
+ There are four types of Live Activities:
131
132
 
133
+ - `stats`: best for compact business or product stats like revenue, orders, conversion, and average order value
132
134
  - `metrics`: best for live operational stats like server CPU and memory, queue depth, or replica lag
133
135
  - `segmented_progress`: best for step-based workflows like deployments, backups, and ETL pipelines
134
136
  - `progress`: best for continuous jobs like uploads, reindexes, and long-running migrations tracked as a percentage
@@ -155,6 +157,33 @@ such as a server, deployment, build pipeline, cron job, or charging session.
155
157
  This is especially useful for cron jobs and other scheduled tasks where you do
156
158
  not want to store `activity_id` between runs.
157
159
 
160
+ #### Stats
161
+
162
+ <p align="center">
163
+ <img src="https://cdn.activitysmith.com/features/stats-live-activity.png" alt="Stats stream example" width="680" />
164
+ </p>
165
+
166
+ ```ruby
167
+ status = activitysmith.live_activities.stream(
168
+ "sales-hourly",
169
+ {
170
+ content_state: {
171
+ title: "Sales",
172
+ subtitle: "last hour",
173
+ type: "stats",
174
+ metrics: [
175
+ { label: "Revenue", value: "$2430", color: "blue" },
176
+ { label: "Orders", value: "37", color: "green" },
177
+ { label: "Conversion", value: "4.8%", color: "magenta" },
178
+ { label: "Avg Order", value: "$65.68", color: "yellow" },
179
+ { label: "Refunds", value: "$84", color: "red" },
180
+ { label: "New Buyers", value: "18", color: "cyan" }
181
+ ]
182
+ }
183
+ }
184
+ )
185
+ ```
186
+
158
187
  #### Metrics
159
188
 
160
189
  <p align="center">
@@ -265,6 +294,89 @@ Use these methods when you want to manage the Live Activity lifecycle yourself:
265
294
  3. Call `activitysmith.live_activities.update(...)` as progress changes.
266
295
  4. Call `activitysmith.live_activities.end(...)` when the work is finished.
267
296
 
297
+ ### Stats Type
298
+
299
+ Keep your key numbers on your Lock Screen. `stats` fits 1 to 8 labeled values,
300
+ such as revenue, orders, conversion, uptime, or any other business metric you
301
+ want visible at a glance. Each metric can use a formatted string or number as
302
+ its `value`. Add `color` to a metric to show an accent dot next to its label;
303
+ omit `color` to show the label without a dot.
304
+
305
+ #### Start
306
+
307
+ <p align="center">
308
+ <img src="https://cdn.activitysmith.com/features/stats-live-activity.png" alt="Stats Live Activity with sales revenue, orders, conversion, and average order value" width="680" />
309
+ </p>
310
+
311
+ ```ruby
312
+ start = activitysmith.live_activities.start(
313
+ {
314
+ content_state: {
315
+ title: "Sales",
316
+ subtitle: "last hour",
317
+ type: "stats",
318
+ metrics: [
319
+ { label: "Revenue", value: "$2430", color: "blue" },
320
+ { label: "Orders", value: "37", color: "green" },
321
+ { label: "Conversion", value: "4.8%", color: "magenta" },
322
+ { label: "Avg Order", value: "$65.68", color: "yellow" },
323
+ { label: "Refunds", value: "$84", color: "red" },
324
+ { label: "New Buyers", value: "18", color: "cyan" }
325
+ ]
326
+ }
327
+ }
328
+ )
329
+
330
+ activity_id = start.activity_id
331
+ ```
332
+
333
+ #### Update
334
+
335
+ ```ruby
336
+ activitysmith.live_activities.update(
337
+ {
338
+ activity_id: activity_id,
339
+ content_state: {
340
+ title: "Sales",
341
+ subtitle: "last hour",
342
+ type: "stats",
343
+ metrics: [
344
+ { label: "Revenue", value: "$3180", color: "blue" },
345
+ { label: "Orders", value: "51", color: "green" },
346
+ { label: "Conversion", value: "5.2%", color: "magenta" },
347
+ { label: "Avg Order", value: "$62.35", color: "yellow" },
348
+ { label: "Refunds", value: "$126", color: "red" },
349
+ { label: "New Buyers", value: "24", color: "cyan" }
350
+ ]
351
+ }
352
+ }
353
+ )
354
+ ```
355
+
356
+ #### End
357
+
358
+ ```ruby
359
+ activitysmith.live_activities.end(
360
+ {
361
+ activity_id: activity_id,
362
+ content_state: {
363
+ title: "Sales",
364
+ subtitle: "last hour",
365
+ type: "stats",
366
+ metrics: [
367
+ { label: "Revenue", value: "$3460", color: "blue" },
368
+ { label: "Orders", value: "58", color: "green" },
369
+ { label: "Conversion", value: "5.4%", color: "magenta" },
370
+ { label: "Avg Order", value: "$59.66", color: "yellow" },
371
+ { label: "Refunds", value: "$92", color: "red" },
372
+ { label: "New Buyers", value: "31", color: "cyan" }
373
+ ],
374
+ auto_dismiss_minutes: 2
375
+ }
376
+ }
377
+ )
378
+ ```
379
+
268
380
  ### Metrics Type
269
381
 
270
382
  Use `metrics` when you want to keep a small set of live stats visible, such as
@@ -561,7 +673,7 @@ activitysmith.notifications.send(
561
673
  <img src="https://cdn.activitysmith.com/features/lock-screen-widgets.png" alt="Lock screen widgets" width="680" />
562
674
  </p>
563
675
 
564
- ActivitySmith lets you display any value on your Lock Screen with widgets - SaaS metrics, revenue, signups, uptime, habits, or anything else you want to track. Create a metric in the web app, then update the metric value using our API, add a widget to your lock screen and it will fetch the latest update automatically.
676
+ ActivitySmith lets you display any value on your Lock Screen with widgets - SaaS metrics, revenue, signups, uptime, habits, or anything else you want to track. Create a metric in the <a href="https://activitysmith.com/app/widgets" target="_blank" rel="noopener noreferrer">web app</a>, then update the metric value using our API, add a widget to your lock screen and it will fetch the latest update automatically.
565
677
 
566
678
  <p align="center">
567
679
  <img src="https://cdn.activitysmith.com/features/create-widget-metric.png" alt="Create widget metric" width="680" />
@@ -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. Supports segmented_progress, progress, and metrics activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start.
23
+ # Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, and stats activity types. 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. Supports segmented_progress, progress, and metrics activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start.
33
+ # Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, and stats activity types. 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
@@ -250,7 +250,7 @@ module OpenapiClient
250
250
  end
251
251
 
252
252
  # Start a Live Activity
253
- # Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, and metrics activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes.
253
+ # Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, metrics, and stats activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes.
254
254
  # @param live_activity_start_request [LiveActivityStartRequest]
255
255
  # @param [Hash] opts the optional parameters
256
256
  # @return [LiveActivityStartResponse]
@@ -260,7 +260,7 @@ module OpenapiClient
260
260
  end
261
261
 
262
262
  # Start a Live Activity
263
- # Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, and metrics activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes.
263
+ # Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, metrics, and stats activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes.
264
264
  # @param live_activity_start_request [LiveActivityStartRequest]
265
265
  # @param [Hash] opts the optional parameters
266
266
  # @return [Array<(LiveActivityStartResponse, Integer, Hash)>] LiveActivityStartResponse data, response status code and response headers
@@ -318,7 +318,7 @@ module OpenapiClient
318
318
  end
319
319
 
320
320
  # Update a Live Activity
321
- # Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, and metrics activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
321
+ # Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, metrics, and stats activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
322
322
  # @param live_activity_update_request [LiveActivityUpdateRequest]
323
323
  # @param [Hash] opts the optional parameters
324
324
  # @return [LiveActivityUpdateResponse]
@@ -328,7 +328,7 @@ module OpenapiClient
328
328
  end
329
329
 
330
330
  # Update a Live Activity
331
- # Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, and metrics activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
331
+ # Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, metrics, and stats activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
332
332
  # @param live_activity_update_request [LiveActivityUpdateRequest]
333
333
  # @param [Hash] opts the optional parameters
334
334
  # @return [Array<(LiveActivityUpdateResponse, Integer, Hash)>] LiveActivityUpdateResponse data, response status code and response headers
@@ -20,7 +20,7 @@ module OpenapiClient
20
20
  @api_client = api_client
21
21
  end
22
22
  # Update a widget metric value
23
- # Updates the latest value for a metric configured in ActivitySmith widgets. Create the metric in the web app first, then write values using its key. Numeric metric formats accept finite numbers. String metrics accept non-empty text up to 64 characters.
23
+ # Updates the latest value for a metric displayed in ActivitySmith widgets. Create the metric in the web app first, then update its value using the key.
24
24
  # @param key [String] Metric key configured in the web app. Lowercase letters, numbers, dots, underscores, and dashes are allowed.
25
25
  # @param metric_value_update_request [MetricValueUpdateRequest]
26
26
  # @param [Hash] opts the optional parameters
@@ -31,7 +31,7 @@ module OpenapiClient
31
31
  end
32
32
 
33
33
  # Update a widget metric value
34
- # Updates the latest value for a metric configured in ActivitySmith widgets. Create the metric in the web app first, then write values using its key. Numeric metric formats accept finite numbers. String metrics accept non-empty text up to 64 characters.
34
+ # Updates the latest value for a metric displayed in ActivitySmith widgets. Create the metric in the web app first, then update its value using the key.
35
35
  # @param key [String] Metric key configured in the web app. Lowercase letters, numbers, dots, underscores, and dashes are allowed.
36
36
  # @param metric_value_update_request [MetricValueUpdateRequest]
37
37
  # @param [Hash] opts the optional parameters
@@ -21,12 +21,38 @@ module OpenapiClient
21
21
 
22
22
  attr_accessor :unit
23
23
 
24
+ # Optional per-metric accent color for metrics and stats activities.
25
+ attr_accessor :color
26
+
27
+ class EnumAttributeValidator
28
+ attr_reader :datatype
29
+ attr_reader :allowable_values
30
+
31
+ def initialize(datatype, allowable_values)
32
+ @allowable_values = allowable_values.map do |value|
33
+ case datatype.to_s
34
+ when /Integer/i
35
+ value.to_i
36
+ when /Float/i
37
+ value.to_f
38
+ else
39
+ value
40
+ end
41
+ end
42
+ end
43
+
44
+ def valid?(value)
45
+ !value || allowable_values.include?(value)
46
+ end
47
+ end
48
+
24
49
  # Attribute mapping from ruby-style variable name to JSON key.
25
50
  def self.attribute_map
26
51
  {
27
52
  :'label' => :'label',
28
53
  :'value' => :'value',
29
- :'unit' => :'unit'
54
+ :'unit' => :'unit',
55
+ :'color' => :'color'
30
56
  }
31
57
  end
32
58
 
@@ -39,8 +65,9 @@ module OpenapiClient
39
65
  def self.openapi_types
40
66
  {
41
67
  :'label' => :'String',
42
- :'value' => :'Float',
43
- :'unit' => :'String'
68
+ :'value' => :'ActivityMetricValue',
69
+ :'unit' => :'String',
70
+ :'color' => :'String'
44
71
  }
45
72
  end
46
73
 
@@ -80,6 +107,10 @@ module OpenapiClient
80
107
  if attributes.key?(:'unit')
81
108
  self.unit = attributes[:'unit']
82
109
  end
110
+
111
+ if attributes.key?(:'color')
112
+ self.color = attributes[:'color']
113
+ end
83
114
  end
84
115
 
85
116
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -99,14 +130,6 @@ module OpenapiClient
99
130
  invalid_properties.push('invalid value for "value", value cannot be nil.')
100
131
  end
101
132
 
102
- if @value > 100
103
- invalid_properties.push('invalid value for "value", must be smaller than or equal to 100.')
104
- end
105
-
106
- if @value < 0
107
- invalid_properties.push('invalid value for "value", must be greater than or equal to 0.')
108
- end
109
-
110
133
  invalid_properties
111
134
  end
112
135
 
@@ -117,8 +140,8 @@ module OpenapiClient
117
140
  return false if @label.nil?
118
141
  return false if @label.to_s.length < 1
119
142
  return false if @value.nil?
120
- return false if @value > 100
121
- return false if @value < 0
143
+ color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
144
+ return false unless color_validator.valid?(@color)
122
145
  true
123
146
  end
124
147
 
@@ -136,22 +159,14 @@ module OpenapiClient
136
159
  @label = label
137
160
  end
138
161
 
139
- # Custom attribute writer method with validation
140
- # @param [Object] value Value to be assigned
141
- def value=(value)
142
- if value.nil?
143
- fail ArgumentError, 'value cannot be nil'
162
+ # Custom attribute writer method checking allowed values (enum).
163
+ # @param [Object] color Object to be assigned
164
+ def color=(color)
165
+ validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
166
+ unless validator.valid?(color)
167
+ fail ArgumentError, "invalid value for \"color\", must be one of #{validator.allowable_values}."
144
168
  end
145
-
146
- if value > 100
147
- fail ArgumentError, 'invalid value for "value", must be smaller than or equal to 100.'
148
- end
149
-
150
- if value < 0
151
- fail ArgumentError, 'invalid value for "value", must be greater than or equal to 0.'
152
- end
153
-
154
- @value = value
169
+ @color = color
155
170
  end
156
171
 
157
172
  # Checks equality by comparing each attribute.
@@ -161,7 +176,8 @@ module OpenapiClient
161
176
  self.class == o.class &&
162
177
  label == o.label &&
163
178
  value == o.value &&
164
- unit == o.unit
179
+ unit == o.unit &&
180
+ color == o.color
165
181
  end
166
182
 
167
183
  # @see the `==` method
@@ -173,7 +189,7 @@ module OpenapiClient
173
189
  # Calculates hash code according to all attributes.
174
190
  # @return [Integer] Hash code
175
191
  def hash
176
- [label, value, unit].hash
192
+ [label, value, unit, color].hash
177
193
  end
178
194
 
179
195
  # Builds the object from hash
@@ -14,11 +14,10 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module OpenapiClient
17
- # Latest metric value. Numeric formats return a number. String metrics return text.
18
- module WidgetMetricLatestValue
17
+ module ActivityMetricValue
19
18
  class << self
20
- # List of class defined in anyOf (OpenAPI v3)
21
- def openapi_any_of
19
+ # List of class defined in oneOf (OpenAPI v3)
20
+ def openapi_one_of
22
21
  [
23
22
  :'Float',
24
23
  :'String'
@@ -26,16 +25,17 @@ module OpenapiClient
26
25
  end
27
26
 
28
27
  # Builds the object
29
- # @param [Mixed] Data to be matched against the list of anyOf items
28
+ # @param [Mixed] Data to be matched against the list of oneOf items
30
29
  # @return [Object] Returns the model or the data itself
31
30
  def build(data)
32
- # Go through the list of anyOf items and attempt to identify the appropriate one.
31
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
33
32
  # Note:
33
+ # - We do not attempt to check whether exactly one item matches.
34
34
  # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
35
  # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
36
  # - TODO: scalar values are de facto behaving as if they were nullable.
37
37
  # - TODO: logging when debugging is set.
38
- openapi_any_of.each do |klass|
38
+ openapi_one_of.each do |klass|
39
39
  begin
40
40
  next if klass == :AnyType # "nullable: true"
41
41
  typed_data = find_and_cast_into_type(klass, data)
@@ -44,7 +44,7 @@ module OpenapiClient
44
44
  end
45
45
  end
46
46
 
47
- openapi_any_of.include?(:AnyType) ? data : nil
47
+ openapi_one_of.include?(:AnyType) ? data : nil
48
48
  end
49
49
 
50
50
  private
@@ -83,7 +83,7 @@ module OpenapiClient
83
83
  else # model
84
84
  const = OpenapiClient.const_get(klass)
85
85
  if const
86
- if const.respond_to?(:openapi_any_of) # nested anyOf model
86
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
87
87
  model = const.build(data)
88
88
  return model if model
89
89
  else
@@ -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 include a non-empty metrics array. 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. 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
 
@@ -35,7 +35,7 @@ module OpenapiClient
35
35
  # Maximum progress value. Use with value for type=progress.
36
36
  attr_accessor :upper_limit
37
37
 
38
- # Use for type=metrics.
38
+ # Use for type=metrics or type=stats.
39
39
  attr_accessor :metrics
40
40
 
41
41
  # Optional. When omitted, the API uses the existing Live Activity type.
@@ -227,6 +227,10 @@ module OpenapiClient
227
227
  invalid_properties.push('invalid value for "percentage", must be greater than or equal to 0.')
228
228
  end
229
229
 
230
+ if !@metrics.nil? && @metrics.length > 8
231
+ invalid_properties.push('invalid value for "metrics", number of items must be less than or equal to 8.')
232
+ end
233
+
230
234
  if !@metrics.nil? && @metrics.length < 1
231
235
  invalid_properties.push('invalid value for "metrics", number of items must be greater than or equal to 1.')
232
236
  end
@@ -247,8 +251,9 @@ module OpenapiClient
247
251
  return false if !@current_step.nil? && @current_step < 1
248
252
  return false if !@percentage.nil? && @percentage > 100
249
253
  return false if !@percentage.nil? && @percentage < 0
254
+ return false if !@metrics.nil? && @metrics.length > 8
250
255
  return false if !@metrics.nil? && @metrics.length < 1
251
- type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics"])
256
+ type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats"])
252
257
  return false unless type_validator.valid?(@type)
253
258
  color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
254
259
  return false unless color_validator.valid?(@color)
@@ -311,6 +316,10 @@ module OpenapiClient
311
316
  fail ArgumentError, 'metrics cannot be nil'
312
317
  end
313
318
 
319
+ if metrics.length > 8
320
+ fail ArgumentError, 'invalid value for "metrics", number of items must be less than or equal to 8.'
321
+ end
322
+
314
323
  if metrics.length < 1
315
324
  fail ArgumentError, 'invalid value for "metrics", number of items must be greater than or equal to 1.'
316
325
  end
@@ -321,7 +330,7 @@ module OpenapiClient
321
330
  # Custom attribute writer method checking allowed values (enum).
322
331
  # @param [Object] type Object to be assigned
323
332
  def type=(type)
324
- validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics"])
333
+ validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats"])
325
334
  unless validator.valid?(type)
326
335
  fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
327
336
  end
@@ -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 include a non-empty metrics array. 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 segmented_progress, number_of_steps is not locked and can be changed in later update or end calls.
18
18
  class ContentStateStart
19
19
  attr_accessor :title
20
20
 
@@ -35,7 +35,7 @@ module OpenapiClient
35
35
  # Maximum progress value. Use with value for type=progress.
36
36
  attr_accessor :upper_limit
37
37
 
38
- # Use for type=metrics.
38
+ # Use for type=metrics or type=stats.
39
39
  attr_accessor :metrics
40
40
 
41
41
  attr_accessor :type
@@ -217,6 +217,10 @@ module OpenapiClient
217
217
  invalid_properties.push('invalid value for "percentage", must be greater than or equal to 0.')
218
218
  end
219
219
 
220
+ if !@metrics.nil? && @metrics.length > 8
221
+ invalid_properties.push('invalid value for "metrics", number of items must be less than or equal to 8.')
222
+ end
223
+
220
224
  if !@metrics.nil? && @metrics.length < 1
221
225
  invalid_properties.push('invalid value for "metrics", number of items must be greater than or equal to 1.')
222
226
  end
@@ -237,9 +241,10 @@ module OpenapiClient
237
241
  return false if !@current_step.nil? && @current_step < 1
238
242
  return false if !@percentage.nil? && @percentage > 100
239
243
  return false if !@percentage.nil? && @percentage < 0
244
+ return false if !@metrics.nil? && @metrics.length > 8
240
245
  return false if !@metrics.nil? && @metrics.length < 1
241
246
  return false if @type.nil?
242
- type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics"])
247
+ type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats"])
243
248
  return false unless type_validator.valid?(@type)
244
249
  color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
245
250
  return false unless color_validator.valid?(@color)
@@ -301,6 +306,10 @@ module OpenapiClient
301
306
  fail ArgumentError, 'metrics cannot be nil'
302
307
  end
303
308
 
309
+ if metrics.length > 8
310
+ fail ArgumentError, 'invalid value for "metrics", number of items must be less than or equal to 8.'
311
+ end
312
+
304
313
  if metrics.length < 1
305
314
  fail ArgumentError, 'invalid value for "metrics", number of items must be greater than or equal to 1.'
306
315
  end
@@ -311,7 +320,7 @@ module OpenapiClient
311
320
  # Custom attribute writer method checking allowed values (enum).
312
321
  # @param [Object] type Object to be assigned
313
322
  def type=(type)
314
- validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics"])
323
+ validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats"])
315
324
  unless validator.valid?(type)
316
325
  fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
317
326
  end
@@ -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 include a non-empty metrics array. 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. Type is optional when updating an existing activity. You can increase or decrease number_of_steps during updates.
18
18
  class ContentStateUpdate
19
19
  attr_accessor :title
20
20
 
@@ -35,7 +35,7 @@ module OpenapiClient
35
35
  # Maximum progress value. Use with value for type=progress.
36
36
  attr_accessor :upper_limit
37
37
 
38
- # Use for type=metrics.
38
+ # Use for type=metrics or type=stats.
39
39
  attr_accessor :metrics
40
40
 
41
41
  # Optional. When omitted, the API uses the existing Live Activity type.
@@ -216,6 +216,10 @@ module OpenapiClient
216
216
  invalid_properties.push('invalid value for "percentage", must be greater than or equal to 0.')
217
217
  end
218
218
 
219
+ if !@metrics.nil? && @metrics.length > 8
220
+ invalid_properties.push('invalid value for "metrics", number of items must be less than or equal to 8.')
221
+ end
222
+
219
223
  if !@metrics.nil? && @metrics.length < 1
220
224
  invalid_properties.push('invalid value for "metrics", number of items must be greater than or equal to 1.')
221
225
  end
@@ -232,8 +236,9 @@ module OpenapiClient
232
236
  return false if !@current_step.nil? && @current_step < 1
233
237
  return false if !@percentage.nil? && @percentage > 100
234
238
  return false if !@percentage.nil? && @percentage < 0
239
+ return false if !@metrics.nil? && @metrics.length > 8
235
240
  return false if !@metrics.nil? && @metrics.length < 1
236
- type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics"])
241
+ type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats"])
237
242
  return false unless type_validator.valid?(@type)
238
243
  color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
239
244
  return false unless color_validator.valid?(@color)
@@ -295,6 +300,10 @@ module OpenapiClient
295
300
  fail ArgumentError, 'metrics cannot be nil'
296
301
  end
297
302
 
303
+ if metrics.length > 8
304
+ fail ArgumentError, 'invalid value for "metrics", number of items must be less than or equal to 8.'
305
+ end
306
+
298
307
  if metrics.length < 1
299
308
  fail ArgumentError, 'invalid value for "metrics", number of items must be greater than or equal to 1.'
300
309
  end
@@ -305,7 +314,7 @@ module OpenapiClient
305
314
  # Custom attribute writer method checking allowed values (enum).
306
315
  # @param [Object] type Object to be assigned
307
316
  def type=(type)
308
- validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics"])
317
+ validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats"])
309
318
  unless validator.valid?(type)
310
319
  fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
311
320
  end