activitysmith 0.1.1

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.
Files changed (30) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +116 -0
  4. data/generated/activitysmith_openapi/api/live_activities_api.rb +226 -0
  5. data/generated/activitysmith_openapi/api/push_notifications_api.rb +90 -0
  6. data/generated/activitysmith_openapi/api_client.rb +394 -0
  7. data/generated/activitysmith_openapi/api_error.rb +58 -0
  8. data/generated/activitysmith_openapi/configuration.rb +309 -0
  9. data/generated/activitysmith_openapi/models/content_state_end.rb +393 -0
  10. data/generated/activitysmith_openapi/models/content_state_start.rb +397 -0
  11. data/generated/activitysmith_openapi/models/content_state_update.rb +362 -0
  12. data/generated/activitysmith_openapi/models/live_activity_end_request.rb +237 -0
  13. data/generated/activitysmith_openapi/models/live_activity_end_response.rb +271 -0
  14. data/generated/activitysmith_openapi/models/live_activity_limit_error.rb +270 -0
  15. data/generated/activitysmith_openapi/models/live_activity_start_request.rb +221 -0
  16. data/generated/activitysmith_openapi/models/live_activity_start_response.rb +271 -0
  17. data/generated/activitysmith_openapi/models/live_activity_update_request.rb +237 -0
  18. data/generated/activitysmith_openapi/models/live_activity_update_response.rb +271 -0
  19. data/generated/activitysmith_openapi/models/push_notification_request.rb +239 -0
  20. data/generated/activitysmith_openapi/models/push_notification_response.rb +255 -0
  21. data/generated/activitysmith_openapi/models/rate_limit_error.rb +237 -0
  22. data/generated/activitysmith_openapi/models/send_push_notification429_response.rb +105 -0
  23. data/generated/activitysmith_openapi/version.rb +15 -0
  24. data/generated/activitysmith_openapi.rb +55 -0
  25. data/lib/activitysmith/client.rb +47 -0
  26. data/lib/activitysmith/live_activities.rb +44 -0
  27. data/lib/activitysmith/notifications.rb +28 -0
  28. data/lib/activitysmith/version.rb +5 -0
  29. data/lib/activitysmith.rb +6 -0
  30. metadata +129 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 24b950498feeab02ee3010ff54e2dd9146459f1e33d213eedead7adf4a9fefe4
