activitysmith 1.14.0 → 1.15.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.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -5
  3. data/generated/activitysmith_openapi/api/app_icon_badges_api.rb +4 -4
  4. data/generated/activitysmith_openapi/api/devices_api.rb +100 -0
  5. data/generated/activitysmith_openapi/api/live_activities_api.rb +2 -2
  6. data/generated/activitysmith_openapi/api/metrics_api.rb +87 -4
  7. data/generated/activitysmith_openapi/api/push_notifications_api.rb +67 -0
  8. data/generated/activitysmith_openapi/models/account_device.rb +367 -0
  9. data/generated/activitysmith_openapi/models/account_device_list_response.rb +239 -0
  10. data/generated/activitysmith_openapi/models/account_device_list_response_meta.rb +299 -0
  11. data/generated/activitysmith_openapi/models/app_icon_badge_count_update_response.rb +1 -1
  12. data/generated/activitysmith_openapi/models/live_activity_stream_delete_response.rb +12 -1
  13. data/generated/activitysmith_openapi/models/metric.rb +411 -0
  14. data/generated/activitysmith_openapi/models/metric_response.rb +221 -0
  15. data/generated/activitysmith_openapi/models/metric_upsert_request.rb +370 -0
  16. data/generated/activitysmith_openapi/models/metric_value_update_response.rb +14 -4
  17. data/generated/activitysmith_openapi/models/no_recipients_error.rb +21 -1
  18. data/generated/activitysmith_openapi/models/push_notification_dismiss_response.rb +257 -0
  19. data/generated/activitysmith_openapi/version.rb +1 -1
  20. data/generated/activitysmith_openapi.rb +8 -0
  21. data/generated/openapi-source.json +2 -2
  22. data/lib/activitysmith/client.rb +3 -1
  23. data/lib/activitysmith/devices.rb +30 -0
  24. data/lib/activitysmith/metrics.rb +15 -1
  25. data/lib/activitysmith/notifications.rb +11 -0
  26. data/lib/activitysmith/version.rb +1 -1
  27. data/lib/activitysmith.rb +1 -0
  28. metadata +11 -2
