mailslurp_client 12.4.6 → 12.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client.rb +13 -0
  3. data/lib/mailslurp_client/api/contact_controller_api.rb +4 -4
  4. data/lib/mailslurp_client/api/email_controller_api.rb +64 -0
  5. data/lib/mailslurp_client/api/group_controller_api.rb +4 -4
  6. data/lib/mailslurp_client/api/inbox_controller_api.rb +234 -8
  7. data/lib/mailslurp_client/api/inbox_ruleset_controller_api.rb +548 -0
  8. data/lib/mailslurp_client/api/missed_email_controller_api.rb +81 -7
  9. data/lib/mailslurp_client/api/sent_emails_controller_api.rb +150 -4
  10. data/lib/mailslurp_client/api/template_controller_api.rb +4 -4
  11. data/lib/mailslurp_client/api/tracking_controller_api.rb +218 -0
  12. data/lib/mailslurp_client/api/wait_for_controller_api.rb +2 -2
  13. data/lib/mailslurp_client/api/webhook_controller_api.rb +55 -1
  14. data/lib/mailslurp_client/models/abstract_webhook_payload.rb +3 -3
  15. data/lib/mailslurp_client/models/create_inbox_ruleset_options.rb +274 -0
  16. data/lib/mailslurp_client/models/create_tracking_pixel_options.rb +215 -0
  17. data/lib/mailslurp_client/models/create_webhook_options.rb +3 -3
  18. data/lib/mailslurp_client/models/inbox_ruleset_dto.rb +353 -0
  19. data/lib/mailslurp_client/models/inbox_ruleset_test_options.rb +211 -0
  20. data/lib/mailslurp_client/models/inbox_ruleset_test_result.rb +223 -0
  21. data/lib/mailslurp_client/models/page_inbox_ruleset_dto.rb +299 -0
  22. data/lib/mailslurp_client/models/page_tracking_pixel_projection.rb +299 -0
  23. data/lib/mailslurp_client/models/send_email_options.rb +11 -1
  24. data/lib/mailslurp_client/models/sent_email_dto.rb +12 -1
  25. data/lib/mailslurp_client/models/test_new_inbox_ruleset_options.rb +225 -0
  26. data/lib/mailslurp_client/models/tracking_pixel_dto.rb +303 -0
  27. data/lib/mailslurp_client/models/tracking_pixel_projection.rb +289 -0
  28. data/lib/mailslurp_client/models/webhook_dto.rb +2 -2
  29. data/lib/mailslurp_client/models/webhook_email_opened_payload.rb +322 -0
  30. data/lib/mailslurp_client/models/webhook_new_attachment_payload.rb +2 -2
  31. data/lib/mailslurp_client/models/webhook_new_contact_payload.rb +2 -2
  32. data/lib/mailslurp_client/models/webhook_new_email_payload.rb +2 -2
  33. data/lib/mailslurp_client/models/webhook_result_entity.rb +2 -2
  34. data/lib/mailslurp_client/version.rb +1 -1
  35. metadata +15 -2
@@ -17,7 +17,7 @@ module MailSlurpClient
17
17
  class CreateWebhookOptions
18
18
  attr_accessor :basic_auth
19
19
 
20
- # Optional webhook event name. Default is `EMAIL_RECEIVED` and is triggered when an email is received by the inbox associated with the webhook. Payload differ according to the webhook event name. The other events are `NEW_EMAIL`, `NEW_CONTACT`, and `NEW_ATTACHMENT`.
20
+ # Optional webhook event name. Default is `EMAIL_RECEIVED` and is triggered when an email is received by the inbox associated with the webhook. Payload differ according to the webhook event name. The other events are `NEW_EMAIL`, `NEW_CONTACT`, and `NEW_ATTACHMENT` and `EMAIL_OPENED`. `EMAIL_OPENED` requires the use of tracking pixels when sending. See the email tracking guide for more information.
21
21
  attr_accessor :event_name
22
22
 
23
23
  # Optional name for the webhook
@@ -116,7 +116,7 @@ module MailSlurpClient
116
116
  # Check to see if the all the properties in the model are valid
117
117
  # @return true if the model is valid
118
118
  def valid?
119
- event_name_validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT"])
119
+ event_name_validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED"])
120
120
  return false unless event_name_validator.valid?(@event_name)
121
121
  true
122
122
  end
