activitysmith 1.13.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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +33 -9
  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 +147 -2
  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 +35 -5
  12. data/generated/activitysmith_openapi/models/live_activity_end_response.rb +64 -4
  13. data/generated/activitysmith_openapi/models/live_activity_start_response.rb +35 -4
  14. data/generated/activitysmith_openapi/models/live_activity_stream_delete_response.rb +64 -4
  15. data/generated/activitysmith_openapi/models/live_activity_stream_put_response.rb +54 -4
  16. data/generated/activitysmith_openapi/models/live_activity_update_response.rb +76 -4
  17. data/generated/activitysmith_openapi/models/metric.rb +411 -0
  18. data/generated/activitysmith_openapi/models/metric_response.rb +221 -0
  19. data/generated/activitysmith_openapi/models/metric_upsert_request.rb +370 -0
  20. data/generated/activitysmith_openapi/models/metric_value_update_response.rb +14 -4
  21. data/generated/activitysmith_openapi/models/no_recipients_error.rb +21 -1
  22. data/generated/activitysmith_openapi/models/push_notification_dismiss_response.rb +257 -0
  23. data/generated/activitysmith_openapi/models/push_notification_replace_request.rb +434 -0
  24. data/generated/activitysmith_openapi/models/push_notification_replace_response.rb +298 -0
  25. data/generated/activitysmith_openapi/models/push_notification_response.rb +63 -4
  26. data/generated/activitysmith_openapi/version.rb +1 -1
  27. data/generated/activitysmith_openapi.rb +10 -0
  28. data/generated/openapi-source.json +2 -2
  29. data/lib/activitysmith/client.rb +3 -1
  30. data/lib/activitysmith/devices.rb +30 -0
  31. data/lib/activitysmith/metrics.rb +15 -1
  32. data/lib/activitysmith/notifications.rb +23 -0
  33. data/lib/activitysmith/version.rb +1 -1
  34. data/lib/activitysmith.rb +1 -0
  35. metadata +13 -2
@@ -17,15 +17,23 @@ module OpenapiClient
17
17
  class NoRecipientsError
18
18
  attr_accessor :error
19
19
 
20
+ # Machine-readable reason. no_paired_devices: the account has no active paired iOS devices; pair an iPhone with the ActivitySmith app. no_recipients_found: devices are paired, but none matched the targeted channels. Treat unknown values as a generic no-delivery error.
21
+ attr_accessor :code
22
+
20
23
  attr_accessor :message
21
24
 
25
+ # ActivitySmith App Store link. Present when code is no_paired_devices.
26
+ attr_accessor :app_store_url
27
+
22
28
  attr_accessor :effective_channel_slugs
23
29
 
24
30
  # Attribute mapping from ruby-style variable name to JSON key.
25
31
  def self.attribute_map
26
32
  {
27
33
  :'error' => :'error',
34
+ :'code' => :'code',
28
35
  :'message' => :'message',
36
+ :'app_store_url' => :'app_store_url',
29
37
  :'effective_channel_slugs' => :'effective_channel_slugs'
30
38
  }
31
39
  end
@@ -39,7 +47,9 @@ module OpenapiClient
39
47
  def self.openapi_types
40
48
  {
41
49
  :'error' => :'String',
50
+ :'code' => :'String',
42
51
  :'message' => :'String',
52
+ :'app_store_url' => :'String',
43
53
  :'effective_channel_slugs' => :'Array<String>'
44
54
  }
45
55
  end
@@ -71,12 +81,20 @@ module OpenapiClient
71
81
  self.error = nil
72
82
  end
73
83
 
84
+ if attributes.key?(:'code')
85
+ self.code = attributes[:'code']
86
+ end
87
+
74
88
  if attributes.key?(:'message')
75
89
  self.message = attributes[:'message']
76
90
  else
77
91
  self.message = nil
78
92
  end
79
93
 