@@ -0,0 +1,299 @@
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 AccountDeviceListResponseMeta
18
+ # Devices matching the filter.
19
+ attr_accessor :total
20
+
21
+ attr_accessor :limit
22
+
23
+ attr_accessor :offset
24
+
25
+ attr_accessor :has_more
26
+
27
+ # Offset for the next page, or null on the last page.
28
+ attr_accessor :next_offset
29
+
30
+ attr_accessor :include_inactive
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'total' => :'total',
36
+ :'limit' => :'limit',
37
+ :'offset' => :'offset',
38
+ :'has_more' => :'has_more',
39
+ :'next_offset' => :'next_offset',
40
+ :'include_inactive' => :'include_inactive'
41
+ }
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'total' => :'Integer',
53
+ :'limit' => :'Integer',
54
+ :'offset' => :'Integer',
55
+ :'has_more' => :'Boolean',
56
+ :'next_offset' => :'Integer',
57
+ :'include_inactive' => :'Boolean'
58
+ }
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new([
64
+ :'next_offset',
65
+ ])
66
+ end
67
+
68
+ # Initializes the object
69
+ # @param [Hash] attributes Model attributes in the form of hash
70
+ def initialize(attributes = {})
71
+ if (!attributes.is_a?(Hash))
72
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::AccountDeviceListResponseMeta` initialize method"
73
+ end
74
+
75
+ # check to see if the attribute exists and convert string to symbol for hash key
76
+ attributes = attributes.each_with_object({}) { |(k, v), h|
77
+ if (!self.class.attribute_map.key?(k.to_sym))
78
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::AccountDeviceListResponseMeta`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
79
+ end
80
+ h[k.to_sym] = v
81
+ }
82
+
83
+ if attributes.key?(:'total')
84
+ self.total = attributes[:'total']
85
+ else
86
+ self.total = nil
87
+ end
88
+
89
+ if attributes.key?(:'limit')
90
+ self.limit = attributes[:'limit']
91
+ else
92
+ self.limit = nil
93
+ end
94
+
95
+ if attributes.key?(:'offset')
96
+ self.offset = attributes[:'offset']
97
+ else
98
+ self.offset = nil
99
+ end
100
+
101
+ if attributes.key?(:'has_more')
102
+ self.has_more = attributes[:'has_more']
103
+ else
104
+ self.has_more = nil
105
+ end
106
+
107
+ if attributes.key?(:'next_offset')
108
+ self.next_offset = attributes[:'next_offset']
109
+ else
110
+ self.next_offset = nil
111
+ end
112
+
113
+ if attributes.key?(:'include_inactive')
114
+ self.include_inactive = attributes[:'include_inactive']
115
+ else
116
+ self.include_inactive = nil
117
+ end
118
+ end
119
+
120
+ # Show invalid properties with the reasons. Usually used together with valid?
121
+ # @return Array for valid properties with the reasons
122
+ def list_invalid_properties
123
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
124
+ invalid_properties = Array.new
125
+ if @total.nil?
126
+ invalid_properties.push('invalid value for "total", total cannot be nil.')
127
+ end
128
+
129
+ if @limit.nil?
130
+ invalid_properties.push('invalid value for "limit", limit cannot be nil.')
131
+ end
132
+
133
+ if @offset.nil?
134
+ invalid_properties.push('invalid value for "offset", offset cannot be nil.')
135
+ end
136
+
137
+ if @has_more.nil?
138
+ invalid_properties.push('invalid value for "has_more", has_more cannot be nil.')
139
+ end
140
+
141
+ if @include_inactive.nil?
142
+ invalid_properties.push('invalid value for "include_inactive", include_inactive 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 @total.nil?
153
+ return false if @limit.nil?
154
+ return false if @offset.nil?
155
+ return false if @has_more.nil?
156
+ return false if @include_inactive.nil?
157
+ true
158
+ end
159
+
160
+ # Checks equality by comparing each attribute.
161
+ # @param [Object] Object to be compared
162
+ def ==(o)
163
+ return true if self.equal?(o)
164
+ self.class == o.class &&
165
+ total == o.total &&
166
+ limit == o.limit &&
167
+ offset == o.offset &&
168
+ has_more == o.has_more &&
169
+ next_offset == o.next_offset &&
170
+ include_inactive == o.include_inactive
171
+ end
172
+
173
+ # @see the `==` method
174
+ # @param [Object] Object to be compared
175
+ def eql?(o)
176
+ self == o
177
+ end
178
+
179
+ # Calculates hash code according to all attributes.
180
+ # @return [Integer] Hash code
181
+ def hash
182
+ [total, limit, offset, has_more, next_offset, include_inactive].hash
183
+ end
184
+
185
+ # Builds the object from hash
186
+ # @param [Hash] attributes Model attributes in the form of hash
187
+ # @return [Object] Returns the model itself
188
+ def self.build_from_hash(attributes)
189
+ return nil unless attributes.is_a?(Hash)
190
+ attributes = attributes.transform_keys(&:to_sym)
191
+ transformed_hash = {}
192
+ openapi_types.each_pair do |key, type|
193
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
194
+ transformed_hash["#{key}"] = nil
195
+ elsif type =~ /\AArray<(.*)>/i
196
+ # check to ensure the input is an array given that the attribute
197
+ # is documented as an array but the input is not
198
+ if attributes[attribute_map[key]].is_a?(Array)
199
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
200
+ end
201
+ elsif !attributes[attribute_map[key]].nil?
202
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
203
+ end
204
+ end
205
+ new(transformed_hash)
206
+ end
207
+
208
+ # Deserializes the data based on type
209
+ # @param string type Data type
210
+ # @param string value Value to be deserialized
211
+ # @return [Object] Deserialized data
212
+ def self._deserialize(type, value)
213
+ case type.to_sym
214
+ when :Time
215
+ Time.parse(value)
216
+ when :Date
217
+ Date.parse(value)
218
+ when :String
219
+ value.to_s
220
+ when :Integer
221
+ value.to_i
222
+ when :Float
223
+ value.to_f
224
+ when :Boolean
225
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
226
+ true
227
+ else
228
+ false
229
+ end
230
+ when :Object
231
+ # generic object (usually a Hash), return directly
232
+ value
233
+ when /\AArray<(?<inner_type>.+)>\z/
234
+ inner_type = Regexp.last_match[:inner_type]
235
+ value.map { |v| _deserialize(inner_type, v) }
236
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
237
+ k_type = Regexp.last_match[:k_type]
238
+ v_type = Regexp.last_match[:v_type]
239
+ {}.tap do |hash|
240
+ value.each do |k, v|
241
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
242
+ end
243
+ end
244
+ else # model
245
+ # models (e.g. Pet) or oneOf
246
+ klass = OpenapiClient.const_get(type)
247
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
248
+ end
249
+ end
250
+
251
+ # Returns the string representation of the object
252
+ # @return [String] String presentation of the object
253
+ def to_s
254
+ to_hash.to_s
255
+ end
256
+
257
+ # to_body is an alias to to_hash (backward compatibility)
258
+ # @return [Hash] Returns the object in the form of hash
259
+ def to_body
260
+ to_hash
261
+ end
262
+
263
+ # Returns the object in the form of hash
264
+ # @return [Hash] Returns the object in the form of hash
265
+ def to_hash
266
+ hash = {}
267
+ self.class.attribute_map.each_pair do |attr, param|
268
+ value = self.send(attr)
269
+ if value.nil?
270
+ is_nullable = self.class.openapi_nullable.include?(attr)
271
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
272
+ end
273
+
274
+ hash[param] = _to_hash(value)
275
+ end
276
+ hash
277
+ end
278
+
279
+ # Outputs non-array value in the form of hash
280
+ # For object, use to_hash. Otherwise, just return the value
281
+ # @param [Object] value Any valid value
282
+ # @return [Hash] Returns the value in the form of hash
283
+ def _to_hash(value)
284
+ if value.is_a?(Array)
285
+ value.compact.map { |v| _to_hash(v) }
286
+ elsif value.is_a?(Hash)
287
+ {}.tap do |hash|
288
+ value.each { |k, v| hash[k] = _to_hash(v) }
289
+ end
290
+ elsif value.respond_to? :to_hash
291
+ value.to_hash
292
+ else
293
+ value
294
+ end
295
+ end
296
+
297
+ end
298
+
299
+ end
@@ -19,7 +19,7 @@ module OpenapiClient
19
19
 
20
20
  attr_accessor :badge
21
21
 
22
- # Number of devices whose App Icon Badge Count was updated.
22
+ # Number of devices whose App Icon Badge was updated.
23
23
  attr_accessor :devices_updated
24
24
 
25
25
  # Number of account users with at least one updated device.
@@ -37,6 +37,10 @@ module OpenapiClient
37
37
 
38
38
  attr_accessor :forced_completion
39
39
 
40
+ # Present when the stream had a current Live Activity. True when the end was sent to at least one device, or queued for a device that has not registered yet. False when no device received it, so the Live Activity may stay on the Lock Screen until iOS removes it or someone dismisses it.
41
+ attr_accessor :delivered
42
+
43
+ # Explains why the end may not have removed the Live Activity, for example because iOS had already ended a Live Activity that started more than 8 hours ago.
40
44
  attr_accessor :warning
41
45
 
42
46
  # Per-device delivery errors when some devices could not be reached.
@@ -77,6 +81,7 @@ module OpenapiClient
77
81
  :'ignored' => :'ignored',
78
82
  :'message' => :'message',
79
83
  :'forced_completion' => :'forced_completion',
84
+ :'delivered' => :'delivered',
80
85
  :'warning' => :'warning',
81
86
  :'errors' => :'errors'
82
87
  }