@@ -124,7 +124,7 @@ module MailSlurpClient
124
124
  # Custom attribute writer method checking allowed values (enum).
125
125
  # @param [Object] event_name Object to be assigned
126
126
  def event_name=(event_name)
127
- validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT"])
127
+ validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED"])
128
128
  unless validator.valid?(event_name)
129
129
  fail ArgumentError, "invalid value for \"event_name\", must be one of #{validator.allowable_values}."
130
130
  end
@@ -0,0 +1,353 @@
1
+ =begin
2
+ #MailSlurp API
3
+
4
+ #MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://www.mailslurp.com/docs/) - [Examples](https://github.com/mailslurp/examples) repository
5
+
6
+ The version of the OpenAPI document: 6.5.2
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module MailSlurpClient
16
+ class InboxRulesetDto
17
+ attr_accessor :action
18
+
19
+ attr_accessor :created_at
20
+
21
+ attr_accessor :handler
22
+
23
+ attr_accessor :id
24
+
25
+ attr_accessor :inbox_id
26
+
27
+ attr_accessor :scope
28
+
29
+ attr_accessor :target
30
+
31
+ class EnumAttributeValidator
32
+ attr_reader :datatype
33
+ attr_reader :allowable_values
34
+
35
+ def initialize(datatype, allowable_values)
36
+ @allowable_values = allowable_values.map do |value|
37
+ case datatype.to_s
38
+ when /Integer/i
39
+ value.to_i
40
+ when /Float/i
41
+ value.to_f
42
+ else
43
+ value
44
+ end
45
+ end
46
+ end
47
+
48
+ def valid?(value)
49
+ !value || allowable_values.include?(value)
50
+ end
51
+ end
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'action' => :'action',
57
+ :'created_at' => :'createdAt',
58
+ :'handler' => :'handler',
59
+ :'id' => :'id',
60
+ :'inbox_id' => :'inboxId',
61
+ :'scope' => :'scope',
62
+ :'target' => :'target'
63
+ }
64
+ end
65
+
66
+ # Attribute type mapping.
67
+ def self.openapi_types
68
+ {
69
+ :'action' => :'String',
70
+ :'created_at' => :'DateTime',
71
+ :'handler' => :'String',
72
+ :'id' => :'String',
73
+ :'inbox_id' => :'String',
74
+ :'scope' => :'String',
75
+ :'target' => :'String'
76
+ }
77
+ end
78
+
79
+ # List of attributes with nullable: true
80
+ def self.openapi_nullable
81
+ Set.new([
82
+ ])
83
+ end
84
+
85
+ # Initializes the object
86
+ # @param [Hash] attributes Model attributes in the form of hash
87
+ def initialize(attributes = {})
88
+ if (!attributes.is_a?(Hash))
89
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::InboxRulesetDto` initialize method"
90
+ end
91
+
92
+ # check to see if the attribute exists and convert string to symbol for hash key
93
+ attributes = attributes.each_with_object({}) { |(k, v), h|
94
+ if (!self.class.attribute_map.key?(k.to_sym))
95
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::InboxRulesetDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
96
+ end
97
+ h[k.to_sym] = v
98
+ }
99
+
100
+ if attributes.key?(:'action')
101
+ self.action = attributes[:'action']
102
+ end
103
+
104
+ if attributes.key?(:'created_at')
105
+ self.created_at = attributes[:'created_at']
106
+ end
107
+
108
+ if attributes.key?(:'handler')
109
+ self.handler = attributes[:'handler']
110
+ end
111
+
112
+ if attributes.key?(:'id')
113
+ self.id = attributes[:'id']
114
+ end
115
+
116
+ if attributes.key?(:'inbox_id')
117
+ self.inbox_id = attributes[:'inbox_id']
118
+ end
119
+
120
+ if attributes.key?(:'scope')
121
+ self.scope = attributes[:'scope']
122
+ end
123
+
124
+ if attributes.key?(:'target')
125
+ self.target = attributes[:'target']
126
+ end
127
+ end
128
+
129
+ # Show invalid properties with the reasons. Usually used together with valid?
130
+ # @return Array for valid properties with the reasons
131
+ def list_invalid_properties
132
+ invalid_properties = Array.new
133
+ if @action.nil?
134
+ invalid_properties.push('invalid value for "action", action cannot be nil.')
135
+ end
136
+
137
+ if @created_at.nil?
138
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
139
+ end
140
+
141
+ if @handler.nil?
142
+ invalid_properties.push('invalid value for "handler", handler cannot be nil.')
143
+ end
144
+
145
+ if @id.nil?
146
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
147
+ end
148
+
149
+ if @inbox_id.nil?
150
+ invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
151
+ end
152
+
153
+ if @scope.nil?
154
+ invalid_properties.push('invalid value for "scope", scope cannot be nil.')
155
+ end
156
+
157
+ if @target.nil?
158
+ invalid_properties.push('invalid value for "target", target cannot be nil.')
159
+ end
160
+
161
+ invalid_properties
162
+ end
163
+
164
+ # Check to see if the all the properties in the model are valid
165
+ # @return true if the model is valid
166
+ def valid?
167
+ return false if @action.nil?
168
+ action_validator = EnumAttributeValidator.new('String', ["BLOCK", "ALLOW", "FILTER_REMOVE"])
169
+ return false unless action_validator.valid?(@action)
170
+ return false if @created_at.nil?
171
+ return false if @handler.nil?
172
+ handler_validator = EnumAttributeValidator.new('String', ["EXCEPTION"])
173
+ return false unless handler_validator.valid?(@handler)
174
+ return false if @id.nil?
175
+ return false if @inbox_id.nil?
176
+ return false if @scope.nil?
177
+ scope_validator = EnumAttributeValidator.new('String', ["RECEIVING_EMAILS", "SENDING_EMAILS"])
178
+ return false unless scope_validator.valid?(@scope)
179
+ return false if @target.nil?
180
+ true
181
+ end
182
+
183
+ # Custom attribute writer method checking allowed values (enum).
184
+ # @param [Object] action Object to be assigned
185
+ def action=(action)
186
+ validator = EnumAttributeValidator.new('String', ["BLOCK", "ALLOW", "FILTER_REMOVE"])
187
+ unless validator.valid?(action)
188
+ fail ArgumentError, "invalid value for \"action\", must be one of #{validator.allowable_values}."
189
+ end
190
+ @action = action
191
+ end
192
+
193
+ # Custom attribute writer method checking allowed values (enum).
194
+ # @param [Object] handler Object to be assigned
195
+ def handler=(handler)
196
+ validator = EnumAttributeValidator.new('String', ["EXCEPTION"])
197
+ unless validator.valid?(handler)
198
+ fail ArgumentError, "invalid value for \"handler\", must be one of #{validator.allowable_values}."
199
+ end
200
+ @handler = handler
201
+ end
202
+
203
+ # Custom attribute writer method checking allowed values (enum).
204
+ # @param [Object] scope Object to be assigned
205
+ def scope=(scope)
206
+ validator = EnumAttributeValidator.new('String', ["RECEIVING_EMAILS", "SENDING_EMAILS"])
207
+ unless validator.valid?(scope)
208
+ fail ArgumentError, "invalid value for \"scope\", must be one of #{validator.allowable_values}."
209
+ end
210
+ @scope = scope
211
+ end
212
+
213
+ # Checks equality by comparing each attribute.
214
+ # @param [Object] Object to be compared
215
+ def ==(o)
216
+ return true if self.equal?(o)
217
+ self.class == o.class &&
218
+ action == o.action &&
219
+ created_at == o.created_at &&
220
+ handler == o.handler &&
221
+ id == o.id &&
222
+ inbox_id == o.inbox_id &&
223
+ scope == o.scope &&
224
+ target == o.target
225
+ end
226
+
227
+ # @see the `==` method
228
+ # @param [Object] Object to be compared
229
+ def eql?(o)
230
+ self == o
231
+ end
232
+
233
+ # Calculates hash code according to all attributes.
234
+ # @return [Integer] Hash code
235
+ def hash
236
+ [action, created_at, handler, id, inbox_id, scope, target].hash
237
+ end
238
+
239
+ # Builds the object from hash
240
+ # @param [Hash] attributes Model attributes in the form of hash
241
+ # @return [Object] Returns the model itself
242
+ def self.build_from_hash(attributes)
243
+ new.build_from_hash(attributes)
244
+ end
245
+
246
+ # Builds the object from hash
247
+ # @param [Hash] attributes Model attributes in the form of hash
248
+ # @return [Object] Returns the model itself
249
+ def build_from_hash(attributes)
250
+ return nil unless attributes.is_a?(Hash)
251
+ self.class.openapi_types.each_pair do |key, type|
252
+ if type =~ /\AArray<(.*)>/i
253
+ # check to ensure the input is an array given that the attribute
254
+ # is documented as an array but the input is not
255
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
256
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
257
+ end
258
+ elsif !attributes[self.class.attribute_map[key]].nil?
259
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
260
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
261
+ end
262
+
263
+ self
264
+ end
265
+
266
+ # Deserializes the data based on type
267
+ # @param string type Data type
268
+ # @param string value Value to be deserialized
269
+ # @return [Object] Deserialized data
270
+ def _deserialize(type, value)
271
+ case type.to_sym
272
+ when :DateTime
273
+ DateTime.parse(value)
274
+ when :Date
275
+ Date.parse(value)
276
+ when :String
277
+ value.to_s
278
+ when :Integer
279
+ value.to_i
280
+ when :Float
281
+ value.to_f
282
+ when :Boolean
283
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
284
+ true
285
+ else
286
+ false
287
+ end
288
+ when :Object
289
+ # generic object (usually a Hash), return directly
290
+ value
291
+ when /\AArray<(?<inner_type>.+)>\z/
292
+ inner_type = Regexp.last_match[:inner_type]
293
+ value.map { |v| _deserialize(inner_type, v) }
294
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
295
+ k_type = Regexp.last_match[:k_type]
296
+ v_type = Regexp.last_match[:v_type]
297
+ {}.tap do |hash|
298
+ value.each do |k, v|
299
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
300
+ end
301
+ end
302
+ else # model
303
+ MailSlurpClient.const_get(type).build_from_hash(value)
304
+ end
305
+ end
306
+
307
+ # Returns the string representation of the object
308
+ # @return [String] String presentation of the object
309
+ def to_s
310
+ to_hash.to_s
311
+ end
312
+
313
+ # to_body is an alias to to_hash (backward compatibility)
314
+ # @return [Hash] Returns the object in the form of hash
315
+ def to_body
316
+ to_hash
317
+ end
318
+
319
+ # Returns the object in the form of hash
320
+ # @return [Hash] Returns the object in the form of hash
321
+ def to_hash
322
+ hash = {}
323
+ self.class.attribute_map.each_pair do |attr, param|
324
+ value = self.send(attr)
325
+ if value.nil?
326
+ is_nullable = self.class.openapi_nullable.include?(attr)
327
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
328
+ end
329
+
330
+ hash[param] = _to_hash(value)
331
+ end
332
+ hash
333
+ end
334
+
335
+ # Outputs non-array value in the form of hash
336
+ # For object, use to_hash. Otherwise, just return the value
337
+ # @param [Object] value Any valid value
338
+ # @return [Hash] Returns the value in the form of hash
339
+ def _to_hash(value)
340
+ if value.is_a?(Array)
341
+ value.compact.map { |v| _to_hash(v) }
342
+ elsif value.is_a?(Hash)
343
+ {}.tap do |hash|
344
+ value.each { |k, v| hash[k] = _to_hash(v) }
345
+ end
346
+ elsif value.respond_to? :to_hash
347
+ value.to_hash
348
+ else
349
+ value
350
+ end
351
+ end
352
+ end
353
+ end
@@ -0,0 +1,211 @@
1
+ =begin
2
+ #MailSlurp API
3
+
4
+ #MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://www.mailslurp.com/docs/) - [Examples](https://github.com/mailslurp/examples) repository
5
+
6
+ The version of the OpenAPI document: 6.5.2
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module MailSlurpClient
16
+ class InboxRulesetTestOptions
17
+ attr_accessor :test_target
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'test_target' => :'testTarget'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'test_target' => :'String'
30
+ }
31
+ end
32
+
33
+ # List of attributes with nullable: true
34
+ def self.openapi_nullable
35
+ Set.new([
36
+ ])
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ if (!attributes.is_a?(Hash))
43
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::InboxRulesetTestOptions` initialize method"
44
+ end
45
+
46
+ # check to see if the attribute exists and convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}) { |(k, v), h|
48
+ if (!self.class.attribute_map.key?(k.to_sym))
49
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::InboxRulesetTestOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
+ end
51
+ h[k.to_sym] = v
52
+ }
53
+
54
+ if attributes.key?(:'test_target')
55
+ self.test_target = attributes[:'test_target']
56
+ end
57
+ end
58
+
59
+ # Show invalid properties with the reasons. Usually used together with valid?
60
+ # @return Array for valid properties with the reasons
61
+ def list_invalid_properties
62
+ invalid_properties = Array.new
63
+ if @test_target.nil?
64
+ invalid_properties.push('invalid value for "test_target", test_target cannot be nil.')
65
+ end
66
+
67
+ invalid_properties
68
+ end
69
+
70
+ # Check to see if the all the properties in the model are valid
71
+ # @return true if the model is valid
72
+ def valid?
73
+ return false if @test_target.nil?
74
+ true
75
+ end
76
+
77
+ # Checks equality by comparing each attribute.
78
+ # @param [Object] Object to be compared
79
+ def ==(o)
80
+ return true if self.equal?(o)
81
+ self.class == o.class &&
82
+ test_target == o.test_target
83
+ end
84
+
85
+ # @see the `==` method
86
+ # @param [Object] Object to be compared
87
+ def eql?(o)
88
+ self == o
89
+ end
90
+
91
+ # Calculates hash code according to all attributes.
92
+ # @return [Integer] Hash code
93
+ def hash
94
+ [test_target].hash
95
+ end
96
+
97
+ # Builds the object from hash
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ # @return [Object] Returns the model itself
100
+ def self.build_from_hash(attributes)
101
+ new.build_from_hash(attributes)
102
+ end
103
+
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def build_from_hash(attributes)
108
+ return nil unless attributes.is_a?(Hash)
109
+ self.class.openapi_types.each_pair do |key, type|
110
+ if type =~ /\AArray<(.*)>/i
111
+ # check to ensure the input is an array given that the attribute
112
+ # is documented as an array but the input is not
113
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
114
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
115
+ end
116
+ elsif !attributes[self.class.attribute_map[key]].nil?
117
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
118
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
119
+ end
120
+
121
+ self
122
+ end
123
+
124
+ # Deserializes the data based on type
125
+ # @param string type Data type
126
+ # @param string value Value to be deserialized
127
+ # @return [Object] Deserialized data
128
+ def _deserialize(type, value)
129
+ case type.to_sym
130
+ when :DateTime
131
+ DateTime.parse(value)
132
+ when :Date
133
+ Date.parse(value)
134
+ when :String
135
+ value.to_s
136
+ when :Integer
137
+ value.to_i
138
+ when :Float
139
+ value.to_f
140
+ when :Boolean
141
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
142
+ true
143
+ else
144
+ false
145
+ end
146
+ when :Object
147
+ # generic object (usually a Hash), return directly
148
+ value
149
+ when /\AArray<(?<inner_type>.+)>\z/
150
+ inner_type = Regexp.last_match[:inner_type]
151
+ value.map { |v| _deserialize(inner_type, v) }
152
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
153
+ k_type = Regexp.last_match[:k_type]
154
+ v_type = Regexp.last_match[:v_type]
155
+ {}.tap do |hash|
156
+ value.each do |k, v|
157
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
158
+ end
159
+ end
160
+ else # model
161
+ MailSlurpClient.const_get(type).build_from_hash(value)
162
+ end
163
+ end
164
+
165
+ # Returns the string representation of the object
166
+ # @return [String] String presentation of the object
167
+ def to_s
168
+ to_hash.to_s
169
+ end
170
+
171
+ # to_body is an alias to to_hash (backward compatibility)
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_body
174
+ to_hash
175
+ end
176
+
177
+ # Returns the object in the form of hash
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_hash
180
+ hash = {}
181
+ self.class.attribute_map.each_pair do |attr, param|
182
+ value = self.send(attr)
183
+ if value.nil?
184
+ is_nullable = self.class.openapi_nullable.include?(attr)
185
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
186
+ end
187
+
188
+ hash[param] = _to_hash(value)
189
+ end
190
+ hash
191
+ end
192
+
193
+ # Outputs non-array value in the form of hash
194
+ # For object, use to_hash. Otherwise, just return the value
195
+ # @param [Object] value Any valid value
196
+ # @return [Hash] Returns the value in the form of hash
197
+ def _to_hash(value)
198
+ if value.is_a?(Array)
199
+ value.compact.map { |v| _to_hash(v) }
200
+ elsif value.is_a?(Hash)
201
+ {}.tap do |hash|
202
+ value.each { |k, v| hash[k] = _to_hash(v) }
203
+ end
204
+ elsif value.respond_to? :to_hash
205
+ value.to_hash
206
+ else
207
+ value
208
+ end
209
+ end
210
+ end
211
+ end