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
@@ -0,0 +1,362 @@
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
+ # Update payload. Required fields are title and current_step. number_of_steps is optional.
18
+ class ContentStateUpdate
19
+ attr_accessor :title
20
+
21
+ attr_accessor :subtitle
22
+
23
+ attr_accessor :number_of_steps
24
+
25
+ attr_accessor :current_step
26
+
27
+ # Optional. Accent color for the Live Activity. Defaults to blue.
28
+ attr_accessor :color
29
+
30
+ # Optional. Overrides color for the current step.
31
+ attr_accessor :step_color
32
+
33
+ class EnumAttributeValidator
34
+ attr_reader :datatype
35
+ attr_reader :allowable_values
36
+
37
+ def initialize(datatype, allowable_values)
38
+ @allowable_values = allowable_values.map do |value|
39
+ case datatype.to_s
40
+ when /Integer/i
41
+ value.to_i
42
+ when /Float/i
43
+ value.to_f
44
+ else
45
+ value
46
+ end
47
+ end
48
+ end
49
+
50
+ def valid?(value)
51
+ !value || allowable_values.include?(value)
52
+ end
53
+ end
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'title' => :'title',
59
+ :'subtitle' => :'subtitle',
60
+ :'number_of_steps' => :'number_of_steps',
61
+ :'current_step' => :'current_step',
62
+ :'color' => :'color',
63
+ :'step_color' => :'step_color'
64
+ }
65
+ end
66
+
67
+ # Returns all the JSON keys this model knows about
68
+ def self.acceptable_attributes
69
+ attribute_map.values
70
+ end
71
+
72
+ # Attribute type mapping.
73
+ def self.openapi_types
74
+ {
75
+ :'title' => :'String',
76
+ :'subtitle' => :'String',
77
+ :'number_of_steps' => :'Integer',
78
+ :'current_step' => :'Integer',
79
+ :'color' => :'String',
80
+ :'step_color' => :'String'
81
+ }
82
+ end
83
+
84
+ # List of attributes with nullable: true
85
+ def self.openapi_nullable
86
+ Set.new([
87
+ ])
88
+ end
89
+
90
+ # Initializes the object
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ def initialize(attributes = {})
93
+ if (!attributes.is_a?(Hash))
94
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::ContentStateUpdate` initialize method"
95
+ end
96
+
97
+ # check to see if the attribute exists and convert string to symbol for hash key
98
+ attributes = attributes.each_with_object({}) { |(k, v), h|
99
+ if (!self.class.attribute_map.key?(k.to_sym))
100
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::ContentStateUpdate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
101
+ end
102
+ h[k.to_sym] = v
103
+ }
104
+
105
+ if attributes.key?(:'title')
106
+ self.title = attributes[:'title']
107
+ else
108
+ self.title = nil
109
+ end
110
+
111
+ if attributes.key?(:'subtitle')
112
+ self.subtitle = attributes[:'subtitle']
113
+ end
114
+
115
+ if attributes.key?(:'number_of_steps')
116
+ self.number_of_steps = attributes[:'number_of_steps']
117
+ end
118
+
119
+ if attributes.key?(:'current_step')
120
+ self.current_step = attributes[:'current_step']
121
+ else
122
+ self.current_step = nil
123
+ end
124
+
125
+ if attributes.key?(:'color')
126
+ self.color = attributes[:'color']
127
+ else
128
+ self.color = 'blue'
129
+ end
130
+
131
+ if attributes.key?(:'step_color')
132
+ self.step_color = attributes[:'step_color']
133
+ end
134
+ end
135
+
136
+ # Show invalid properties with the reasons. Usually used together with valid?
137
+ # @return Array for valid properties with the reasons
138
+ def list_invalid_properties
139
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
140
+ invalid_properties = Array.new
141
+ if @title.nil?
142
+ invalid_properties.push('invalid value for "title", title cannot be nil.')
143
+ end
144
+
145
+ if !@number_of_steps.nil? && @number_of_steps < 1
146
+ invalid_properties.push('invalid value for "number_of_steps", must be greater than or equal to 1.')
147
+ end
148
+
149
+ if @current_step.nil?
150
+ invalid_properties.push('invalid value for "current_step", current_step cannot be nil.')
151
+ end
152
+
153
+ if @current_step < 1
154
+ invalid_properties.push('invalid value for "current_step", must be greater than or equal to 1.')
155
+ end
156
+
157
+ invalid_properties
158
+ end
159
+
160
+ # Check to see if the all the properties in the model are valid
161
+ # @return true if the model is valid
162
+ def valid?
163
+ warn '[DEPRECATED] the `valid?` method is obsolete'
164
+ return false if @title.nil?
165
+ return false if !@number_of_steps.nil? && @number_of_steps < 1
166
+ return false if @current_step.nil?
167
+ return false if @current_step < 1
168
+ color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
169
+ return false unless color_validator.valid?(@color)
170
+ step_color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
171
+ return false unless step_color_validator.valid?(@step_color)
172
+ true
173
+ end
174
+
175
+ # Custom attribute writer method with validation
176
+ # @param [Object] number_of_steps Value to be assigned
177
+ def number_of_steps=(number_of_steps)
178
+ if number_of_steps.nil?
179
+ fail ArgumentError, 'number_of_steps cannot be nil'
180
+ end
181
+
182
+ if number_of_steps < 1
183
+ fail ArgumentError, 'invalid value for "number_of_steps", must be greater than or equal to 1.'
184
+ end
185
+
186
+ @number_of_steps = number_of_steps
187
+ end
188
+
189
+ # Custom attribute writer method with validation
190
+ # @param [Object] current_step Value to be assigned
191
+ def current_step=(current_step)
192
+ if current_step.nil?
193
+ fail ArgumentError, 'current_step cannot be nil'
194
+ end
195
+
196
+ if current_step < 1
197
+ fail ArgumentError, 'invalid value for "current_step", must be greater than or equal to 1.'
198
+ end
199
+
200
+ @current_step = current_step
201
+ end
202
+
203
+ # Custom attribute writer method checking allowed values (enum).
204
+ # @param [Object] color Object to be assigned
205
+ def color=(color)
206
+ validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
207
+ unless validator.valid?(color)
208
+ fail ArgumentError, "invalid value for \"color\", must be one of #{validator.allowable_values}."
209
+ end
210
+ @color = color
211
+ end
212
+
213
+ # Custom attribute writer method checking allowed values (enum).
214
+ # @param [Object] step_color Object to be assigned
215
+ def step_color=(step_color)
216
+ validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
217
+ unless validator.valid?(step_color)
218
+ fail ArgumentError, "invalid value for \"step_color\", must be one of #{validator.allowable_values}."
219
+ end
220
+ @step_color = step_color
221
+ end
222
+
223
+ # Checks equality by comparing each attribute.
224
+ # @param [Object] Object to be compared
225
+ def ==(o)
226
+ return true if self.equal?(o)
227
+ self.class == o.class &&
228
+ title == o.title &&
229
+ subtitle == o.subtitle &&
230
+ number_of_steps == o.number_of_steps &&
231
+ current_step == o.current_step &&
232
+ color == o.color &&
233
+ step_color == o.step_color
234
+ end
235
+
236
+ # @see the `==` method
237
+ # @param [Object] Object to be compared
238
+ def eql?(o)
239
+ self == o
240
+ end
241
+
242
+ # Calculates hash code according to all attributes.
243
+ # @return [Integer] Hash code
244
+ def hash
245
+ [title, subtitle, number_of_steps, current_step, color, step_color].hash
246
+ end
247
+
248
+ # Builds the object from hash
249
+ # @param [Hash] attributes Model attributes in the form of hash
250
+ # @return [Object] Returns the model itself
251
+ def self.build_from_hash(attributes)
252
+ return nil unless attributes.is_a?(Hash)
253
+ attributes = attributes.transform_keys(&:to_sym)
254
+ transformed_hash = {}
255
+ openapi_types.each_pair do |key, type|
256
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
257
+ transformed_hash["#{key}"] = nil
258
+ elsif type =~ /\AArray<(.*)>/i
259
+ # check to ensure the input is an array given that the attribute
260
+ # is documented as an array but the input is not
261
+ if attributes[attribute_map[key]].is_a?(Array)
262
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
263
+ end
264
+ elsif !attributes[attribute_map[key]].nil?
265
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
266
+ end
267
+ end
268
+ new(transformed_hash)
269
+ end
270
+
271
+ # Deserializes the data based on type
272
+ # @param string type Data type
273
+ # @param string value Value to be deserialized
274
+ # @return [Object] Deserialized data
275
+ def self._deserialize(type, value)
276
+ case type.to_sym
277
+ when :Time
278
+ Time.parse(value)
279
+ when :Date
280
+ Date.parse(value)
281
+ when :String
282
+ value.to_s
283
+ when :Integer
284
+ value.to_i
285
+ when :Float
286
+ value.to_f
287
+ when :Boolean
288
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
289
+ true
290
+ else
291
+ false
292
+ end
293
+ when :Object
294
+ # generic object (usually a Hash), return directly
295
+ value
296
+ when /\AArray<(?<inner_type>.+)>\z/
297
+ inner_type = Regexp.last_match[:inner_type]
298
+ value.map { |v| _deserialize(inner_type, v) }
299
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
300
+ k_type = Regexp.last_match[:k_type]
301
+ v_type = Regexp.last_match[:v_type]
302
+ {}.tap do |hash|
303
+ value.each do |k, v|
304
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
305
+ end
306
+ end
307
+ else # model
308
+ # models (e.g. Pet) or oneOf
309
+ klass = OpenapiClient.const_get(type)
310
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
311
+ end
312
+ end
313
+
314
+ # Returns the string representation of the object
315
+ # @return [String] String presentation of the object
316
+ def to_s
317
+ to_hash.to_s
318
+ end
319
+
320
+ # to_body is an alias to to_hash (backward compatibility)
321
+ # @return [Hash] Returns the object in the form of hash
322
+ def to_body
323
+ to_hash
324
+ end
325
+
326
+ # Returns the object in the form of hash
327
+ # @return [Hash] Returns the object in the form of hash
328
+ def to_hash
329
+ hash = {}
330
+ self.class.attribute_map.each_pair do |attr, param|
331
+ value = self.send(attr)
332
+ if value.nil?
333
+ is_nullable = self.class.openapi_nullable.include?(attr)
334
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
335
+ end
336
+
337
+ hash[param] = _to_hash(value)
338
+ end
339
+ hash
340
+ end
341
+
342
+ # Outputs non-array value in the form of hash
343
+ # For object, use to_hash. Otherwise, just return the value
344
+ # @param [Object] value Any valid value
345
+ # @return [Hash] Returns the value in the form of hash
346
+ def _to_hash(value)
347
+ if value.is_a?(Array)
348
+ value.compact.map { |v| _to_hash(v) }
349
+ elsif value.is_a?(Hash)
350
+ {}.tap do |hash|
351
+ value.each { |k, v| hash[k] = _to_hash(v) }
352
+ end
353
+ elsif value.respond_to? :to_hash
354
+ value.to_hash
355
+ else
356
+ value
357
+ end
358
+ end
359
+
360
+ end
361
+
362
+ end
@@ -0,0 +1,237 @@
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 LiveActivityEndRequest
18
+ attr_accessor :activity_id
19
+
20
+ attr_accessor :content_state
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'activity_id' => :'activity_id',
26
+ :'content_state' => :'content_state'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'activity_id' => :'String',
39
+ :'content_state' => :'ContentStateEnd'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::LiveActivityEndRequest` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::LiveActivityEndRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'activity_id')
65
+ self.activity_id = attributes[:'activity_id']
66
+ else
67
+ self.activity_id = nil
68
+ end
69
+
70
+ if attributes.key?(:'content_state')
71
+ self.content_state = attributes[:'content_state']
72
+ else
73
+ self.content_state = nil
74
+ end
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
81
+ invalid_properties = Array.new
82
+ if @activity_id.nil?
83
+ invalid_properties.push('invalid value for "activity_id", activity_id cannot be nil.')
84
+ end
85
+
86
+ if @content_state.nil?
87
+ invalid_properties.push('invalid value for "content_state", content_state cannot be nil.')
88
+ end
89
+
90
+ invalid_properties
91
+ end
92
+
93
+ # Check to see if the all the properties in the model are valid
94
+ # @return true if the model is valid
95
+ def valid?
96
+ warn '[DEPRECATED] the `valid?` method is obsolete'
97
+ return false if @activity_id.nil?
98
+ return false if @content_state.nil?
99
+ true
100
+ end
101
+
102
+ # Checks equality by comparing each attribute.
103
+ # @param [Object] Object to be compared
104
+ def ==(o)
105
+ return true if self.equal?(o)
106
+ self.class == o.class &&
107
+ activity_id == o.activity_id &&
108
+ content_state == o.content_state
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] Object to be compared
113
+ def eql?(o)
114
+ self == o
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Integer] Hash code
119
+ def hash
120
+ [activity_id, content_state].hash
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def self.build_from_hash(attributes)
127
+ return nil unless attributes.is_a?(Hash)
128
+ attributes = attributes.transform_keys(&:to_sym)
129
+ transformed_hash = {}
130
+ openapi_types.each_pair do |key, type|
131
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
132
+ transformed_hash["#{key}"] = nil
133
+ elsif type =~ /\AArray<(.*)>/i
134
+ # check to ensure the input is an array given that the attribute
135
+ # is documented as an array but the input is not
136
+ if attributes[attribute_map[key]].is_a?(Array)
137
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
138
+ end
139
+ elsif !attributes[attribute_map[key]].nil?
140
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
141
+ end
142
+ end
143
+ new(transformed_hash)
144
+ end
145
+
146
+ # Deserializes the data based on type
147
+ # @param string type Data type
148
+ # @param string value Value to be deserialized
149
+ # @return [Object] Deserialized data
150
+ def self._deserialize(type, value)
151
+ case type.to_sym
152
+ when :Time
153
+ Time.parse(value)
154
+ when :Date
155
+ Date.parse(value)
156
+ when :String
157
+ value.to_s
158
+ when :Integer
159
+ value.to_i
160
+ when :Float
161
+ value.to_f
162
+ when :Boolean
163
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
164
+ true
165
+ else
166
+ false
167
+ end
168
+ when :Object
169
+ # generic object (usually a Hash), return directly
170
+ value
171
+ when /\AArray<(?<inner_type>.+)>\z/
172
+ inner_type = Regexp.last_match[:inner_type]
173
+ value.map { |v| _deserialize(inner_type, v) }
174
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
175
+ k_type = Regexp.last_match[:k_type]
176
+ v_type = Regexp.last_match[:v_type]
177
+ {}.tap do |hash|
178
+ value.each do |k, v|
179
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
180
+ end
181
+ end
182
+ else # model
183
+ # models (e.g. Pet) or oneOf
184
+ klass = OpenapiClient.const_get(type)
185
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
186
+ end
187
+ end
188
+
189
+ # Returns the string representation of the object
190
+ # @return [String] String presentation of the object
191
+ def to_s
192
+ to_hash.to_s
193
+ end
194
+
195
+ # to_body is an alias to to_hash (backward compatibility)
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_body
198
+ to_hash
199
+ end
200
+
201
+ # Returns the object in the form of hash
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_hash
204
+ hash = {}
205
+ self.class.attribute_map.each_pair do |attr, param|
206
+ value = self.send(attr)
207
+ if value.nil?
208
+ is_nullable = self.class.openapi_nullable.include?(attr)
209
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
210
+ end
211
+
212
+ hash[param] = _to_hash(value)
213
+ end
214
+ hash
215
+ end
216
+
217
+ # Outputs non-array value in the form of hash
218
+ # For object, use to_hash. Otherwise, just return the value
219
+ # @param [Object] value Any valid value
220
+ # @return [Hash] Returns the value in the form of hash
221
+ def _to_hash(value)
222
+ if value.is_a?(Array)
223
+ value.compact.map { |v| _to_hash(v) }
224
+ elsif value.is_a?(Hash)
225
+ {}.tap do |hash|
226
+ value.each { |k, v| hash[k] = _to_hash(v) }
227
+ end
228
+ elsif value.respond_to? :to_hash
229
+ value.to_hash
230
+ else
231
+ value
232
+ end
233
+ end
234
+
235
+ end
236
+
237
+ end