activitysmith 0.1.7 → 1.1.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 (24) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +337 -77
  3. data/generated/activitysmith_openapi/api/live_activities_api.rb +168 -6
  4. data/generated/activitysmith_openapi/models/activity_metric.rb +293 -0
  5. data/generated/activitysmith_openapi/models/content_state_end.rb +47 -4
  6. data/generated/activitysmith_openapi/models/content_state_start.rb +50 -7
  7. data/generated/activitysmith_openapi/models/content_state_update.rb +50 -7
  8. data/generated/activitysmith_openapi/models/live_activity_action.rb +323 -0
  9. data/generated/activitysmith_openapi/models/live_activity_action_type.rb +40 -0
  10. data/generated/activitysmith_openapi/models/live_activity_end_request.rb +13 -4
  11. data/generated/activitysmith_openapi/models/live_activity_start_request.rb +10 -1
  12. data/generated/activitysmith_openapi/models/live_activity_stream_delete_request.rb +233 -0
  13. data/generated/activitysmith_openapi/models/live_activity_stream_delete_response.rb +332 -0
  14. data/generated/activitysmith_openapi/models/live_activity_stream_put_response.rb +361 -0
  15. data/generated/activitysmith_openapi/models/live_activity_stream_request.rb +280 -0
  16. data/generated/activitysmith_openapi/models/live_activity_update_request.rb +13 -4
  17. data/generated/activitysmith_openapi/models/live_activity_webhook_method.rb +40 -0
  18. data/generated/activitysmith_openapi/models/not_found_error.rb +237 -0
  19. data/generated/activitysmith_openapi/models/stream_content_state.rb +538 -0
  20. data/generated/activitysmith_openapi/version.rb +1 -1
  21. data/generated/activitysmith_openapi.rb +10 -0
  22. data/lib/activitysmith/live_activities.rb +19 -0
  23. data/lib/activitysmith/version.rb +1 -1
  24. metadata +12 -2
@@ -20,11 +20,14 @@ module OpenapiClient
20
20
 
21
21
  attr_accessor :content_state
22
22
 
23
+ attr_accessor :action
24
+
23
25
  # Attribute mapping from ruby-style variable name to JSON key.
24
26
  def self.attribute_map
25
27
  {
26
28
  :'activity_id' => :'activity_id',
27
- :'content_state' => :'content_state'
29
+ :'content_state' => :'content_state',
30
+ :'action' => :'action'
28
31
  }
29
32
  end
30
33
 
@@ -37,7 +40,8 @@ module OpenapiClient
37
40
  def self.openapi_types
38
41
  {
39
42
  :'activity_id' => :'String',
40
- :'content_state' => :'ContentStateEnd'
43
+ :'content_state' => :'ContentStateEnd',
44
+ :'action' => :'LiveActivityAction'
41
45
  }
42
46
  end
43
47
 
@@ -73,6 +77,10 @@ module OpenapiClient
73
77
  else
74
78
  self.content_state = nil
75
79
  end
80
+
81
+ if attributes.key?(:'action')
82
+ self.action = attributes[:'action']
83
+ end
76
84
  end
77
85
 
78
86
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -106,7 +114,8 @@ module OpenapiClient
106
114
  return true if self.equal?(o)
107
115
  self.class == o.class &&
108
116
  activity_id == o.activity_id &&
109
- content_state == o.content_state
117
+ content_state == o.content_state &&
118
+ action == o.action
110
119
  end
111
120
 
112
121
  # @see the `==` method
@@ -118,7 +127,7 @@ module OpenapiClient
118
127
  # Calculates hash code according to all attributes.
119
128
  # @return [Integer] Hash code
120
129
  def hash
121
- [activity_id, content_state].hash
130
+ [activity_id, content_state, action].hash
122
131
  end
123
132
 
124
133
  # Builds the object from hash
@@ -18,6 +18,8 @@ module OpenapiClient
18
18
  class LiveActivityStartRequest
19
19
  attr_accessor :content_state
20
20
 
21
+ attr_accessor :action
22
+
21
23
  attr_accessor :alert
22
24
 
23
25
  attr_accessor :target
@@ -26,6 +28,7 @@ module OpenapiClient
26
28
  def self.attribute_map
