activitysmith 0.1.3 → 0.1.5
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 +63 -7
- data/generated/activitysmith_openapi/api/push_notifications_api.rb +2 -2
- data/generated/activitysmith_openapi/models/push_notification_action.rb +322 -0
- data/generated/activitysmith_openapi/models/push_notification_action_type.rb +40 -0
- data/generated/activitysmith_openapi/models/push_notification_request.rb +63 -1
- data/generated/activitysmith_openapi/models/push_notification_webhook_method.rb +40 -0
- data/generated/activitysmith_openapi.rb +3 -0
- data/lib/activitysmith/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0d8716c7c9794439454c8ed5a182522c0a0eb32449d198dadea37652609f4469
|
|
4
|
+
data.tar.gz: 6b84b2f13f5930404ea1fdf8fa8adc73082aa9b3b6d2564dd119819e5f0c0c3d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cad0ad010c8285ef38626df955773b4988a307736e95f399473a2d516ff39ecfce39849e81817a5e5ebfcd5150b668fbd3489869a6dbec7ffb5ae34190c1b5ea
|
|
7
|
+
data.tar.gz: 0d502d03eb228e205234bec172022c65e87ba6375072152baef435eed94091a05382d7c0eb479315214685ebb6d768c64ce843dfe8194f33fcf7ec7f9164a288
|
data/README.md
CHANGED
|
@@ -24,12 +24,15 @@ activitysmith = ActivitySmith::Client.new(api_key: ENV.fetch("ACTIVITYSMITH_API_
|
|
|
24
24
|
|
|
25
25
|
### Send a Push Notification
|
|
26
26
|
|
|
27
|
+
<p align="center">
|
|
28
|
+
<img src="https://cdn.activitysmith.com/features/new-subscription-push-notification.png" alt="Push notification example" width="680" />
|
|
29
|
+
</p>
|
|
30
|
+
|
|
27
31
|
```ruby
|
|
28
32
|
response = activitysmith.notifications.send(
|
|
29
33
|
{
|
|
30
34
|
title: "New subscription 💸",
|
|
31
|
-
message: "Customer upgraded to Pro plan"
|
|
32
|
-
channels: ["devs", "ops"] # Optional
|
|
35
|
+
message: "Customer upgraded to Pro plan"
|
|
33
36
|
}
|
|
34
37
|
)
|
|
35
38
|
|
|
@@ -39,6 +42,10 @@ puts response.devices_notified
|
|
|
39
42
|
|
|
40
43
|
### Start a Live Activity
|
|
41
44
|
|
|
45
|
+
<p align="center">
|
|
46
|
+
<img src="https://cdn.activitysmith.com/features/start-live-activity.png" alt="Start live activity example" width="680" />
|
|
47
|
+
</p>
|
|
48
|
+
|
|
42
49
|
```ruby
|
|
43
50
|
start = activitysmith.live_activities.start(
|
|
44
51
|
{
|
|
@@ -59,6 +66,10 @@ activity_id = start.activity_id
|
|
|
59
66
|
|
|
60
67
|
### Update a Live Activity
|
|
61
68
|
|
|
69
|
+
<p align="center">
|
|
70
|
+
<img src="https://cdn.activitysmith.com/features/update-live-activity.png" alt="Update live activity example" width="680" />
|
|
71
|
+
</p>
|
|
72
|
+
|
|
62
73
|
```ruby
|
|
63
74
|
update = activitysmith.live_activities.update(
|
|
64
75
|
{
|
|
@@ -76,6 +87,10 @@ puts update.devices_notified
|
|
|
76
87
|
|
|
77
88
|
### End a Live Activity
|
|
78
89
|
|
|
90
|
+
<p align="center">
|
|
91
|
+
<img src="https://cdn.activitysmith.com/features/end-live-activity.png" alt="End live activity example" width="680" />
|
|
92
|
+
</p>
|
|
93
|
+
|
|
79
94
|
```ruby
|
|
80
95
|
finish = activitysmith.live_activities.end(
|
|
81
96
|
{
|
|
@@ -92,6 +107,52 @@ finish = activitysmith.live_activities.end(
|
|
|
92
107
|
puts finish.success
|
|
93
108
|
```
|
|
94
109
|
|
|
110
|
+
## Channels
|
|
111
|
+
|
|
112
|
+
Channels are used to target specific team members or devices. Can be used for both push notifications and live activities.
|
|
113
|
+
|
|
114
|
+
```ruby
|
|
115
|
+
response = activitysmith.notifications.send(
|
|
116
|
+
{
|
|
117
|
+
title: "New subscription 💸",
|
|
118
|
+
message: "Customer upgraded to Pro plan",
|
|
119
|
+
channels: ["sales", "customer-success"] # Optional
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Push Notification Redirection and Actions
|
|
125
|
+
|
|
126
|
+
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.
|
|
127
|
+
Webhooks are executed by ActivitySmith backend.
|
|
128
|
+
|
|
129
|
+
```ruby
|
|
130
|
+
response = activitysmith.notifications.send(
|
|
131
|
+
{
|
|
132
|
+
title: "New subscription 💸",
|
|
133
|
+
message: "Customer upgraded to Pro plan",
|
|
134
|
+
redirection: "https://crm.example.com/customers/cus_9f3a1d", # Optional
|
|
135
|
+
actions: [ # Optional (max 4)
|
|
136
|
+
{
|
|
137
|
+
title: "Open CRM Profile",
|
|
138
|
+
type: "open_url",
|
|
139
|
+
url: "https://crm.example.com/customers/cus_9f3a1d"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
title: "Start Onboarding Workflow",
|
|
143
|
+
type: "webhook",
|
|
144
|
+
url: "https://hooks.example.com/activitysmith/onboarding/start",
|
|
145
|
+
method: "POST",
|
|
146
|
+
body: {
|
|
147
|
+
customer_id: "cus_9f3a1d",
|
|
148
|
+
plan: "pro"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
```
|
|
155
|
+
|
|
95
156
|
## Error Handling
|
|
96
157
|
|
|
97
158
|
```ruby
|
|
@@ -104,11 +165,6 @@ rescue OpenapiClient::ApiError => err
|
|
|
104
165
|
end
|
|
105
166
|
```
|
|
106
167
|
|
|
107
|
-
## API Surface
|
|
108
|
-
|
|
109
|
-
- `activitysmith.notifications`
|
|
110
|
-
- `activitysmith.live_activities`
|
|
111
|
-
|
|
112
168
|
## Requirements
|
|
113
169
|
|
|
114
170
|
- Ruby 3.0+
|
|
@@ -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.
|
|
23
|
+
# Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL (tap) and up to 4 interactive actions (long-press on iOS).
|
|
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.
|
|
33
|
+
# Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL (tap) and up to 4 interactive actions (long-press on iOS).
|
|
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
|
|
@@ -0,0 +1,322 @@
|
|
|
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 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module OpenapiClient
|
|
17
|
+
class PushNotificationAction
|
|
18
|
+
# Button title displayed in iOS expanded notification UI.
|
|
19
|
+
attr_accessor :title
|
|
20
|
+
|
|
21
|
+
attr_accessor :type
|
|
22
|
+
|
|
23
|
+
# HTTPS URL. For open_url it is opened in browser. For webhook it is called by ActivitySmith backend.
|
|
24
|
+
attr_accessor :url
|
|
25
|
+
|
|
26
|
+
# Webhook HTTP method. Used only when type=webhook.
|
|
27
|
+
attr_accessor :method
|
|
28
|
+
|
|
29
|
+
# Optional webhook payload body. Used only when type=webhook.
|
|
30
|
+
attr_accessor :body
|
|
31
|
+
|
|
32
|
+
class EnumAttributeValidator
|
|
33
|
+
attr_reader :datatype
|
|
34
|
+
attr_reader :allowable_values
|
|
35
|
+
|
|
36
|
+
def initialize(datatype, allowable_values)
|
|
37
|
+
@allowable_values = allowable_values.map do |value|
|
|
38
|
+
case datatype.to_s
|
|
39
|
+
when /Integer/i
|
|
40
|
+
value.to_i
|
|
41
|
+
when /Float/i
|
|
42
|
+
value.to_f
|
|
43
|
+
else
|
|
44
|
+
value
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def valid?(value)
|
|
50
|
+
!value || allowable_values.include?(value)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
55
|
+
def self.attribute_map
|
|
56
|
+
{
|
|
57
|
+
:'title' => :'title',
|
|
58
|
+
:'type' => :'type',
|
|
59
|
+
:'url' => :'url',
|
|
60
|
+
:'method' => :'method',
|
|
61
|
+
:'body' => :'body'
|
|
62
|
+
}
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Returns all the JSON keys this model knows about
|
|
66
|
+
def self.acceptable_attributes
|
|
67
|
+
attribute_map.values
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Attribute type mapping.
|
|
71
|
+
def self.openapi_types
|
|
72
|
+
{
|
|
73
|
+
:'title' => :'String',
|
|
74
|
+
:'type' => :'PushNotificationActionType',
|
|
75
|
+
:'url' => :'String',
|
|
76
|
+
:'method' => :'PushNotificationWebhookMethod',
|
|
77
|
+
:'body' => :'Hash<String, Object>'
|
|
78
|
+
}
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# List of attributes with nullable: true
|
|
82
|
+
def self.openapi_nullable
|
|
83
|
+
Set.new([
|
|
84
|
+
])
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Initializes the object
|
|
88
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
89
|
+
def initialize(attributes = {})
|
|
90
|
+
if (!attributes.is_a?(Hash))
|
|
91
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::PushNotificationAction` initialize method"
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
95
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
96
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
97
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::PushNotificationAction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
98
|
+
end
|
|
99
|
+
h[k.to_sym] = v
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if attributes.key?(:'title')
|
|
103
|
+
self.title = attributes[:'title']
|
|
104
|
+
else
|
|
105
|
+
self.title = nil
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
if attributes.key?(:'type')
|
|
109
|
+
self.type = attributes[:'type']
|
|
110
|
+
else
|
|
111
|
+
self.type = nil
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
if attributes.key?(:'url')
|
|
115
|
+
self.url = attributes[:'url']
|
|
116
|
+
else
|
|
117
|
+
self.url = nil
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
if attributes.key?(:'method')
|
|
121
|
+
self.method = attributes[:'method']
|
|
122
|
+
else
|
|
123
|
+
self.method = 'POST'
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
if attributes.key?(:'body')
|
|
127
|
+
if (value = attributes[:'body']).is_a?(Hash)
|
|
128
|
+
self.body = value
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
134
|
+
# @return Array for valid properties with the reasons
|
|
135
|
+
def list_invalid_properties
|
|
136
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
137
|
+
invalid_properties = Array.new
|
|
138
|
+
if @title.nil?
|
|
139
|
+
invalid_properties.push('invalid value for "title", title cannot be nil.')
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
if @type.nil?
|
|
143
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
if @url.nil?
|
|
147
|
+
invalid_properties.push('invalid value for "url", url cannot be nil.')
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
pattern = Regexp.new(/^https:\/\//)
|
|
151
|
+
if @url !~ pattern
|
|
152
|
+
invalid_properties.push("invalid value for \"url\", must conform to the pattern #{pattern}.")
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
invalid_properties
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
# Check to see if the all the properties in the model are valid
|
|
159
|
+
# @return true if the model is valid
|
|
160
|
+
def valid?
|
|
161
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
162
|
+
return false if @title.nil?
|
|
163
|
+
return false if @type.nil?
|
|
164
|
+
return false if @url.nil?
|
|
165
|
+
return false if @url !~ Regexp.new(/^https:\/\//)
|
|
166
|
+
true
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Custom attribute writer method with validation
|
|
170
|
+
# @param [Object] url Value to be assigned
|
|
171
|
+
def url=(url)
|
|
172
|
+
if url.nil?
|
|
173
|
+
fail ArgumentError, 'url cannot be nil'
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
pattern = Regexp.new(/^https:\/\//)
|
|
177
|
+
if url !~ pattern
|
|
178
|
+
fail ArgumentError, "invalid value for \"url\", must conform to the pattern #{pattern}."
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
@url = url
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Checks equality by comparing each attribute.
|
|
185
|
+
# @param [Object] Object to be compared
|
|
186
|
+
def ==(o)
|
|
187
|
+
return true if self.equal?(o)
|
|
188
|
+
self.class == o.class &&
|
|
189
|
+
title == o.title &&
|
|
190
|
+
type == o.type &&
|
|
191
|
+
url == o.url &&
|
|
192
|
+
method == o.method &&
|
|
193
|
+
body == o.body
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# @see the `==` method
|
|
197
|
+
# @param [Object] Object to be compared
|
|
198
|
+
def eql?(o)
|
|
199
|
+
self == o
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
# Calculates hash code according to all attributes.
|
|
203
|
+
# @return [Integer] Hash code
|
|
204
|
+
def hash
|
|
205
|
+
[title, type, url, method, body].hash
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
# Builds the object from hash
|
|
209
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
210
|
+
# @return [Object] Returns the model itself
|
|
211
|
+
def self.build_from_hash(attributes)
|
|
212
|
+
return nil unless attributes.is_a?(Hash)
|
|
213
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
214
|
+
transformed_hash = {}
|
|
215
|
+
openapi_types.each_pair do |key, type|
|
|
216
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
217
|
+
transformed_hash["#{key}"] = nil
|
|
218
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
219
|
+
# check to ensure the input is an array given that the attribute
|
|
220
|
+
# is documented as an array but the input is not
|
|
221
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
222
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
223
|
+
end
|
|
224
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
225
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
226
|
+
end
|
|
227
|
+
end
|
|
228
|
+
new(transformed_hash)
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# Deserializes the data based on type
|
|
232
|
+
# @param string type Data type
|
|
233
|
+
# @param string value Value to be deserialized
|
|
234
|
+
# @return [Object] Deserialized data
|
|
235
|
+
def self._deserialize(type, value)
|
|
236
|
+
case type.to_sym
|
|
237
|
+
when :Time
|
|
238
|
+
Time.parse(value)
|
|
239
|
+
when :Date
|
|
240
|
+
Date.parse(value)
|
|
241
|
+
when :String
|
|
242
|
+
value.to_s
|
|
243
|
+
when :Integer
|
|
244
|
+
value.to_i
|
|
245
|
+
when :Float
|
|
246
|
+
value.to_f
|
|
247
|
+
when :Boolean
|
|
248
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
249
|
+
true
|
|
250
|
+
else
|
|
251
|
+
false
|
|
252
|
+
end
|
|
253
|
+
when :Object
|
|
254
|
+
# generic object (usually a Hash), return directly
|
|
255
|
+
value
|
|
256
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
257
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
258
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
259
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
260
|
+
k_type = Regexp.last_match[:k_type]
|
|
261
|
+
v_type = Regexp.last_match[:v_type]
|
|
262
|
+
{}.tap do |hash|
|
|
263
|
+
value.each do |k, v|
|
|
264
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
265
|
+
end
|
|
266
|
+
end
|
|
267
|
+
else # model
|
|
268
|
+
# models (e.g. Pet) or oneOf
|
|
269
|
+
klass = OpenapiClient.const_get(type)
|
|
270
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
271
|
+
end
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
# Returns the string representation of the object
|
|
275
|
+
# @return [String] String presentation of the object
|
|
276
|
+
def to_s
|
|
277
|
+
to_hash.to_s
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
281
|
+
# @return [Hash] Returns the object in the form of hash
|
|
282
|
+
def to_body
|
|
283
|
+
to_hash
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
# Returns the object in the form of hash
|
|
287
|
+
# @return [Hash] Returns the object in the form of hash
|
|
288
|
+
def to_hash
|
|
289
|
+
hash = {}
|
|
290
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
291
|
+
value = self.send(attr)
|
|
292
|
+
if value.nil?
|
|
293
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
294
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
hash[param] = _to_hash(value)
|
|
298
|
+
end
|
|
299
|
+
hash
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
# Outputs non-array value in the form of hash
|
|
303
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
304
|
+
# @param [Object] value Any valid value
|
|
305
|
+
# @return [Hash] Returns the value in the form of hash
|
|
306
|
+
def _to_hash(value)
|
|
307
|
+
if value.is_a?(Array)
|
|
308
|
+
value.compact.map { |v| _to_hash(v) }
|
|
309
|
+
elsif value.is_a?(Hash)
|
|
310
|
+
{}.tap do |hash|
|
|
311
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
312
|
+
end
|
|
313
|
+
elsif value.respond_to? :to_hash
|
|
314
|
+
value.to_hash
|
|
315
|
+
else
|
|
316
|
+
value
|
|
317
|
+
end
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
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 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module OpenapiClient
|
|
17
|
+
class PushNotificationActionType
|
|
18
|
+
OPEN_URL = "open_url".freeze
|
|
19
|
+
WEBHOOK = "webhook".freeze
|
|
20
|
+
|
|
21
|
+
def self.all_vars
|
|
22
|
+
@all_vars ||= [OPEN_URL, WEBHOOK].freeze
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Builds the enum from string
|
|
26
|
+
# @param [String] The enum value in the form of the string
|
|
27
|
+
# @return [String] The enum value
|
|
28
|
+
def self.build_from_hash(value)
|
|
29
|
+
new.build_from_hash(value)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Builds the enum from string
|
|
33
|
+
# @param [String] The enum value in the form of the string
|
|
34
|
+
# @return [String] The enum value
|
|
35
|
+
def build_from_hash(value)
|
|
36
|
+
return value if PushNotificationActionType.all_vars.include?(value)
|
|
37
|
+
raise "Invalid ENUM value #{value} for class #PushNotificationActionType"
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -21,6 +21,12 @@ module OpenapiClient
|
|
|
21
21
|
|
|
22
22
|
attr_accessor :subtitle
|
|
23
23
|
|
|
24
|
+
# Optional HTTPS URL opened when user taps the notification body.
|
|
25
|
+
attr_accessor :redirection
|
|
26
|
+
|
|
27
|
+
# Optional interactive actions shown on iOS long-press.
|
|
28
|
+
attr_accessor :actions
|
|
29
|
+
|
|
24
30
|
attr_accessor :payload
|
|
25
31
|
|
|
26
32
|
attr_accessor :badge
|
|
@@ -35,6 +41,8 @@ module OpenapiClient
|
|
|
35
41
|
:'title' => :'title',
|
|
36
42
|
:'message' => :'message',
|
|
37
43
|
:'subtitle' => :'subtitle',
|
|
44
|
+
:'redirection' => :'redirection',
|
|
45
|
+
:'actions' => :'actions',
|
|
38
46
|
:'payload' => :'payload',
|
|
39
47
|
:'badge' => :'badge',
|
|
40
48
|
:'sound' => :'sound',
|
|
@@ -53,6 +61,8 @@ module OpenapiClient
|
|
|
53
61
|
:'title' => :'String',
|
|
54
62
|
:'message' => :'String',
|
|
55
63
|
:'subtitle' => :'String',
|
|
64
|
+
:'redirection' => :'String',
|
|
65
|
+
:'actions' => :'Array<PushNotificationAction>',
|
|
56
66
|
:'payload' => :'Hash<String, Object>',
|
|
57
67
|
:'badge' => :'Integer',
|
|
58
68
|
:'sound' => :'String',
|
|
@@ -95,6 +105,16 @@ module OpenapiClient
|
|
|
95
105
|
self.subtitle = attributes[:'subtitle']
|
|
96
106
|
end
|
|
97
107
|
|
|
108
|
+
if attributes.key?(:'redirection')
|
|
109
|
+
self.redirection = attributes[:'redirection']
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
if attributes.key?(:'actions')
|
|
113
|
+
if (value = attributes[:'actions']).is_a?(Array)
|
|
114
|
+
self.actions = value
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
98
118
|
if attributes.key?(:'payload')
|
|
99
119
|
if (value = attributes[:'payload']).is_a?(Hash)
|
|
100
120
|
self.payload = value
|
|
@@ -123,6 +143,15 @@ module OpenapiClient
|
|
|
123
143
|
invalid_properties.push('invalid value for "title", title cannot be nil.')
|
|
124
144
|
end
|
|
125
145
|
|
|
146
|
+
pattern = Regexp.new(/^https:\/\//)
|
|
147
|
+
if !@redirection.nil? && @redirection !~ pattern
|
|
148
|
+
invalid_properties.push("invalid value for \"redirection\", must conform to the pattern #{pattern}.")
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
if !@actions.nil? && @actions.length > 4
|
|
152
|
+
invalid_properties.push('invalid value for "actions", number of items must be less than or equal to 4.')
|
|
153
|
+
end
|
|
154
|
+
|
|
126
155
|
invalid_properties
|
|
127
156
|
end
|
|
128
157
|
|
|
@@ -131,9 +160,40 @@ module OpenapiClient
|
|
|
131
160
|
def valid?
|
|
132
161
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
133
162
|
return false if @title.nil?
|
|
163
|
+
return false if !@redirection.nil? && @redirection !~ Regexp.new(/^https:\/\//)
|
|
164
|
+
return false if !@actions.nil? && @actions.length > 4
|
|
134
165
|
true
|
|
135
166
|
end
|
|
136
167
|
|
|
168
|
+
# Custom attribute writer method with validation
|
|
169
|
+
# @param [Object] redirection Value to be assigned
|
|
170
|
+
def redirection=(redirection)
|
|
171
|
+
if redirection.nil?
|
|
172
|
+
fail ArgumentError, 'redirection cannot be nil'
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
pattern = Regexp.new(/^https:\/\//)
|
|
176
|
+
if redirection !~ pattern
|
|
177
|
+
fail ArgumentError, "invalid value for \"redirection\", must conform to the pattern #{pattern}."
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
@redirection = redirection
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# Custom attribute writer method with validation
|
|
184
|
+
# @param [Object] actions Value to be assigned
|
|
185
|
+
def actions=(actions)
|
|
186
|
+
if actions.nil?
|
|
187
|
+
fail ArgumentError, 'actions cannot be nil'
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
if actions.length > 4
|
|
191
|
+
fail ArgumentError, 'invalid value for "actions", number of items must be less than or equal to 4.'
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
@actions = actions
|
|
195
|
+
end
|
|
196
|
+
|
|
137
197
|
# Checks equality by comparing each attribute.
|
|
138
198
|
# @param [Object] Object to be compared
|
|
139
199
|
def ==(o)
|
|
@@ -142,6 +202,8 @@ module OpenapiClient
|
|
|
142
202
|
title == o.title &&
|
|
143
203
|
message == o.message &&
|
|
144
204
|
subtitle == o.subtitle &&
|
|
205
|
+
redirection == o.redirection &&
|
|
206
|
+
actions == o.actions &&
|
|
145
207
|
payload == o.payload &&
|
|
146
208
|
badge == o.badge &&
|
|
147
209
|
sound == o.sound &&
|
|
@@ -157,7 +219,7 @@ module OpenapiClient
|
|
|
157
219
|
# Calculates hash code according to all attributes.
|
|
158
220
|
# @return [Integer] Hash code
|
|
159
221
|
def hash
|
|
160
|
-
[title, message, subtitle, payload, badge, sound, target].hash
|
|
222
|
+
[title, message, subtitle, redirection, actions, payload, badge, sound, target].hash
|
|
161
223
|
end
|
|
162
224
|
|
|
163
225
|
# Builds the object from hash
|
|
@@ -0,0 +1,40 @@
|
|
|
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 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module OpenapiClient
|
|
17
|
+
class PushNotificationWebhookMethod
|
|
18
|
+
GET = "GET".freeze
|
|
19
|
+
POST = "POST".freeze
|
|
20
|
+
|
|
21
|
+
def self.all_vars
|
|
22
|
+
@all_vars ||= [GET, POST].freeze
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Builds the enum from string
|
|
26
|
+
# @param [String] The enum value in the form of the string
|
|
27
|
+
# @return [String] The enum value
|
|
28
|
+
def self.build_from_hash(value)
|
|
29
|
+
new.build_from_hash(value)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Builds the enum from string
|
|
33
|
+
# @param [String] The enum value in the form of the string
|
|
34
|
+
# @return [String] The enum value
|
|
35
|
+
def build_from_hash(value)
|
|
36
|
+
return value if PushNotificationWebhookMethod.all_vars.include?(value)
|
|
37
|
+
raise "Invalid ENUM value #{value} for class #PushNotificationWebhookMethod"
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -32,8 +32,11 @@ require 'activitysmith_openapi/models/live_activity_start_response'
|
|
|
32
32
|
require 'activitysmith_openapi/models/live_activity_update_request'
|
|
33
33
|
require 'activitysmith_openapi/models/live_activity_update_response'
|
|
34
34
|
require 'activitysmith_openapi/models/no_recipients_error'
|
|
35
|
+
require 'activitysmith_openapi/models/push_notification_action'
|
|
36
|
+
require 'activitysmith_openapi/models/push_notification_action_type'
|
|
35
37
|
require 'activitysmith_openapi/models/push_notification_request'
|
|
36
38
|
require 'activitysmith_openapi/models/push_notification_response'
|
|
39
|
+
require 'activitysmith_openapi/models/push_notification_webhook_method'
|
|
37
40
|
require 'activitysmith_openapi/models/rate_limit_error'
|
|
38
41
|
require 'activitysmith_openapi/models/send_push_notification429_response'
|
|
39
42
|
|
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.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ActivitySmith
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-02-
|
|
11
|
+
date: 2026-02-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: json
|
|
@@ -96,8 +96,11 @@ files:
|
|
|
96
96
|
- generated/activitysmith_openapi/models/live_activity_update_request.rb
|
|
97
97
|
- generated/activitysmith_openapi/models/live_activity_update_response.rb
|
|
98
98
|
- generated/activitysmith_openapi/models/no_recipients_error.rb
|
|
99
|
+
- generated/activitysmith_openapi/models/push_notification_action.rb
|
|
100
|
+
- generated/activitysmith_openapi/models/push_notification_action_type.rb
|
|
99
101
|
- generated/activitysmith_openapi/models/push_notification_request.rb
|
|
100
102
|
- generated/activitysmith_openapi/models/push_notification_response.rb
|
|
103
|
+
- generated/activitysmith_openapi/models/push_notification_webhook_method.rb
|
|
101
104
|
- generated/activitysmith_openapi/models/rate_limit_error.rb
|
|
102
105
|
- generated/activitysmith_openapi/models/send_push_notification429_response.rb
|
|
103
106
|
- generated/activitysmith_openapi/version.rb
|