@@ -100,6 +105,7 @@ module OpenapiClient
100
105
  :'ignored' => :'Boolean',
101
106
  :'message' => :'String',
102
107
  :'forced_completion' => :'Boolean',
108
+ :'delivered' => :'Boolean',
103
109
  :'warning' => :'String',
104
110
  :'errors' => :'Array<String>'
105
111
  }
@@ -175,6 +181,10 @@ module OpenapiClient
175
181
  self.forced_completion = attributes[:'forced_completion']
176
182
  end
177
183
 
184
+ if attributes.key?(:'delivered')
185
+ self.delivered = attributes[:'delivered']
186
+ end
187
+
178
188
  if attributes.key?(:'warning')
179
189
  self.warning = attributes[:'warning']
180
190
  end
@@ -248,6 +258,7 @@ module OpenapiClient
248
258
  ignored == o.ignored &&
249
259
  message == o.message &&
250
260
  forced_completion == o.forced_completion &&
261
+ delivered == o.delivered &&
251
262
  warning == o.warning &&
252
263
  errors == o.errors
253
264
  end
@@ -261,7 +272,7 @@ module OpenapiClient
261
272
  # Calculates hash code according to all attributes.
262
273
  # @return [Integer] Hash code
263
274
  def hash
264
- [success, operation, stream_key, activity_id, devices_queued, devices_notified, timestamp, ignored, message, forced_completion, warning, errors].hash
275
+ [success, operation, stream_key, activity_id, devices_queued, devices_notified, timestamp, ignored, message, forced_completion, delivered, warning, errors].hash
265
276
  end
266
277
 
267
278
  # Builds the object from hash