27
29
  {
28
30
  :'content_state' => :'content_state',
31
+ :'action' => :'action',
29
32
  :'alert' => :'alert',
30
33
  :'target' => :'target'
31
34
  }
@@ -40,6 +43,7 @@ module OpenapiClient
40
43
  def self.openapi_types
41
44
  {
42
45
  :'content_state' => :'ContentStateStart',
46
+ :'action' => :'LiveActivityAction',
43
47
  :'alert' => :'AlertPayload',
44
48
  :'target' => :'ChannelTarget'
45
49
  }
@@ -72,6 +76,10 @@ module OpenapiClient
72
76
  self.content_state = nil
73
77
  end
74
78
 
79
+ if attributes.key?(:'action')
80
+ self.action = attributes[:'action']
81
+ end
82
+
75
83
  if attributes.key?(:'alert')
76
84
  self.alert = attributes[:'alert']
77
85
  end
@@ -107,6 +115,7 @@ module OpenapiClient
107
115
  return true if self.equal?(o)
108
116
  self.class == o.class &&
109
117
  content_state == o.content_state &&
118
+ action == o.action &&
110
119
  alert == o.alert &&
111
120
  target == o.target
112
121
  end
@@ -120,7 +129,7 @@ module OpenapiClient
120
129
  # Calculates hash code according to all attributes.
121
130
  # @return [Integer] Hash code
122
131
  def hash
123
- [content_state, alert, target].hash
132
+ [content_state, action, alert, target].hash
124
133
  end
125
134
 
126
135
  # Builds the object from hash