94
+ if attributes.key?(:'app_store_url')
95
+ self.app_store_url = attributes[:'app_store_url']
96
+ end
97
+
80
98
  if attributes.key?(:'effective_channel_slugs')
81
99
  if (value = attributes[:'effective_channel_slugs']).is_a?(Array)
82
100
  self.effective_channel_slugs = value
@@ -115,7 +133,9 @@ module OpenapiClient
115
133
  return true if self.equal?(o)
116
134
  self.class == o.class &&
117
135
  error == o.error &&
136
+ code == o.code &&
118
137
  message == o.message &&
138
+ app_store_url == o.app_store_url &&
119
139
  effective_channel_slugs == o.effective_channel_slugs
120
140
  end
121
141
 
@@ -128,7 +148,7 @@ module OpenapiClient
128
148
  # Calculates hash code according to all attributes.
129
149
  # @return [Integer] Hash code
130
150
  def hash
131
- [error, message, effective_channel_slugs].hash
151
+ [error, code, message, app_store_url, effective_channel_slugs].hash
132
152
  end
133
153
 
134
154
  # Builds the object from hash
@@ -0,0 +1,257 @@
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
+ # Dismissal result. Devices clear the notification after this response, so it does not confirm that any device has cleared it.
18
+ class PushNotificationDismissResponse
19
+ # True when the dismissal is recorded.
20
+ attr_accessor :success
21
+
22
+ # ID of the dismissed Push Notification.
23
+ attr_accessor :notification_id
24
+
25
+ # When the notification was first dismissed. Repeat calls return the same time.
26
+ attr_accessor :dismissed_at
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'success' => :'success',
32
+ :'notification_id' => :'notification_id',
33
+ :'dismissed_at' => :'dismissed_at'
34
+ }
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'success' => :'Boolean',
46
+ :'notification_id' => :'String',
47
+ :'dismissed_at' => :'Time'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::PushNotificationDismissResponse` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::PushNotificationDismissResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'success')
73
+ self.success = attributes[:'success']
74
+ else
75
+ self.success = nil
76
+ end
77
+
78
+ if attributes.key?(:'notification_id')
79
+ self.notification_id = attributes[:'notification_id']
80
+ else
81
+ self.notification_id = nil
82
+ end
83
+
84
+ if attributes.key?(:'dismissed_at')
85
+ self.dismissed_at = attributes[:'dismissed_at']
86
+ else
87
+ self.dismissed_at = nil
88
+ end
89
+ end
90
+
91
+ # Show invalid properties with the reasons. Usually used together with valid?
92
+ # @return Array for valid properties with the reasons
93
+ def list_invalid_properties
94
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
95
+ invalid_properties = Array.new
96
+ if @success.nil?
97
+ invalid_properties.push('invalid value for "success", success cannot be nil.')
98
+ end
99
+
100
+ if @notification_id.nil?
101
+ invalid_properties.push('invalid value for "notification_id", notification_id cannot be nil.')
102
+ end
103
+
104
+ if @dismissed_at.nil?
105
+ invalid_properties.push('invalid value for "dismissed_at", dismissed_at cannot be nil.')
106
+ end
107
+
108
+ invalid_properties
109
+ end
110
+
111
+ # Check to see if the all the properties in the model are valid
112
+ # @return true if the model is valid
113
+ def valid?
114
+ warn '[DEPRECATED] the `valid?` method is obsolete'
115
+ return false if @success.nil?
116
+ return false if @notification_id.nil?
117
+ return false if @dismissed_at.nil?
118
+ true
119
+ end
120
+
121
+ # Checks equality by comparing each attribute.
122
+ # @param [Object] Object to be compared
123
+ def ==(o)
124
+ return true if self.equal?(o)
125
+ self.class == o.class &&
126
+ success == o.success &&
127
+ notification_id == o.notification_id &&
128
+ dismissed_at == o.dismissed_at
129
+ end
130
+
131
+ # @see the `==` method
132
+ # @param [Object] Object to be compared
133
+ def eql?(o)
134
+ self == o
135
+ end
136
+
137
+ # Calculates hash code according to all attributes.
138
+ # @return [Integer] Hash code
139
+ def hash
140
+ [success, notification_id, dismissed_at].hash
141
+ end
142
+
143
+ # Builds the object from hash
144
+ # @param [Hash] attributes Model attributes in the form of hash
145
+ # @return [Object] Returns the model itself
146
+ def self.build_from_hash(attributes)
147
+ return nil unless attributes.is_a?(Hash)
148
+ attributes = attributes.transform_keys(&:to_sym)
149
+ transformed_hash = {}
150
+ openapi_types.each_pair do |key, type|
151
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
152
+ transformed_hash["#{key}"] = nil
153
+ elsif type =~ /\AArray<(.*)>/i
154
+ # check to ensure the input is an array given that the attribute
155
+ # is documented as an array but the input is not
156
+ if attributes[attribute_map[key]].is_a?(Array)
157
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
158
+ end
159
+ elsif !attributes[attribute_map[key]].nil?
160
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
161
+ end
162
+ end
163
+ new(transformed_hash)
164
+ end
165
+
166
+ # Deserializes the data based on type
167
+ # @param string type Data type
168
+ # @param string value Value to be deserialized
169
+ # @return [Object] Deserialized data
170
+ def self._deserialize(type, value)
171
+ case type.to_sym
172
+ when :Time
173
+ Time.parse(value)
174
+ when :Date
175
+ Date.parse(value)
176
+ when :String
177
+ value.to_s
178
+ when :Integer
179
+ value.to_i
180
+ when :Float
181
+ value.to_f
182
+ when :Boolean
183
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
184
+ true
185
+ else
186
+ false
187
+ end
188
+ when :Object
189
+ # generic object (usually a Hash), return directly
190
+ value
191
+ when /\AArray<(?<inner_type>.+)>\z/
192
+ inner_type = Regexp.last_match[:inner_type]
193
+ value.map { |v| _deserialize(inner_type, v) }
194
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
195
+ k_type = Regexp.last_match[:k_type]
196
+ v_type = Regexp.last_match[:v_type]
197
+ {}.tap do |hash|
198
+ value.each do |k, v|
199
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
200
+ end
201
+ end
202
+ else # model
203
+ # models (e.g. Pet) or oneOf
204
+ klass = OpenapiClient.const_get(type)
205
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
206
+ end
207
+ end
208
+
209
+ # Returns the string representation of the object
210
+ # @return [String] String presentation of the object
211
+ def to_s
212
+ to_hash.to_s
213
+ end
214
+
215
+ # to_body is an alias to to_hash (backward compatibility)
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_body
218
+ to_hash
219
+ end
220
+
221
+ # Returns the object in the form of hash
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_hash
224
+ hash = {}
225
+ self.class.attribute_map.each_pair do |attr, param|
226
+ value = self.send(attr)
227
+ if value.nil?
228
+ is_nullable = self.class.openapi_nullable.include?(attr)
229
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
230
+ end
231
+
232
+ hash[param] = _to_hash(value)
233
+ end
234
+ hash
235
+ end
236
+
237
+ # Outputs non-array value in the form of hash
238
+ # For object, use to_hash. Otherwise, just return the value
239
+ # @param [Object] value Any valid value
240
+ # @return [Hash] Returns the value in the form of hash
241
+ def _to_hash(value)
242
+ if value.is_a?(Array)
243
+ value.compact.map { |v| _to_hash(v) }
244
+ elsif value.is_a?(Hash)
245
+ {}.tap do |hash|
246
+ value.each { |k, v| hash[k] = _to_hash(v) }
247
+ end
248
+ elsif value.respond_to? :to_hash
249
+ value.to_hash
250
+ else
251
+ value
252
+ end
253
+ end
254
+
255
+ end
256
+
257
+ end