activitysmith 1.12.0 → 1.14.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 +117 -11
- data/generated/activitysmith_openapi/api/push_notifications_api.rb +80 -2
- data/generated/activitysmith_openapi/models/app_icon_badge_count_update_response.rb +34 -4
- data/generated/activitysmith_openapi/models/billing_blocked_error.rb +296 -0
- data/generated/activitysmith_openapi/models/billing_blocked_error_trial_period.rb +237 -0
- data/generated/activitysmith_openapi/models/live_activity_end_response.rb +64 -4
- data/generated/activitysmith_openapi/models/live_activity_start_response.rb +35 -4
- data/generated/activitysmith_openapi/models/live_activity_stream_delete_response.rb +53 -4
- data/generated/activitysmith_openapi/models/live_activity_stream_put_response.rb +54 -4
- data/generated/activitysmith_openapi/models/live_activity_update_response.rb +76 -4
- data/generated/activitysmith_openapi/models/push_interruption_level.rb +41 -0
- data/generated/activitysmith_openapi/models/push_notification_replace_request.rb +434 -0
- data/generated/activitysmith_openapi/models/push_notification_replace_response.rb +298 -0
- data/generated/activitysmith_openapi/models/push_notification_request.rb +64 -1
- data/generated/activitysmith_openapi/models/push_notification_response.rb +66 -4
- data/generated/activitysmith_openapi/version.rb +1 -1
- data/generated/activitysmith_openapi.rb +5 -0
- data/generated/openapi-source.json +2 -2
- data/lib/activitysmith/notifications.rb +21 -3
- data/lib/activitysmith/push_interruption_level.rb +10 -0
- data/lib/activitysmith/version.rb +1 -1
- data/lib/activitysmith.rb +1 -0
- metadata +8 -2
|
@@ -0,0 +1,298 @@
|
|
|
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
|
+
# Apple APNs acceptance result for the replacement. Acceptance does not confirm device delivery or presentation.
|
|
18
|
+
class PushNotificationReplaceResponse
|
|
19
|
+
# True when APNs accepts the replacement for at least one device.
|
|
20
|
+
attr_accessor :success
|
|
21
|
+
|
|
22
|
+
# ID of the replaced Push Notification. It stays the same, so you can replace it again.
|
|
23
|
+
attr_accessor :notification_id
|
|
24
|
+
|
|
25
|
+
# Number of device tokens for which APNs accepted the notification, without confirming on-device delivery.
|
|
26
|
+
attr_accessor :devices_notified
|
|
27
|
+
|
|
28
|
+
attr_accessor :users_notified
|
|
29
|
+
|
|
30
|
+
attr_accessor :effective_channel_slugs
|
|
31
|
+
|
|
32
|
+
# Optional tags to organize and filter notification history.
|
|
33
|
+
attr_accessor :tags
|
|
34
|
+
|
|
35
|
+
attr_accessor :timestamp
|
|
36
|
+
|
|
37
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
38
|
+
def self.attribute_map
|
|
39
|
+
{
|
|
40
|
+
:'success' => :'success',
|
|
41
|
+
:'notification_id' => :'notification_id',
|
|
42
|
+
:'devices_notified' => :'devices_notified',
|
|
43
|
+
:'users_notified' => :'users_notified',
|
|
44
|
+
:'effective_channel_slugs' => :'effective_channel_slugs',
|
|
45
|
+
:'tags' => :'tags',
|
|
46
|
+
:'timestamp' => :'timestamp'
|
|
47
|
+
}
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Returns all the JSON keys this model knows about
|
|
51
|
+
def self.acceptable_attributes
|
|
52
|
+
attribute_map.values
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Attribute type mapping.
|
|
56
|
+
def self.openapi_types
|
|
57
|
+
{
|
|
58
|
+
:'success' => :'Boolean',
|
|
59
|
+
:'notification_id' => :'String',
|
|
60
|
+
:'devices_notified' => :'Integer',
|
|
61
|
+
:'users_notified' => :'Integer',
|
|
62
|
+
:'effective_channel_slugs' => :'Array<String>',
|
|
63
|
+
:'tags' => :'Array<String>',
|
|
64
|
+
:'timestamp' => :'Time'
|
|
65
|
+
}
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# List of attributes with nullable: true
|
|
69
|
+
def self.openapi_nullable
|
|
70
|
+
Set.new([
|
|
71
|
+
])
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Initializes the object
|
|
75
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
76
|
+
def initialize(attributes = {})
|
|
77
|
+
if (!attributes.is_a?(Hash))
|
|
78
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::PushNotificationReplaceResponse` initialize method"
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
82
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
83
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
84
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::PushNotificationReplaceResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
85
|
+
end
|
|
86
|
+
h[k.to_sym] = v
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if attributes.key?(:'success')
|
|
90
|
+
self.success = attributes[:'success']
|
|
91
|
+
else
|
|
92
|
+
self.success = nil
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
if attributes.key?(:'notification_id')
|
|
96
|
+
self.notification_id = attributes[:'notification_id']
|
|
97
|
+
else
|
|
98
|
+
self.notification_id = nil
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
if attributes.key?(:'devices_notified')
|
|
102
|
+
self.devices_notified = attributes[:'devices_notified']
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
if attributes.key?(:'users_notified')
|
|
106
|
+
self.users_notified = attributes[:'users_notified']
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
if attributes.key?(:'effective_channel_slugs')
|
|
110
|
+
if (value = attributes[:'effective_channel_slugs']).is_a?(Array)
|
|
111
|
+
self.effective_channel_slugs = value
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
if attributes.key?(:'tags')
|
|
116
|
+
if (value = attributes[:'tags']).is_a?(Array)
|
|
117
|
+
self.tags = value
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
if attributes.key?(:'timestamp')
|
|
122
|
+
self.timestamp = attributes[:'timestamp']
|
|
123
|
+
else
|
|
124
|
+
self.timestamp = nil
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
129
|
+
# @return Array for valid properties with the reasons
|
|
130
|
+
def list_invalid_properties
|
|
131
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
132
|
+
invalid_properties = Array.new
|
|
133
|
+
if @success.nil?
|
|
134
|
+
invalid_properties.push('invalid value for "success", success cannot be nil.')
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
if @notification_id.nil?
|
|
138
|
+
invalid_properties.push('invalid value for "notification_id", notification_id cannot be nil.')
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
if @timestamp.nil?
|
|
142
|
+
invalid_properties.push('invalid value for "timestamp", timestamp cannot be nil.')
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
invalid_properties
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# Check to see if the all the properties in the model are valid
|
|
149
|
+
# @return true if the model is valid
|
|
150
|
+
def valid?
|
|
151
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
152
|
+
return false if @success.nil?
|
|
153
|
+
return false if @notification_id.nil?
|
|
154
|
+
return false if @timestamp.nil?
|
|
155
|
+
true
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
# Checks equality by comparing each attribute.
|
|
159
|
+
# @param [Object] Object to be compared
|
|
160
|
+
def ==(o)
|
|
161
|
+
return true if self.equal?(o)
|
|
162
|
+
self.class == o.class &&
|
|
163
|
+
success == o.success &&
|
|
164
|
+
notification_id == o.notification_id &&
|
|
165
|
+
devices_notified == o.devices_notified &&
|
|
166
|
+
users_notified == o.users_notified &&
|
|
167
|
+
effective_channel_slugs == o.effective_channel_slugs &&
|
|
168
|
+
tags == o.tags &&
|
|
169
|
+
timestamp == o.timestamp
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# @see the `==` method
|
|
173
|
+
# @param [Object] Object to be compared
|
|
174
|
+
def eql?(o)
|
|
175
|
+
self == o
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Calculates hash code according to all attributes.
|
|
179
|
+
# @return [Integer] Hash code
|
|
180
|
+
def hash
|
|
181
|
+
[success, notification_id, devices_notified, users_notified, effective_channel_slugs, tags, timestamp].hash
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Builds the object from hash
|
|
185
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
186
|
+
# @return [Object] Returns the model itself
|
|
187
|
+
def self.build_from_hash(attributes)
|
|
188
|
+
return nil unless attributes.is_a?(Hash)
|
|
189
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
190
|
+
transformed_hash = {}
|
|
191
|
+
openapi_types.each_pair do |key, type|
|
|
192
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
193
|
+
transformed_hash["#{key}"] = nil
|
|
194
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
195
|
+
# check to ensure the input is an array given that the attribute
|
|
196
|
+
# is documented as an array but the input is not
|
|
197
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
198
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
199
|
+
end
|
|
200
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
201
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
new(transformed_hash)
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
# Deserializes the data based on type
|
|
208
|
+
# @param string type Data type
|
|
209
|
+
# @param string value Value to be deserialized
|
|
210
|
+
# @return [Object] Deserialized data
|
|
211
|
+
def self._deserialize(type, value)
|
|
212
|
+
case type.to_sym
|
|
213
|
+
when :Time
|
|
214
|
+
Time.parse(value)
|
|
215
|
+
when :Date
|
|
216
|
+
Date.parse(value)
|
|
217
|
+
when :String
|
|
218
|
+
value.to_s
|
|
219
|
+
when :Integer
|
|
220
|
+
value.to_i
|
|
221
|
+
when :Float
|
|
222
|
+
value.to_f
|
|
223
|
+
when :Boolean
|
|
224
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
225
|
+
true
|
|
226
|
+
else
|
|
227
|
+
false
|
|
228
|
+
end
|
|
229
|
+
when :Object
|
|
230
|
+
# generic object (usually a Hash), return directly
|
|
231
|
+
value
|
|
232
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
233
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
234
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
235
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
236
|
+
k_type = Regexp.last_match[:k_type]
|
|
237
|
+
v_type = Regexp.last_match[:v_type]
|
|
238
|
+
{}.tap do |hash|
|
|
239
|
+
value.each do |k, v|
|
|
240
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
else # model
|
|
244
|
+
# models (e.g. Pet) or oneOf
|
|
245
|
+
klass = OpenapiClient.const_get(type)
|
|
246
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
247
|
+
end
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
# Returns the string representation of the object
|
|
251
|
+
# @return [String] String presentation of the object
|
|
252
|
+
def to_s
|
|
253
|
+
to_hash.to_s
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
257
|
+
# @return [Hash] Returns the object in the form of hash
|
|
258
|
+
def to_body
|
|
259
|
+
to_hash
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
# Returns the object in the form of hash
|
|
263
|
+
# @return [Hash] Returns the object in the form of hash
|
|
264
|
+
def to_hash
|
|
265
|
+
hash = {}
|
|
266
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
267
|
+
value = self.send(attr)
|
|
268
|
+
if value.nil?
|
|
269
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
270
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
hash[param] = _to_hash(value)
|
|
274
|
+
end
|
|
275
|
+
hash
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
# Outputs non-array value in the form of hash
|
|
279
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
280
|
+
# @param [Object] value Any valid value
|
|
281
|
+
# @return [Hash] Returns the value in the form of hash
|
|
282
|
+
def _to_hash(value)
|
|
283
|
+
if value.is_a?(Array)
|
|
284
|
+
value.compact.map { |v| _to_hash(v) }
|
|
285
|
+
elsif value.is_a?(Hash)
|
|
286
|
+
{}.tap do |hash|
|
|
287
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
288
|
+
end
|
|
289
|
+
elsif value.respond_to? :to_hash
|
|
290
|
+
value.to_hash
|
|
291
|
+
else
|
|
292
|
+
value
|
|
293
|
+
end
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
end
|
|
@@ -24,6 +24,12 @@ module OpenapiClient
|
|
|
24
24
|
|
|
25
25
|
attr_accessor :subtitle
|
|
26
26
|
|
|
27
|
+
# Optional HTTPS image URL without credentials for a custom notification icon. If the image cannot be loaded, the app icon is used. iOS may omit subtitle when displaying a custom icon.
|
|
28
|
+
attr_accessor :icon
|
|
29
|
+
|
|
30
|
+
# Optional. How urgently iOS presents the notification: `passive` (quiet, no sound or screen wake), `active` (default), or `time-sensitive` (can break through Focus and Scheduled Summary when allowed). Omit for normal delivery.
|
|
31
|
+
attr_accessor :interruption_level
|
|
32
|
+
|
|
27
33
|
# 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`.
|
|
28
34
|
attr_accessor :media
|
|
29
35
|
|
|
@@ -44,6 +50,28 @@ module OpenapiClient
|
|
|
44
50
|
# Optional tags to organize and filter notification history.
|
|
45
51
|
attr_accessor :tags
|
|
46
52
|
|
|
53
|
+
class EnumAttributeValidator
|
|
54
|
+
attr_reader :datatype
|
|
55
|
+
attr_reader :allowable_values
|
|
56
|
+
|
|
57
|
+
def initialize(datatype, allowable_values)
|
|
58
|
+
@allowable_values = allowable_values.map do |value|
|
|
59
|
+
case datatype.to_s
|
|
60
|
+
when /Integer/i
|
|
61
|
+
value.to_i
|
|
62
|
+
when /Float/i
|
|
63
|
+
value.to_f
|
|
64
|
+
else
|
|
65
|
+
value
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def valid?(value)
|
|
71
|
+
!value || allowable_values.include?(value)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
47
75
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
48
76
|
def self.attribute_map
|
|
49
77
|
{
|
|
@@ -51,6 +79,8 @@ module OpenapiClient
|
|
|
51
79
|
:'title' => :'title',
|
|
52
80
|
:'message' => :'message',
|
|
53
81
|
:'subtitle' => :'subtitle',
|
|
82
|
+
:'icon' => :'icon',
|
|
83
|
+
:'interruption_level' => :'interruption_level',
|
|
54
84
|
:'media' => :'media',
|
|
55
85
|
:'redirection' => :'redirection',
|
|
56
86
|
:'actions' => :'actions',
|
|
@@ -74,6 +104,8 @@ module OpenapiClient
|
|
|
74
104
|
:'title' => :'String',
|
|
75
105
|
:'message' => :'String',
|
|
76
106
|
:'subtitle' => :'String',
|
|
107
|
+
:'icon' => :'String',
|
|
108
|
+
:'interruption_level' => :'PushInterruptionLevel',
|
|
77
109
|
:'media' => :'String',
|
|
78
110
|
:'redirection' => :'String',
|
|
79
111
|
:'actions' => :'Array<PushNotificationAction>',
|
|
@@ -126,6 +158,14 @@ module OpenapiClient
|
|
|
126
158
|
self.subtitle = attributes[:'subtitle']
|
|
127
159
|
end
|
|
128
160
|
|
|
161
|
+
if attributes.key?(:'icon')
|
|
162
|
+
self.icon = attributes[:'icon']
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
if attributes.key?(:'interruption_level')
|
|
166
|
+
self.interruption_level = attributes[:'interruption_level']
|
|
167
|
+
end
|
|
168
|
+
|
|
129
169
|
if attributes.key?(:'media')
|
|
130
170
|
self.media = attributes[:'media']
|
|
131
171
|
end
|
|
@@ -176,6 +216,11 @@ module OpenapiClient
|
|
|
176
216
|
invalid_properties.push('invalid value for "title", title cannot be nil.')
|
|
177
217
|
end
|
|
178
218
|
|
|
219
|
+
pattern = Regexp.new(/^https:\/\//)
|
|
220
|
+
if !@icon.nil? && @icon !~ pattern
|
|
221
|
+
invalid_properties.push("invalid value for \"icon\", must conform to the pattern #{pattern}.")
|
|
222
|
+
end
|
|
223
|
+
|
|
179
224
|
pattern = Regexp.new(/^https:\/\//)
|
|
180
225
|
if !@media.nil? && @media !~ pattern
|
|
181
226
|
invalid_properties.push("invalid value for \"media\", must conform to the pattern #{pattern}.")
|
|
@@ -203,6 +248,7 @@ module OpenapiClient
|
|
|
203
248
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
204
249
|
return false if !@metadata.nil? && @metadata.length > 50
|
|
205
250
|
return false if @title.nil?
|
|
251
|
+
return false if !@icon.nil? && @icon !~ Regexp.new(/^https:\/\//)
|
|
206
252
|
return false if !@media.nil? && @media !~ Regexp.new(/^https:\/\//)
|
|
207
253
|
return false if !@redirection.nil? && @redirection.to_s.length > 2048
|
|
208
254
|
return false if !@redirection.nil? && @redirection !~ Regexp.new(/^[A-Za-z][A-Za-z0-9+.-]*:/)
|
|
@@ -224,6 +270,21 @@ module OpenapiClient
|
|
|
224
270
|
@metadata = metadata
|
|
225
271
|
end
|
|
226
272
|
|
|
273
|
+
# Custom attribute writer method with validation
|
|
274
|
+
# @param [Object] icon Value to be assigned
|
|
275
|
+
def icon=(icon)
|
|
276
|
+
if icon.nil?
|
|
277
|
+
fail ArgumentError, 'icon cannot be nil'
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
pattern = Regexp.new(/^https:\/\//)
|
|
281
|
+
if icon !~ pattern
|
|
282
|
+
fail ArgumentError, "invalid value for \"icon\", must conform to the pattern #{pattern}."
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
@icon = icon
|
|
286
|
+
end
|
|
287
|
+
|
|
227
288
|
# Custom attribute writer method with validation
|
|
228
289
|
# @param [Object] media Value to be assigned
|
|
229
290
|
def media=(media)
|
|
@@ -281,6 +342,8 @@ module OpenapiClient
|
|
|
281
342
|
title == o.title &&
|
|
282
343
|
message == o.message &&
|
|
283
344
|
subtitle == o.subtitle &&
|
|
345
|
+
icon == o.icon &&
|
|
346
|
+
interruption_level == o.interruption_level &&
|
|
284
347
|
media == o.media &&
|
|
285
348
|
redirection == o.redirection &&
|
|
286
349
|
actions == o.actions &&
|
|
@@ -300,7 +363,7 @@ module OpenapiClient
|
|
|
300
363
|
# Calculates hash code according to all attributes.
|
|
301
364
|
# @return [Integer] Hash code
|
|
302
365
|
def hash
|
|
303
|
-
[metadata, title, message, subtitle, media, redirection, actions, payload, badge, sound, target, tags].hash
|
|
366
|
+
[metadata, title, message, subtitle, icon, interruption_level, media, redirection, actions, payload, badge, sound, target, tags].hash
|
|
304
367
|
end
|
|
305
368
|
|
|
306
369
|
# Builds the object from hash
|
|
@@ -14,9 +14,15 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module OpenapiClient
|
|
17
|
+
# Apple APNs acceptance result. Acceptance does not confirm device delivery or presentation. Alerts remain eligible for APNs delivery retries for 24 hours; device settings and APNs storage policies still apply.
|
|
17
18
|
class PushNotificationResponse
|
|
19
|
+
# True when APNs accepts the notification for at least one targeted device.
|
|
18
20
|
attr_accessor :success
|
|
19
21
|
|
|
22
|
+
# ID of this Push Notification. Pass it to `PUT /push-notification/{notification_id}` to replace the notification later.
|
|
23
|
+
attr_accessor :notification_id
|
|
24
|
+
|
|
25
|
+
# Number of device tokens for which APNs accepted the notification, without confirming on-device delivery.
|
|
20
26
|
attr_accessor :devices_notified
|
|
21
27
|
|
|
22
28
|
attr_accessor :users_notified
|
|
@@ -28,15 +34,35 @@ module OpenapiClient
|
|
|
28
34
|
|
|
29
35
|
attr_accessor :timestamp
|
|
30
36
|
|
|
37
|
+
# Number of device tokens targeted.
|
|
38
|
+
attr_accessor :devices_targeted
|
|
39
|
+
|
|
40
|
+
# Number of device tokens deactivated because APNs reported them unregistered.
|
|
41
|
+
attr_accessor :devices_deactivated
|
|
42
|
+
|
|
43
|
+
# Number of targeted device tokens APNs reported as unregistered.
|
|
44
|
+
attr_accessor :devices_unregistered
|
|
45
|
+
|
|
46
|
+
# True when the request was an integration connection test and no paired devices were available.
|
|
47
|
+
attr_accessor :credential_test
|
|
48
|
+
|
|
49
|
+
attr_accessor :message
|
|
50
|
+
|
|
31
51
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
32
52
|
def self.attribute_map
|
|
33
53
|
{
|
|
34
54
|
:'success' => :'success',
|
|
55
|
+
:'notification_id' => :'notification_id',
|
|
35
56
|
:'devices_notified' => :'devices_notified',
|
|
36
57
|
:'users_notified' => :'users_notified',
|
|
37
58
|
:'effective_channel_slugs' => :'effective_channel_slugs',
|
|
38
59
|
:'tags' => :'tags',
|
|
39
|
-
:'timestamp' => :'timestamp'
|
|
60
|
+
:'timestamp' => :'timestamp',
|
|
61
|
+
:'devices_targeted' => :'devices_targeted',
|
|
62
|
+
:'devices_deactivated' => :'devices_deactivated',
|
|
63
|
+
:'devices_unregistered' => :'devices_unregistered',
|
|
64
|
+
:'credential_test' => :'credential_test',
|
|
65
|
+
:'message' => :'message'
|
|
40
66
|
}
|
|
41
67
|
end
|
|
42
68
|
|
|
@@ -49,11 +75,17 @@ module OpenapiClient
|
|
|
49
75
|
def self.openapi_types
|
|
50
76
|
{
|
|
51
77
|
:'success' => :'Boolean',
|
|
78
|
+
:'notification_id' => :'String',
|
|
52
79
|
:'devices_notified' => :'Integer',
|
|
53
80
|
:'users_notified' => :'Integer',
|
|
54
81
|
:'effective_channel_slugs' => :'Array<String>',
|
|
55
82
|
:'tags' => :'Array<String>',
|
|
56
|
-
:'timestamp' => :'Time'
|
|
83
|
+
:'timestamp' => :'Time',
|
|
84
|
+
:'devices_targeted' => :'Integer',
|
|
85
|
+
:'devices_deactivated' => :'Integer',
|
|
86
|
+
:'devices_unregistered' => :'Integer',
|
|
87
|
+
:'credential_test' => :'Boolean',
|
|
88
|
+
:'message' => :'String'
|
|
57
89
|
}
|
|
58
90
|
end
|
|
59
91
|
|
|
@@ -84,6 +116,10 @@ module OpenapiClient
|
|
|
84
116
|
self.success = nil
|
|
85
117
|
end
|
|
86
118
|
|
|
119
|
+
if attributes.key?(:'notification_id')
|
|
120
|
+
self.notification_id = attributes[:'notification_id']
|
|
121
|
+
end
|
|
122
|
+
|
|
87
123
|
if attributes.key?(:'devices_notified')
|
|
88
124
|
self.devices_notified = attributes[:'devices_notified']
|
|
89
125
|
end
|
|
@@ -109,6 +145,26 @@ module OpenapiClient
|
|
|
109
145
|
else
|
|
110
146
|
self.timestamp = nil
|
|
111
147
|
end
|
|
148
|
+
|
|
149
|
+
if attributes.key?(:'devices_targeted')
|
|
150
|
+
self.devices_targeted = attributes[:'devices_targeted']
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
if attributes.key?(:'devices_deactivated')
|
|
154
|
+
self.devices_deactivated = attributes[:'devices_deactivated']
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
if attributes.key?(:'devices_unregistered')
|
|
158
|
+
self.devices_unregistered = attributes[:'devices_unregistered']
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
if attributes.key?(:'credential_test')
|
|
162
|
+
self.credential_test = attributes[:'credential_test']
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
if attributes.key?(:'message')
|
|
166
|
+
self.message = attributes[:'message']
|
|
167
|
+
end
|
|
112
168
|
end
|
|
113
169
|
|
|
114
170
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -142,11 +198,17 @@ module OpenapiClient
|
|
|
142
198
|
return true if self.equal?(o)
|
|
143
199
|
self.class == o.class &&
|
|
144
200
|
success == o.success &&
|
|
201
|
+
notification_id == o.notification_id &&
|
|
145
202
|
devices_notified == o.devices_notified &&
|
|
146
203
|
users_notified == o.users_notified &&
|
|
147
204
|
effective_channel_slugs == o.effective_channel_slugs &&
|
|
148
205
|
tags == o.tags &&
|
|
149
|
-
timestamp == o.timestamp
|
|
206
|
+
timestamp == o.timestamp &&
|
|
207
|
+
devices_targeted == o.devices_targeted &&
|
|
208
|
+
devices_deactivated == o.devices_deactivated &&
|
|
209
|
+
devices_unregistered == o.devices_unregistered &&
|
|
210
|
+
credential_test == o.credential_test &&
|
|
211
|
+
message == o.message
|
|
150
212
|
end
|
|
151
213
|
|
|
152
214
|
# @see the `==` method
|
|
@@ -158,7 +220,7 @@ module OpenapiClient
|
|
|
158
220
|
# Calculates hash code according to all attributes.
|
|
159
221
|
# @return [Integer] Hash code
|
|
160
222
|
def hash
|
|
161
|
-
[success, devices_notified, users_notified, effective_channel_slugs, tags, timestamp].hash
|
|
223
|
+
[success, notification_id, devices_notified, users_notified, effective_channel_slugs, tags, timestamp, devices_targeted, devices_deactivated, devices_unregistered, credential_test, message].hash
|
|
162
224
|
end
|
|
163
225
|
|
|
164
226
|
# Builds the object from hash
|
|
@@ -24,6 +24,8 @@ require 'activitysmith_openapi/models/app_icon_badge_count_update_error'
|
|
|
24
24
|
require 'activitysmith_openapi/models/app_icon_badge_count_update_request'
|
|
25
25
|
require 'activitysmith_openapi/models/app_icon_badge_count_update_response'
|
|
26
26
|
require 'activitysmith_openapi/models/bad_request_error'
|
|
27
|
+
require 'activitysmith_openapi/models/billing_blocked_error'
|
|
28
|
+
require 'activitysmith_openapi/models/billing_blocked_error_trial_period'
|
|
27
29
|
require 'activitysmith_openapi/models/channel_target'
|
|
28
30
|
require 'activitysmith_openapi/models/content_state_end'
|
|
29
31
|
require 'activitysmith_openapi/models/content_state_start'
|
|
@@ -54,8 +56,11 @@ require 'activitysmith_openapi/models/metric_value_update_request_value'
|
|
|
54
56
|
require 'activitysmith_openapi/models/metric_value_update_response'
|
|
55
57
|
require 'activitysmith_openapi/models/no_recipients_error'
|
|
56
58
|
require 'activitysmith_openapi/models/not_found_error'
|
|
59
|
+
require 'activitysmith_openapi/models/push_interruption_level'
|
|
57
60
|
require 'activitysmith_openapi/models/push_notification_action'
|
|
58
61
|
require 'activitysmith_openapi/models/push_notification_action_type'
|
|
62
|
+
require 'activitysmith_openapi/models/push_notification_replace_request'
|
|
63
|
+
require 'activitysmith_openapi/models/push_notification_replace_response'
|
|
59
64
|
require 'activitysmith_openapi/models/push_notification_request'
|
|
60
65
|
require 'activitysmith_openapi/models/push_notification_response'
|
|
61
66
|
require 'activitysmith_openapi/models/push_notification_webhook_method'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"repository": "ActivitySmithHQ/activitysmith-backend",
|
|
3
|
-
"commit": "
|
|
3
|
+
"commit": "dd6757c5defa3d1e6524faef789b6829184fb852",
|
|
4
4
|
"path": "openapi.json",
|
|
5
|
-
"sha256": "
|
|
5
|
+
"sha256": "24dae2d064095351d5e5cf800228e64a2d23c40b1e31a9754503081ddf31c5d8"
|
|
6
6
|
}
|
|
@@ -9,14 +9,25 @@ module ActivitySmith
|
|
|
9
9
|
def send(request = nil, opts = {}, tags: nil, **request_fields)
|
|
10
10
|
normalized = normalize_channels_target(with_tags(combine_request(request, request_fields), tags))
|
|
11
11
|
assert_valid_media_actions!(normalized)
|
|
12
|
+
assert_valid_interruption_level!(normalized)
|
|
12
13
|
@api.send_push_notification(normalized, opts)
|
|
13
14
|
end
|
|
14
15
|
|
|
15
16
|
# Backward-compatible alias.
|
|
16
|
-
def send_push_notification(push_notification_request, opts = {}, tags: nil)
|
|
17
|
-
|
|
17
|
+
def send_push_notification(push_notification_request = nil, opts = {}, tags: nil, **request_fields)
|
|
18
|
+
send(push_notification_request, opts, tags: tags, **request_fields)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Silently replaces a sent Push Notification, using the notification_id returned by send.
|
|
22
|
+
def replace(notification_id, request = nil, opts = {}, tags: nil, **request_fields)
|
|
23
|
+
normalized = with_tags(combine_request(request, request_fields), tags)
|
|
18
24
|
assert_valid_media_actions!(normalized)
|
|
19
|
-
@api.
|
|
25
|
+
@api.replace_push_notification(notification_id, normalized, opts)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Generated-style alias.
|
|
29
|
+
def replace_push_notification(notification_id, push_notification_replace_request = nil, opts = {}, tags: nil, **request_fields)
|
|
30
|
+
replace(notification_id, push_notification_replace_request, opts, tags: tags, **request_fields)
|
|
20
31
|
end
|
|
21
32
|
|
|
22
33
|
def method_missing(name, *args, &block)
|
|
@@ -80,6 +91,13 @@ module ActivitySmith
|
|
|
80
91
|
raise ArgumentError, "ActivitySmith: media cannot be combined with actions"
|
|
81
92
|
end
|
|
82
93
|
|
|
94
|
+
def assert_valid_interruption_level!(request)
|
|
95
|
+
level = request_value(request, :interruption_level)
|
|
96
|
+
return if level.nil? || PushInterruptionLevel::VALUES.include?(level.to_s)
|
|
97
|
+
|
|
98
|
+
raise ArgumentError, "ActivitySmith: interruption_level must be passive, active, or time-sensitive"
|
|
99
|
+
end
|
|
100
|
+
|
|
83
101
|
def request_value(request, key)
|
|
84
102
|
if request.is_a?(Hash)
|
|
85
103
|
return request[key] if request.key?(key)
|
data/lib/activitysmith.rb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require_relative "activitysmith/version"
|
|
4
4
|
require_relative "activitysmith/versioned_user_agent"
|
|
5
|
+
require_relative "activitysmith/push_interruption_level"
|
|
5
6
|
require_relative "activitysmith/notifications"
|
|
6
7
|
require_relative "activitysmith/live_activities"
|
|
7
8
|
require_relative "activitysmith/metrics"
|