@@ -0,0 +1,233 @@
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
+ # Optional payload for ending a managed stream. When omitted, ActivitySmith ends the stream using the latest known state when possible.
18
+ class LiveActivityStreamDeleteRequest
19
+ attr_accessor :content_state
20
+
21
+ attr_accessor :action
22
+
23
+ attr_accessor :alert
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'content_state' => :'content_state',
29
+ :'action' => :'action',
30
+ :'alert' => :'alert'
31
+ }
32
+ end
33
+
34
+ # Returns all the JSON keys this model knows about
35
+ def self.acceptable_attributes
36
+ attribute_map.values
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'content_state' => :'StreamContentState',
43
+ :'action' => :'LiveActivityAction',
44
+ :'alert' => :'AlertPayload'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::LiveActivityStreamDeleteRequest` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h|
63
+ if (!self.class.attribute_map.key?(k.to_sym))
64
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::LiveActivityStreamDeleteRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ end
66
+ h[k.to_sym] = v
67
+ }
68
+
69
+ if attributes.key?(:'content_state')
70
+ self.content_state = attributes[:'content_state']
71
+ end
72
+
73
+ if attributes.key?(:'action')
74
+ self.action = attributes[:'action']
75
+ end
76
+
77
+ if attributes.key?(:'alert')
78
+ self.alert = attributes[:'alert']
79
+ end
80
+ end
81
+
82
+ # Show invalid properties with the reasons. Usually used together with valid?
83
+ # @return Array for valid properties with the reasons
84
+ def list_invalid_properties
85
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
86
+ invalid_properties = Array.new
87
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ warn '[DEPRECATED] the `valid?` method is obsolete'
94
+ true
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
99
+ def ==(o)
100
+ return true if self.equal?(o)
101
+ self.class == o.class &&
102
+ content_state == o.content_state &&
103
+ action == o.action &&
104
+ alert == o.alert
105
+ end
106
+
107
+ # @see the `==` method
108
+ # @param [Object] Object to be compared
109
+ def eql?(o)
110
+ self == o
111
+ end
112
+
113
+ # Calculates hash code according to all attributes.
114
+ # @return [Integer] Hash code
115
+ def hash
116
+ [content_state, action, alert].hash
117
+ end
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def self.build_from_hash(attributes)
123
+ return nil unless attributes.is_a?(Hash)
124
+ attributes = attributes.transform_keys(&:to_sym)
125
+ transformed_hash = {}
126
+ openapi_types.each_pair do |key, type|
127
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
128
+ transformed_hash["#{key}"] = nil
129
+ elsif type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[attribute_map[key]].is_a?(Array)
133
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
134
+ end
135
+ elsif !attributes[attribute_map[key]].nil?
136
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
137
+ end
138
+ end
139
+ new(transformed_hash)
140
+ end
141
+
142
+ # Deserializes the data based on type
143
+ # @param string type Data type
144
+ # @param string value Value to be deserialized
145
+ # @return [Object] Deserialized data
146
+ def self._deserialize(type, value)
147
+ case type.to_sym
148
+ when :Time
149
+ Time.parse(value)
150
+ when :Date
151
+ Date.parse(value)
152
+ when :String
153
+ value.to_s
154
+ when :Integer
155
+ value.to_i
156
+ when :Float
157
+ value.to_f
158
+ when :Boolean
159
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
160
+ true
161
+ else
162
+ false
163
+ end
164
+ when :Object
165
+ # generic object (usually a Hash), return directly
166
+ value
167
+ when /\AArray<(?<inner_type>.+)>\z/
168
+ inner_type = Regexp.last_match[:inner_type]
169
+ value.map { |v| _deserialize(inner_type, v) }
170
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
171
+ k_type = Regexp.last_match[:k_type]
172
+ v_type = Regexp.last_match[:v_type]
173
+ {}.tap do |hash|
174
+ value.each do |k, v|
175
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
176
+ end
177
+ end
178
+ else # model
179
+ # models (e.g. Pet) or oneOf
180
+ klass = OpenapiClient.const_get(type)
181
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
182
+ end
183
+ end
184
+
185
+ # Returns the string representation of the object
186
+ # @return [String] String presentation of the object
187
+ def to_s
188
+ to_hash.to_s
189
+ end
190
+
191
+ # to_body is an alias to to_hash (backward compatibility)
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_body
194
+ to_hash
195
+ end
196
+
197
+ # Returns the object in the form of hash
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_hash
200
+ hash = {}
201
+ self.class.attribute_map.each_pair do |attr, param|
202
+ value = self.send(attr)
203
+ if value.nil?
204
+ is_nullable = self.class.openapi_nullable.include?(attr)
205
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
206
+ end
207
+
208
+ hash[param] = _to_hash(value)
209
+ end
210
+ hash
211
+ end
212
+
213
+ # Outputs non-array value in the form of hash
214
+ # For object, use to_hash. Otherwise, just return the value
215
+ # @param [Object] value Any valid value
216
+ # @return [Hash] Returns the value in the form of hash
217
+ def _to_hash(value)
218
+ if value.is_a?(Array)
219
+ value.compact.map { |v| _to_hash(v) }
220
+ elsif value.is_a?(Hash)
221
+ {}.tap do |hash|
222
+ value.each { |k, v| hash[k] = _to_hash(v) }
223
+ end
224
+ elsif value.respond_to? :to_hash
225
+ value.to_hash
226
+ else
227
+ value
228
+ end
229
+ end
230
+
231
+ end
232
+
233
+ end
@@ -0,0 +1,332 @@
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
+ # Returned after a managed stream is ended and removed.
18
+ class LiveActivityStreamDeleteResponse
19
+ attr_accessor :success
20
+
21
+ attr_accessor :operation
22
+
23
+ attr_accessor :stream_key
24
+
25
+ attr_accessor :activity_id
26
+
27
+ attr_accessor :devices_queued
28
+
29
+ attr_accessor :devices_notified
30
+
31
+ attr_accessor :timestamp
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
+ :'success' => :'success',
59
+ :'operation' => :'operation',
60
+ :'stream_key' => :'stream_key',
61
+ :'activity_id' => :'activity_id',
62
+ :'devices_queued' => :'devices_queued',
63
+ :'devices_notified' => :'devices_notified',
64
+ :'timestamp' => :'timestamp'
65
+ }
66
+ end
67
+
68
+ # Returns all the JSON keys this model knows about
69
+ def self.acceptable_attributes
70
+ attribute_map.values
71
+ end
72
+
73
+ # Attribute type mapping.
74
+ def self.openapi_types
75
+ {
76
+ :'success' => :'Boolean',
77
+ :'operation' => :'String',
78
+ :'stream_key' => :'String',
79
+ :'activity_id' => :'String',
80
+ :'devices_queued' => :'Integer',
81
+ :'devices_notified' => :'Integer',
82
+ :'timestamp' => :'Time'
83
+ }
84
+ end
85
+
86
+ # List of attributes with nullable: true
87
+ def self.openapi_nullable
88
+ Set.new([
89
+ :'activity_id',
90
+ ])
91
+ end
92
+
93
+ # Initializes the object
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ def initialize(attributes = {})
96
+ if (!attributes.is_a?(Hash))
97
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::LiveActivityStreamDeleteResponse` initialize method"
98
+ end
99
+
100
+ # check to see if the attribute exists and convert string to symbol for hash key
101
+ attributes = attributes.each_with_object({}) { |(k, v), h|
102
+ if (!self.class.attribute_map.key?(k.to_sym))
103
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::LiveActivityStreamDeleteResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
104
+ end
105
+ h[k.to_sym] = v
106
+ }
107
+
108
+ if attributes.key?(:'success')
109
+ self.success = attributes[:'success']
110
+ else
111
+ self.success = nil
112
+ end
113
+
114
+ if attributes.key?(:'operation')
115
+ self.operation = attributes[:'operation']
116
+ else
117
+ self.operation = nil
118
+ end
119
+
120
+ if attributes.key?(:'stream_key')
121
+ self.stream_key = attributes[:'stream_key']
122
+ else
123
+ self.stream_key = nil
124
+ end
125
+
126
+ if attributes.key?(:'activity_id')
127
+ self.activity_id = attributes[:'activity_id']
128
+ end
129
+
130
+ if attributes.key?(:'devices_queued')
131
+ self.devices_queued = attributes[:'devices_queued']
132
+ end
133
+
134
+ if attributes.key?(:'devices_notified')
135
+ self.devices_notified = attributes[:'devices_notified']
136
+ end
137
+
138
+ if attributes.key?(:'timestamp')
139
+ self.timestamp = attributes[:'timestamp']
140
+ else
141
+ self.timestamp = nil
142
+ end
143
+ end
144
+
145
+ # Show invalid properties with the reasons. Usually used together with valid?
146
+ # @return Array for valid properties with the reasons
147
+ def list_invalid_properties
148
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
149
+ invalid_properties = Array.new
150
+ if @success.nil?
151
+ invalid_properties.push('invalid value for "success", success cannot be nil.')
152
+ end
153
+
154
+ if @operation.nil?
155
+ invalid_properties.push('invalid value for "operation", operation cannot be nil.')
156
+ end
157
+
158
+ if @stream_key.nil?
159
+ invalid_properties.push('invalid value for "stream_key", stream_key cannot be nil.')
160
+ end
161
+
162
+ if @timestamp.nil?
163
+ invalid_properties.push('invalid value for "timestamp", timestamp cannot be nil.')
164
+ end
165
+
166
+ invalid_properties
167
+ end
168
+
169
+ # Check to see if the all the properties in the model are valid
170
+ # @return true if the model is valid
171
+ def valid?
172
+ warn '[DEPRECATED] the `valid?` method is obsolete'
173
+ return false if @success.nil?
174
+ return false if @operation.nil?
175
+ operation_validator = EnumAttributeValidator.new('String', ["ended"])
176
+ return false unless operation_validator.valid?(@operation)
177
+ return false if @stream_key.nil?
178
+ return false if @timestamp.nil?
179
+ true
180
+ end
181
+
182
+ # Custom attribute writer method checking allowed values (enum).
183
+ # @param [Object] operation Object to be assigned
184
+ def operation=(operation)
185
+ validator = EnumAttributeValidator.new('String', ["ended"])
186
+ unless validator.valid?(operation)
187
+ fail ArgumentError, "invalid value for \"operation\", must be one of #{validator.allowable_values}."
188
+ end
189
+ @operation = operation
190
+ end
191
+
192
+ # Checks equality by comparing each attribute.
193
+ # @param [Object] Object to be compared
194
+ def ==(o)
195
+ return true if self.equal?(o)
196
+ self.class == o.class &&
197
+ success == o.success &&
198
+ operation == o.operation &&
199
+ stream_key == o.stream_key &&
200
+ activity_id == o.activity_id &&
201
+ devices_queued == o.devices_queued &&
202
+ devices_notified == o.devices_notified &&
203
+ timestamp == o.timestamp
204
+ end
205
+
206
+ # @see the `==` method
207
+ # @param [Object] Object to be compared
208
+ def eql?(o)
209
+ self == o
210
+ end
211
+
212
+ # Calculates hash code according to all attributes.
213
+ # @return [Integer] Hash code
214
+ def hash
215
+ [success, operation, stream_key, activity_id, devices_queued, devices_notified, timestamp].hash
216
+ end
217
+
218
+ # Builds the object from hash
219
+ # @param [Hash] attributes Model attributes in the form of hash
220
+ # @return [Object] Returns the model itself
221
+ def self.build_from_hash(attributes)
222
+ return nil unless attributes.is_a?(Hash)
223
+ attributes = attributes.transform_keys(&:to_sym)
224
+ transformed_hash = {}
225
+ openapi_types.each_pair do |key, type|
226
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
227
+ transformed_hash["#{key}"] = nil
228
+ elsif type =~ /\AArray<(.*)>/i
229
+ # check to ensure the input is an array given that the attribute
230
+ # is documented as an array but the input is not
231
+ if attributes[attribute_map[key]].is_a?(Array)
232
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
233
+ end
234
+ elsif !attributes[attribute_map[key]].nil?
235
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
236
+ end
237
+ end
238
+ new(transformed_hash)
239
+ end
240
+
241
+ # Deserializes the data based on type
242
+ # @param string type Data type
243
+ # @param string value Value to be deserialized
244
+ # @return [Object] Deserialized data
245
+ def self._deserialize(type, value)
246
+ case type.to_sym
247
+ when :Time
248
+ Time.parse(value)
249
+ when :Date
250
+ Date.parse(value)
251
+ when :String
252
+ value.to_s
253
+ when :Integer
254
+ value.to_i
255
+ when :Float
256
+ value.to_f
257
+ when :Boolean
258
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
259
+ true
260
+ else
261
+ false
262
+ end
263
+ when :Object
264
+ # generic object (usually a Hash), return directly
265
+ value
266
+ when /\AArray<(?<inner_type>.+)>\z/
267
+ inner_type = Regexp.last_match[:inner_type]
268
+ value.map { |v| _deserialize(inner_type, v) }
269
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
270
+ k_type = Regexp.last_match[:k_type]
271
+ v_type = Regexp.last_match[:v_type]
272
+ {}.tap do |hash|
273
+ value.each do |k, v|
274
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
275
+ end
276
+ end
277
+ else # model
278
+ # models (e.g. Pet) or oneOf
279
+ klass = OpenapiClient.const_get(type)
280
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
281
+ end
282
+ end
283
+
284
+ # Returns the string representation of the object
285
+ # @return [String] String presentation of the object
286
+ def to_s
287
+ to_hash.to_s
288
+ end
289
+
290
+ # to_body is an alias to to_hash (backward compatibility)
291
+ # @return [Hash] Returns the object in the form of hash
292
+ def to_body
293
+ to_hash
294
+ end
295
+
296
+ # Returns the object in the form of hash
297
+ # @return [Hash] Returns the object in the form of hash
298
+ def to_hash
299
+ hash = {}
300
+ self.class.attribute_map.each_pair do |attr, param|
301
+ value = self.send(attr)
302
+ if value.nil?
303
+ is_nullable = self.class.openapi_nullable.include?(attr)
304
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
305
+ end
306
+
307
+ hash[param] = _to_hash(value)
308
+ end
309
+ hash
310
+ end
311
+
312
+ # Outputs non-array value in the form of hash
313
+ # For object, use to_hash. Otherwise, just return the value
314
+ # @param [Object] value Any valid value
315
+ # @return [Hash] Returns the value in the form of hash
316
+ def _to_hash(value)
317
+ if value.is_a?(Array)
318
+ value.compact.map { |v| _to_hash(v) }
319
+ elsif value.is_a?(Hash)
320
+ {}.tap do |hash|
321
+ value.each { |k, v| hash[k] = _to_hash(v) }
322
+ end
323
+ elsif value.respond_to? :to_hash
324
+ value.to_hash
325
+ else
326
+ value
327
+ end
328
+ end
329
+
330
+ end
331
+
332
+ end