activitysmith 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +130 -7
- data/generated/activitysmith_openapi/api/live_activities_api.rb +6 -6
- data/generated/activitysmith_openapi/api/push_notifications_api.rb +2 -2
- data/generated/activitysmith_openapi/models/content_state_end.rb +86 -11
- data/generated/activitysmith_openapi/models/content_state_start.rb +67 -21
- data/generated/activitysmith_openapi/models/content_state_update.rb +86 -11
- data/generated/activitysmith_openapi/models/live_activity_end_request.rb +1 -0
- data/generated/activitysmith_openapi/models/live_activity_end_response.rb +1 -0
- data/generated/activitysmith_openapi/models/live_activity_start_request.rb +1 -0
- data/generated/activitysmith_openapi/models/live_activity_start_response.rb +1 -0
- data/generated/activitysmith_openapi/models/live_activity_update_request.rb +1 -0
- data/generated/activitysmith_openapi/models/live_activity_update_response.rb +1 -0
- data/generated/activitysmith_openapi/models/push_notification_request.rb +34 -3
- data/generated/activitysmith_openapi/version.rb +1 -1
- data/lib/activitysmith/client.rb +1 -0
- data/lib/activitysmith/notifications.rb +30 -2
- data/lib/activitysmith/version.rb +1 -1
- data/lib/activitysmith/versioned_user_agent.rb +9 -0
- data/lib/activitysmith.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6be18d3495ded4e85d34cb9dfa10b9108f9dbd5e35ace8bd6303867fb6b31172
|
|
4
|
+
data.tar.gz: 64b2d345bf824795d5b809d0ce5e9e40ee239d7f86878c20213704892f95db4e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 72f3a210715d8e9e660142c12ba0b5ae1d99bcd87fd49196c1aa8a6f4732b6aa83fd4408b11afc5816ef3e214804dfded8ba7dd23eb1ded669f805e1067df442
|
|
7
|
+
data.tar.gz: a022698cba1e043612fb3490fe3fc8805c20ef61dd8104137d74b3f8a0b36b9e378522ce76e5b4123a520a29ce2f1359f3fad6238758a701e7e672bca508ce8f
|
data/README.md
CHANGED
|
@@ -40,10 +40,34 @@ puts response.success
|
|
|
40
40
|
puts response.devices_notified
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
|
|
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="
|
|
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
|
-
|
|
91
|
+
#### Update
|
|
68
92
|
|
|
69
93
|
<p align="center">
|
|
70
|
-
<img src="https://cdn.activitysmith.com/features/update-live-activity.png" alt="
|
|
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
|
-
|
|
113
|
+
#### End
|
|
89
114
|
|
|
90
115
|
<p align="center">
|
|
91
|
-
<img src="https://cdn.activitysmith.com/features/end-live-activity.png" alt="
|
|
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
|
-
|
|
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.
|
|
@@ -121,6 +214,36 @@ response = activitysmith.notifications.send(
|
|
|
121
214
|
)
|
|
122
215
|
```
|
|
123
216
|
|
|
217
|
+
## Rich Push Notifications with Media
|
|
218
|
+
|
|
219
|
+
<p align="center">
|
|
220
|
+
<img src="https://cdn.activitysmith.com/features/rich-push-notification-with-image.png" alt="Rich push notification with image" width="680" />
|
|
221
|
+
</p>
|
|
222
|
+
|
|
223
|
+
```ruby
|
|
224
|
+
response = activitysmith.notifications.send(
|
|
225
|
+
{
|
|
226
|
+
title: "Homepage ready",
|
|
227
|
+
message: "Your agent finished the redesign.",
|
|
228
|
+
media: "https://cdn.example.com/output/homepage-v2.png",
|
|
229
|
+
redirection: "https://github.com/acme/web/pull/482"
|
|
230
|
+
}
|
|
231
|
+
)
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Send images, videos, or audio with your push notifications, press and hold to preview media directly from the notification, then tap through to open the linked content.
|
|
235
|
+
|
|
236
|
+
<p align="center">
|
|
237
|
+
<img src="https://cdn.activitysmith.com/features/rich-push-notification-with-audio.png" alt="Rich push notification with audio" width="680" />
|
|
238
|
+
</p>
|
|
239
|
+
|
|
240
|
+
What will work:
|
|
241
|
+
|
|
242
|
+
- direct image URL: `.jpg`, `.png`, `.gif`, etc.
|
|
243
|
+
- direct audio file URL: `.mp3`, `.m4a`, etc.
|
|
244
|
+
- direct video file URL: `.mp4`, `.mov`, etc.
|
|
245
|
+
- URL that responds with a proper media `Content-Type`, even if the path has no extension
|
|
246
|
+
|
|
124
247
|
## Push Notification Redirection and Actions
|
|
125
248
|
|
|
126
249
|
Push notification redirection and actions are optional and can be used to redirect the user to a specific URL when they tap the notification or to trigger a specific action when they long-press the notification.
|
|
@@ -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
|
|
@@ -20,7 +20,7 @@ module OpenapiClient
|
|
|
20
20
|
@api_client = api_client
|
|
21
21
|
end
|
|
22
22
|
# Send a push notification
|
|
23
|
-
# Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL
|
|
23
|
+
# Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`.
|
|
24
24
|
# @param push_notification_request [PushNotificationRequest]
|
|
25
25
|
# @param [Hash] opts the optional parameters
|
|
26
26
|
# @return [PushNotificationResponse]
|
|
@@ -30,7 +30,7 @@ module OpenapiClient
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
# Send a push notification
|
|
33
|
-
# Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL
|
|
33
|
+
# Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`.
|
|
34
34
|
# @param push_notification_request [PushNotificationRequest]
|
|
35
35
|
# @param [Hash] opts the optional parameters
|
|
36
36
|
# @return [Array<(PushNotificationResponse, Integer, Hash)>] PushNotificationResponse 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.
|
|
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
|
-
|
|
127
|
-
|
|
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
|
|
161
|
-
invalid_properties.push('invalid value for "current_step",
|
|
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 @
|
|
165
|
-
invalid_properties.push('invalid value for "
|
|
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
|
|
182
|
-
return false if @
|
|
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
|
|
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
|
-
|
|
128
|
-
|
|
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
|
|
158
|
-
invalid_properties.push('invalid value for "number_of_steps",
|
|
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 @
|
|
162
|
-
invalid_properties.push('invalid value for "
|
|
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
|
|
166
|
-
invalid_properties.push('invalid value for "
|
|
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 @
|
|
170
|
-
invalid_properties.push('invalid value for "
|
|
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
|
|
186
|
-
return false if @
|
|
187
|
-
return false if
|
|
188
|
-
return false if @
|
|
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.
|
|
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
|
-
|
|
122
|
-
|
|
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
|
|
150
|
-
invalid_properties.push('invalid value for "current_step",
|
|
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 @
|
|
154
|
-
invalid_properties.push('invalid value for "
|
|
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
|
|
167
|
-
return false if @
|
|
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
|
|
@@ -21,10 +21,13 @@ module OpenapiClient
|
|
|
21
21
|
|
|
22
22
|
attr_accessor :subtitle
|
|
23
23
|
|
|
24
|
-
# Optional HTTPS URL
|
|
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
|
+
attr_accessor :media
|
|
26
|
+
|
|
27
|
+
# Optional HTTPS URL opened when user taps the notification body. Overrides the default tap target from `media` when both are provided.
|
|
25
28
|
attr_accessor :redirection
|
|
26
29
|
|
|
27
|
-
# Optional interactive actions shown
|
|
30
|
+
# Optional interactive actions shown when users expand the notification. Cannot be combined with `media`.
|
|
28
31
|
attr_accessor :actions
|
|
29
32
|
|
|
30
33
|
attr_accessor :payload
|
|
@@ -41,6 +44,7 @@ module OpenapiClient
|
|
|
41
44
|
:'title' => :'title',
|
|
42
45
|
:'message' => :'message',
|
|
43
46
|
:'subtitle' => :'subtitle',
|
|
47
|
+
:'media' => :'media',
|
|
44
48
|
:'redirection' => :'redirection',
|
|
45
49
|
:'actions' => :'actions',
|
|
46
50
|
:'payload' => :'payload',
|
|
@@ -61,6 +65,7 @@ module OpenapiClient
|
|
|
61
65
|
:'title' => :'String',
|
|
62
66
|
:'message' => :'String',
|
|
63
67
|
:'subtitle' => :'String',
|
|
68
|
+
:'media' => :'String',
|
|
64
69
|
:'redirection' => :'String',
|
|
65
70
|
:'actions' => :'Array<PushNotificationAction>',
|
|
66
71
|
:'payload' => :'Hash<String, Object>',
|
|
@@ -105,6 +110,10 @@ module OpenapiClient
|
|
|
105
110
|
self.subtitle = attributes[:'subtitle']
|
|
106
111
|
end
|
|
107
112
|
|
|
113
|
+
if attributes.key?(:'media')
|
|
114
|
+
self.media = attributes[:'media']
|
|
115
|
+
end
|
|
116
|
+
|
|
108
117
|
if attributes.key?(:'redirection')
|
|
109
118
|
self.redirection = attributes[:'redirection']
|
|
110
119
|
end
|
|
@@ -143,6 +152,11 @@ module OpenapiClient
|
|
|
143
152
|
invalid_properties.push('invalid value for "title", title cannot be nil.')
|
|
144
153
|
end
|
|
145
154
|
|
|
155
|
+
pattern = Regexp.new(/^https:\/\//)
|
|
156
|
+
if !@media.nil? && @media !~ pattern
|
|
157
|
+
invalid_properties.push("invalid value for \"media\", must conform to the pattern #{pattern}.")
|
|
158
|
+
end
|
|
159
|
+
|
|
146
160
|
pattern = Regexp.new(/^https:\/\//)
|
|
147
161
|
if !@redirection.nil? && @redirection !~ pattern
|
|
148
162
|
invalid_properties.push("invalid value for \"redirection\", must conform to the pattern #{pattern}.")
|
|
@@ -160,11 +174,27 @@ module OpenapiClient
|
|
|
160
174
|
def valid?
|
|
161
175
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
162
176
|
return false if @title.nil?
|
|
177
|
+
return false if !@media.nil? && @media !~ Regexp.new(/^https:\/\//)
|
|
163
178
|
return false if !@redirection.nil? && @redirection !~ Regexp.new(/^https:\/\//)
|
|
164
179
|
return false if !@actions.nil? && @actions.length > 4
|
|
165
180
|
true
|
|
166
181
|
end
|
|
167
182
|
|
|
183
|
+
# Custom attribute writer method with validation
|
|
184
|
+
# @param [Object] media Value to be assigned
|
|
185
|
+
def media=(media)
|
|
186
|
+
if media.nil?
|
|
187
|
+
fail ArgumentError, 'media cannot be nil'
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
pattern = Regexp.new(/^https:\/\//)
|
|
191
|
+
if media !~ pattern
|
|
192
|
+
fail ArgumentError, "invalid value for \"media\", must conform to the pattern #{pattern}."
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
@media = media
|
|
196
|
+
end
|
|
197
|
+
|
|
168
198
|
# Custom attribute writer method with validation
|
|
169
199
|
# @param [Object] redirection Value to be assigned
|
|
170
200
|
def redirection=(redirection)
|
|
@@ -202,6 +232,7 @@ module OpenapiClient
|
|
|
202
232
|
title == o.title &&
|
|
203
233
|
message == o.message &&
|
|
204
234
|
subtitle == o.subtitle &&
|
|
235
|
+
media == o.media &&
|
|
205
236
|
redirection == o.redirection &&
|
|
206
237
|
actions == o.actions &&
|
|
207
238
|
payload == o.payload &&
|
|
@@ -219,7 +250,7 @@ module OpenapiClient
|
|
|
219
250
|
# Calculates hash code according to all attributes.
|
|
220
251
|
# @return [Integer] Hash code
|
|
221
252
|
def hash
|
|
222
|
-
[title, message, subtitle, redirection, actions, payload, badge, sound, target].hash
|
|
253
|
+
[title, message, subtitle, media, redirection, actions, payload, badge, sound, target].hash
|
|
223
254
|
end
|
|
224
255
|
|
|
225
256
|
# Builds the object from hash
|
data/lib/activitysmith/client.rb
CHANGED
|
@@ -11,6 +11,7 @@ module ActivitySmith
|
|
|
11
11
|
|
|
12
12
|
config = OpenapiClient::Configuration.new
|
|
13
13
|
config.access_token = api_key
|
|
14
|
+
config.user_agent = VersionedUserAgent.value if config.respond_to?(:user_agent=)
|
|
14
15
|
|
|
15
16
|
api_client = OpenapiClient::ApiClient.new(config)
|
|
16
17
|
@notifications = Notifications.new(OpenapiClient::PushNotificationsApi.new(api_client))
|
|
@@ -7,12 +7,16 @@ module ActivitySmith
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def send(request, opts = {})
|
|
10
|
-
|
|
10
|
+
normalized = normalize_channels_target(request)
|
|
11
|
+
assert_valid_media_actions!(normalized)
|
|
12
|
+
@api.send_push_notification(normalized, opts)
|
|
11
13
|
end
|
|
12
14
|
|
|
13
15
|
# Backward-compatible alias.
|
|
14
16
|
def send_push_notification(push_notification_request, opts = {})
|
|
15
|
-
|
|
17
|
+
normalized = normalize_channels_target(push_notification_request)
|
|
18
|
+
assert_valid_media_actions!(normalized)
|
|
19
|
+
@api.send_push_notification(normalized, opts)
|
|
16
20
|
end
|
|
17
21
|
|
|
18
22
|
def method_missing(name, *args, &block)
|
|
@@ -49,5 +53,29 @@ module ActivitySmith
|
|
|
49
53
|
[]
|
|
50
54
|
end
|
|
51
55
|
end
|
|
56
|
+
|
|
57
|
+
def assert_valid_media_actions!(request)
|
|
58
|
+
media = request_value(request, :media)
|
|
59
|
+
actions = request_value(request, :actions)
|
|
60
|
+
has_media = media.is_a?(String) ? !media.strip.empty? : !media.nil?
|
|
61
|
+
has_actions = actions.respond_to?(:empty?) ? !actions.empty? : !actions.nil?
|
|
62
|
+
|
|
63
|
+
return unless has_media && has_actions
|
|
64
|
+
|
|
65
|
+
raise ArgumentError, "ActivitySmith: media cannot be combined with actions"
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def request_value(request, key)
|
|
69
|
+
if request.is_a?(Hash)
|
|
70
|
+
return request[key] if request.key?(key)
|
|
71
|
+
return request[key.to_s] if request.key?(key.to_s)
|
|
72
|
+
|
|
73
|
+
return nil
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
return request.public_send(key) if request.respond_to?(key)
|
|
77
|
+
|
|
78
|
+
nil
|
|
79
|
+
end
|
|
52
80
|
end
|
|
53
81
|
end
|
data/lib/activitysmith.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "activitysmith/version"
|
|
4
|
+
require_relative "activitysmith/versioned_user_agent"
|
|
4
5
|
require_relative "activitysmith/notifications"
|
|
5
6
|
require_relative "activitysmith/live_activities"
|
|
6
7
|
require_relative "activitysmith/client"
|
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.
|
|
4
|
+
version: 0.1.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ActivitySmith
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-03-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: json
|
|
@@ -109,6 +109,7 @@ files:
|
|
|
109
109
|
- lib/activitysmith/live_activities.rb
|
|
110
110
|
- lib/activitysmith/notifications.rb
|
|
111
111
|
- lib/activitysmith/version.rb
|
|
112
|
+
- lib/activitysmith/versioned_user_agent.rb
|
|
112
113
|
homepage: https://activitysmith.com/docs/sdks/ruby
|
|
113
114
|
licenses:
|
|
114
115
|
- MIT
|