4
+ data.tar.gz: a69fc0f24e473e7166275b5513eaed670b074cca3f3228458888cf6a025f3040
5
+ SHA512:
6
+ metadata.gz: a0185af8b6b7addc83df57e83de2996df14c1f4f0f2602d9fc4ab4e9115b787494f4034f99be0286a2546aea7d39d9bf129490632db341a805ec9d2f4819bab7
7
+ data.tar.gz: dc7cc4627d1247a9027b581c261e54401b1683247bb1bd1f5416f4ea3c172135445b0d72a95284a249715b1cc035b39a466f96488ca345c98d0ce7eb22e73516
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ActivitySmith
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,116 @@
1
+ # ActivitySmith Ruby SDK
2
+
3
+ The ActivitySmith Ruby SDK provides convenient access to the ActivitySmith API from Ruby applications.
4
+
5
+ ## Documentation
6
+
7
+ See [API reference](https://activitysmith.com/docs/api-reference/introduction).
8
+
9
+ ## Installation
10
+
11
+ ```sh
12
+ gem install activitysmith
13
+ ```
14
+
15
+ ## Setup
16
+
17
+ ```ruby
18
+ require "activitysmith"
19
+
20
+ activitysmith = ActivitySmith::Client.new(api_key: ENV.fetch("ACTIVITYSMITH_API_KEY"))
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ### Send a Push Notification
26
+
27
+ ```ruby
28
+ response = activitysmith.notifications.send(
29
+ {
30
+ title: "Build Failed",
31
+ message: "CI pipeline failed on main branch"
32
+ }
33
+ )
34
+
35
+ puts response.success
36
+ puts response.devices_notified
37
+ ```
38
+
39
+ ### Start a Live Activity
40
+
41
+ ```ruby
42
+ start = activitysmith.live_activities.start(
43
+ {
44
+ content_state: {
45
+ title: "ActivitySmith API Deployment",
46
+ subtitle: "start",
47
+ number_of_steps: 4,
48
+ current_step: 1,
49
+ type: "segmented_progress",
50
+ color: "yellow"
51
+ }
52
+ }
53
+ )
54
+
55
+ activity_id = start.activity_id
56
+ ```
57
+
58
+ ### Update a Live Activity
59
+
60
+ ```ruby
61
+ update = activitysmith.live_activities.update(
62
+ {
63
+ activity_id: activity_id,
64
+ content_state: {
65
+ title: "ActivitySmith API Deployment",
66
+ subtitle: "npm i & pm2",
67
+ current_step: 3
68
+ }
69
+ }
70
+ )
71
+
72
+ puts update.devices_notified
73
+ ```
74
+
75
+ ### End a Live Activity
76
+
77
+ ```ruby
78
+ finish = activitysmith.live_activities.end(
79
+ {
80
+ activity_id: activity_id,
81
+ content_state: {
82
+ title: "ActivitySmith API Deployment",
83
+ subtitle: "done",
84
+ current_step: 4,
85
+ auto_dismiss_minutes: 3
86
+ }
87
+ }
88
+ )
89
+
90
+ puts finish.success
91
+ ```
92
+
93
+ ## Error Handling
94
+
95
+ ```ruby
96
+ begin
97
+ activitysmith.notifications.send(
98
+ { title: "Build Failed" }
99
+ )
100
+ rescue OpenapiClient::ApiError => err
101
+ puts "Request failed: #{err.code} #{err.message}"
102
+ end
103
+ ```
104
+
105
+ ## API Surface
106
+
107
+ - `activitysmith.notifications`
108
+ - `activitysmith.live_activities`
109
+
110
+ ## Requirements
111
+
112
+ - Ruby 3.0+
113
+
114
+ ## License
115
+
116
+ MIT
@@ -0,0 +1,226 @@
1
+ =begin
2
+ #ActivitySmith API
3
+
4
+ #Send push notifications and Live Activities to your own devices via a single API key.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.7.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module OpenapiClient
16
+ class LiveActivitiesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # End a Live Activity
23
+ # Ends a Live Activity and archives its lifecycle.
24
+ # @param live_activity_end_request [LiveActivityEndRequest]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [LiveActivityEndResponse]
27
+ def end_live_activity(live_activity_end_request, opts = {})
28
+ data, _status_code, _headers = end_live_activity_with_http_info(live_activity_end_request, opts)
29
+ data
30
+ end
31
+
32
+ # End a Live Activity
33
+ # Ends a Live Activity and archives its lifecycle.
34
+ # @param live_activity_end_request [LiveActivityEndRequest]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(LiveActivityEndResponse, Integer, Hash)>] LiveActivityEndResponse data, response status code and response headers
37
+ def end_live_activity_with_http_info(live_activity_end_request, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: LiveActivitiesApi.end_live_activity ...'
40
+ end
41
+ # verify the required parameter 'live_activity_end_request' is set
42
+ if @api_client.config.client_side_validation && live_activity_end_request.nil?
43
+ fail ArgumentError, "Missing the required parameter 'live_activity_end_request' when calling LiveActivitiesApi.end_live_activity"
44
+ end
45
+ # resource path
46
+ local_var_path = '/live-activity/end'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
55
+ # HTTP header 'Content-Type'
56
+ content_type = @api_client.select_header_content_type(['application/json'])
57
+ if !content_type.nil?
58
+ header_params['Content-Type'] = content_type
59
+ end
60
+
61
+ # form parameters
62
+ form_params = opts[:form_params] || {}
63
+
64
+ # http body (model)
65
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(live_activity_end_request)
66
+
67
+ # return_type
68
+ return_type = opts[:debug_return_type] || 'LiveActivityEndResponse'
69
+
70
+ # auth_names
71
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
72
+
73
+ new_options = opts.merge(
74
+ :operation => :"LiveActivitiesApi.end_live_activity",
75
+ :header_params => header_params,
76
+ :query_params => query_params,
77
+ :form_params => form_params,
78
+ :body => post_body,
79
+ :auth_names => auth_names,
80
+ :return_type => return_type
81
+ )
82
+
83
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
84
+ if @api_client.config.debugging
85
+ @api_client.config.logger.debug "API called: LiveActivitiesApi#end_live_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
+ end
87
+ return data, status_code, headers
88
+ end
89
+
90
+ # Start a Live Activity
91
+ # Starts a Live Activity on all registered devices and returns an activity_id.
92
+ # @param live_activity_start_request [LiveActivityStartRequest]
93
+ # @param [Hash] opts the optional parameters
94
+ # @return [LiveActivityStartResponse]
95
+ def start_live_activity(live_activity_start_request, opts = {})
96
+ data, _status_code, _headers = start_live_activity_with_http_info(live_activity_start_request, opts)
97
+ data
98
+ end
99
+
100
+ # Start a Live Activity
101
+ # Starts a Live Activity on all registered devices and returns an activity_id.
102
+ # @param live_activity_start_request [LiveActivityStartRequest]
103
+ # @param [Hash] opts the optional parameters
104
+ # @return [Array<(LiveActivityStartResponse, Integer, Hash)>] LiveActivityStartResponse data, response status code and response headers
105
+ def start_live_activity_with_http_info(live_activity_start_request, opts = {})
106
+ if @api_client.config.debugging
107
+ @api_client.config.logger.debug 'Calling API: LiveActivitiesApi.start_live_activity ...'
108
+ end
109
+ # verify the required parameter 'live_activity_start_request' is set
110
+ if @api_client.config.client_side_validation && live_activity_start_request.nil?
111
+ fail ArgumentError, "Missing the required parameter 'live_activity_start_request' when calling LiveActivitiesApi.start_live_activity"
112
+ end
113
+ # resource path
114
+ local_var_path = '/live-activity/start'
115
+
116
+ # query parameters
117
+ query_params = opts[:query_params] || {}
118
+
119
+ # header parameters
120
+ header_params = opts[:header_params] || {}
121
+ # HTTP header 'Accept' (if needed)
122
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
123
+ # HTTP header 'Content-Type'
124
+ content_type = @api_client.select_header_content_type(['application/json'])
125
+ if !content_type.nil?
126
+ header_params['Content-Type'] = content_type
127
+ end
128
+
129
+ # form parameters
130
+ form_params = opts[:form_params] || {}
131
+
132
+ # http body (model)
133
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(live_activity_start_request)
134
+
135
+ # return_type
136
+ return_type = opts[:debug_return_type] || 'LiveActivityStartResponse'
137
+
138
+ # auth_names
139
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
140
+
141
+ new_options = opts.merge(
142
+ :operation => :"LiveActivitiesApi.start_live_activity",
143
+ :header_params => header_params,
144
+ :query_params => query_params,
145
+ :form_params => form_params,
146
+ :body => post_body,
147
+ :auth_names => auth_names,
148
+ :return_type => return_type
149
+ )
150
+
151
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
152
+ if @api_client.config.debugging
153
+ @api_client.config.logger.debug "API called: LiveActivitiesApi#start_live_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
154
+ end
155
+ return data, status_code, headers
156
+ end
157
+
158
+ # Update a Live Activity
159
+ # Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued.
160
+ # @param live_activity_update_request [LiveActivityUpdateRequest]
161
+ # @param [Hash] opts the optional parameters
162
+ # @return [LiveActivityUpdateResponse]
163
+ def update_live_activity(live_activity_update_request, opts = {})
164
+ data, _status_code, _headers = update_live_activity_with_http_info(live_activity_update_request, opts)
165
+ data
166
+ end
167
+
168
+ # Update a Live Activity
169
+ # Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued.
170
+ # @param live_activity_update_request [LiveActivityUpdateRequest]
171
+ # @param [Hash] opts the optional parameters
172
+ # @return [Array<(LiveActivityUpdateResponse, Integer, Hash)>] LiveActivityUpdateResponse data, response status code and response headers
173
+ def update_live_activity_with_http_info(live_activity_update_request, opts = {})
174
+ if @api_client.config.debugging
175
+ @api_client.config.logger.debug 'Calling API: LiveActivitiesApi.update_live_activity ...'
176
+ end
177
+ # verify the required parameter 'live_activity_update_request' is set
178
+ if @api_client.config.client_side_validation && live_activity_update_request.nil?
179
+ fail ArgumentError, "Missing the required parameter 'live_activity_update_request' when calling LiveActivitiesApi.update_live_activity"
180
+ end
181
+ # resource path
182
+ local_var_path = '/live-activity/update'
183
+
184
+ # query parameters
185
+ query_params = opts[:query_params] || {}
186
+
187
+ # header parameters
188
+ header_params = opts[:header_params] || {}
189
+ # HTTP header 'Accept' (if needed)
190
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
191
+ # HTTP header 'Content-Type'
192
+ content_type = @api_client.select_header_content_type(['application/json'])
193
+ if !content_type.nil?
194
+ header_params['Content-Type'] = content_type
195
+ end
196
+
197
+ # form parameters
198
+ form_params = opts[:form_params] || {}
199
+
200
+ # http body (model)
201
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(live_activity_update_request)
202
+
203
+ # return_type
204
+ return_type = opts[:debug_return_type] || 'LiveActivityUpdateResponse'
205
+
206
+ # auth_names
207
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
208
+
209
+ new_options = opts.merge(
210
+ :operation => :"LiveActivitiesApi.update_live_activity",
211
+ :header_params => header_params,
212
+ :query_params => query_params,
213
+ :form_params => form_params,
214
+ :body => post_body,
215
+ :auth_names => auth_names,
216
+ :return_type => return_type
217
+ )
218
+
219
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
220
+ if @api_client.config.debugging
221
+ @api_client.config.logger.debug "API called: LiveActivitiesApi#update_live_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
222
+ end
223
+ return data, status_code, headers
224
+ end
225
+ end
226
+ end
@@ -0,0 +1,90 @@
1
+ =begin
2
+ #ActivitySmith API
3
+
4
+ #Send push notifications and Live Activities to your own devices via a single API key.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.7.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module OpenapiClient
16
+ class PushNotificationsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Send a push notification
23
+ # Sends a push notification to every paired device in your account.
24
+ # @param push_notification_request [PushNotificationRequest]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [PushNotificationResponse]
27
+ def send_push_notification(push_notification_request, opts = {})
28
+ data, _status_code, _headers = send_push_notification_with_http_info(push_notification_request, opts)
29
+ data
30
+ end
31
+
32
+ # Send a push notification
33
+ # Sends a push notification to every paired device in your account.
34
+ # @param push_notification_request [PushNotificationRequest]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(PushNotificationResponse, Integer, Hash)>] PushNotificationResponse data, response status code and response headers
37
+ def send_push_notification_with_http_info(push_notification_request, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: PushNotificationsApi.send_push_notification ...'
40
+ end
41
+ # verify the required parameter 'push_notification_request' is set
42
+ if @api_client.config.client_side_validation && push_notification_request.nil?
43
+ fail ArgumentError, "Missing the required parameter 'push_notification_request' when calling PushNotificationsApi.send_push_notification"
44
+ end
45
+ # resource path
46
+ local_var_path = '/push-notification'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
55
+ # HTTP header 'Content-Type'
56
+ content_type = @api_client.select_header_content_type(['application/json'])
57
+ if !content_type.nil?
58
+ header_params['Content-Type'] = content_type
59
+ end
60
+
61
+ # form parameters
62
+ form_params = opts[:form_params] || {}
63
+
64
+ # http body (model)
65
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(push_notification_request)
66
+
67
+ # return_type
68
+ return_type = opts[:debug_return_type] || 'PushNotificationResponse'
69
+
70
+ # auth_names
71
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
72
+
73
+ new_options = opts.merge(
74
+ :operation => :"PushNotificationsApi.send_push_notification",
75
+ :header_params => header_params,
76
+ :query_params => query_params,
77
+ :form_params => form_params,
78
+ :body => post_body,
79
+ :auth_names => auth_names,
80
+ :return_type => return_type
81
+ )
82
+
83
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
84
+ if @api_client.config.debugging
85
+ @api_client.config.logger.debug "API called: PushNotificationsApi#send_push_notification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
+ end
87
+ return data, status_code, headers
88
+ end
89
+ end
90
+ end