activitysmith 1.3.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +103 -1
- data/generated/activitysmith_openapi/api/live_activities_api.rb +6 -6
- data/generated/activitysmith_openapi/models/activity_metric.rb +2 -2
- data/generated/activitysmith_openapi/models/content_state_end.rb +64 -17
- data/generated/activitysmith_openapi/models/content_state_start.rb +64 -17
- data/generated/activitysmith_openapi/models/content_state_update.rb +64 -17
- data/generated/activitysmith_openapi/models/live_activity_action.rb +19 -43
- data/generated/activitysmith_openapi/models/live_activity_alert_badge.rb +273 -0
- data/generated/activitysmith_openapi/models/live_activity_alert_icon.rb +274 -0
- data/generated/activitysmith_openapi/models/live_activity_color.rb +48 -0
- data/generated/activitysmith_openapi/models/push_notification_action.rb +19 -43
- data/generated/activitysmith_openapi/models/push_notification_request.rb +4 -4
- data/generated/activitysmith_openapi/models/stream_content_state.rb +64 -17
- data/generated/activitysmith_openapi/version.rb +1 -1
- data/generated/activitysmith_openapi.rb +3 -0
- data/lib/activitysmith/live_activities.rb +57 -10
- data/lib/activitysmith/version.rb +1 -1
- metadata +5 -2
|
@@ -28,6 +28,9 @@ require 'activitysmith_openapi/models/content_state_update'
|
|
|
28
28
|
require 'activitysmith_openapi/models/forbidden_error'
|
|
29
29
|
require 'activitysmith_openapi/models/live_activity_action'
|
|
30
30
|
require 'activitysmith_openapi/models/live_activity_action_type'
|
|
31
|
+
require 'activitysmith_openapi/models/live_activity_alert_badge'
|
|
32
|
+
require 'activitysmith_openapi/models/live_activity_alert_icon'
|
|
33
|
+
require 'activitysmith_openapi/models/live_activity_color'
|
|
31
34
|
require 'activitysmith_openapi/models/live_activity_end_request'
|
|
32
35
|
require 'activitysmith_openapi/models/live_activity_end_response'
|
|
33
36
|
require 'activitysmith_openapi/models/live_activity_limit_error'
|
|
@@ -6,52 +6,92 @@ module ActivitySmith
|
|
|
6
6
|
TYPE_PROGRESS = "progress"
|
|
7
7
|
TYPE_METRICS = "metrics"
|
|
8
8
|
TYPE_STATS = "stats"
|
|
9
|
+
TYPE_ALERT = "alert"
|
|
10
|
+
|
|
11
|
+
class << self
|
|
12
|
+
def content_state(title:, type: nil, subtitle: nil, message: nil, icon: nil, badge: nil, color: nil, **fields)
|
|
13
|
+
{
|
|
14
|
+
title: title,
|
|
15
|
+
type: type,
|
|
16
|
+
subtitle: subtitle,
|
|
17
|
+
message: message,
|
|
18
|
+
icon: icon,
|
|
19
|
+
badge: badge,
|
|
20
|
+
color: color
|
|
21
|
+
}.merge(fields).compact
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def alert_icon(symbol, color: nil)
|
|
25
|
+
{ symbol: symbol, color: color }.compact
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def alert_badge(title, color: nil)
|
|
29
|
+
{ title: title, color: color }.compact
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
|
9
33
|
|
|
10
34
|
def initialize(api)
|
|
11
35
|
@api = api
|
|
12
36
|
end
|
|
13
37
|
|
|
14
38
|
def start(request, opts = {})
|
|
15
|
-
@api.start_live_activity(normalize_channels_target(request), opts)
|
|
39
|
+
@api.start_live_activity(normalize_live_activity_request(normalize_channels_target(request)), opts)
|
|
16
40
|
end
|
|
17
41
|
|
|
18
42
|
def update(request, opts = {})
|
|
19
|
-
@api.update_live_activity(request, opts)
|
|
43
|
+
@api.update_live_activity(normalize_live_activity_request(request), opts)
|
|
20
44
|
end
|
|
21
45
|
|
|
22
46
|
def end(request, opts = {})
|
|
23
|
-
@api.end_live_activity(request, opts)
|
|
47
|
+
@api.end_live_activity(normalize_live_activity_request(request), opts)
|
|
24
48
|
end
|
|
25
49
|
|
|
26
50
|
def stream(stream_key, request, opts = {})
|
|
27
|
-
@api.reconcile_live_activity_stream(
|
|
51
|
+
@api.reconcile_live_activity_stream(
|
|
52
|
+
stream_key,
|
|
53
|
+
normalize_live_activity_request(normalize_channels_target(request)),
|
|
54
|
+
opts
|
|
55
|
+
)
|
|
28
56
|
end
|
|
29
57
|
|
|
30
58
|
def end_stream(stream_key, request = nil, opts = {})
|
|
31
|
-
@api.end_live_activity_stream(
|
|
59
|
+
@api.end_live_activity_stream(
|
|
60
|
+
stream_key,
|
|
61
|
+
{ live_activity_stream_delete_request: normalize_live_activity_request(request) }.merge(opts)
|
|
62
|
+
)
|
|
32
63
|
end
|
|
33
64
|
|
|
34
65
|
# Backward-compatible aliases.
|
|
35
66
|
def start_live_activity(live_activity_start_request, opts = {})
|
|
36
|
-
@api.start_live_activity(
|
|
67
|
+
@api.start_live_activity(
|
|
68
|
+
normalize_live_activity_request(normalize_channels_target(live_activity_start_request)),
|
|
69
|
+
opts
|
|
70
|
+
)
|
|
37
71
|
end
|
|
38
72
|
|
|
39
73
|
def update_live_activity(live_activity_update_request, opts = {})
|
|
40
|
-
@api.update_live_activity(live_activity_update_request, opts)
|
|
74
|
+
@api.update_live_activity(normalize_live_activity_request(live_activity_update_request), opts)
|
|
41
75
|
end
|
|
42
76
|
|
|
43
77
|
def end_live_activity(live_activity_end_request, opts = {})
|
|
44
|
-
@api.end_live_activity(live_activity_end_request, opts)
|
|
78
|
+
@api.end_live_activity(normalize_live_activity_request(live_activity_end_request), opts)
|
|
45
79
|
end
|
|
46
80
|
|
|
47
81
|
def reconcile_live_activity_stream(stream_key, live_activity_stream_request, opts = {})
|
|
48
|
-
@api.reconcile_live_activity_stream(
|
|
82
|
+
@api.reconcile_live_activity_stream(
|
|
83
|
+
stream_key,
|
|
84
|
+
normalize_live_activity_request(normalize_channels_target(live_activity_stream_request)),
|
|
85
|
+
opts
|
|
86
|
+
)
|
|
49
87
|
end
|
|
50
88
|
|
|
51
89
|
def end_live_activity_stream(stream_key, live_activity_stream_delete_request = nil, opts = {})
|
|
52
90
|
@api.end_live_activity_stream(
|
|
53
91
|
stream_key,
|
|
54
|
-
{
|
|
92
|
+
{
|
|
93
|
+
live_activity_stream_delete_request: normalize_live_activity_request(live_activity_stream_delete_request)
|
|
94
|
+
}.merge(opts)
|
|
55
95
|
)
|
|
56
96
|
end
|
|
57
97
|
|
|
@@ -67,6 +107,13 @@ module ActivitySmith
|
|
|
67
107
|
|
|
68
108
|
private
|
|
69
109
|
|
|
110
|
+
def normalize_live_activity_request(request)
|
|
111
|
+
return request unless request.is_a?(Hash)
|
|
112
|
+
|
|
113
|
+
hash = request.dup
|
|
114
|
+
hash
|
|
115
|
+
end
|
|
116
|
+
|
|
70
117
|
def normalize_channels_target(request)
|
|
71
118
|
return request unless request.is_a?(Hash)
|
|
72
119
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activitysmith
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ActivitySmith
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-06-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: json
|
|
@@ -93,6 +93,9 @@ files:
|
|
|
93
93
|
- generated/activitysmith_openapi/models/forbidden_error.rb
|
|
94
94
|
- generated/activitysmith_openapi/models/live_activity_action.rb
|
|
95
95
|
- generated/activitysmith_openapi/models/live_activity_action_type.rb
|
|
96
|
+
- generated/activitysmith_openapi/models/live_activity_alert_badge.rb
|
|
97
|
+
- generated/activitysmith_openapi/models/live_activity_alert_icon.rb
|
|
98
|
+
- generated/activitysmith_openapi/models/live_activity_color.rb
|
|
96
99
|
- generated/activitysmith_openapi/models/live_activity_end_request.rb
|
|
97
100
|
- generated/activitysmith_openapi/models/live_activity_end_response.rb
|
|
98
101
|
- generated/activitysmith_openapi/models/live_activity_limit_error.rb
|