mailslurp_client 12.1.23 → 12.1.28

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,7 +13,7 @@ OpenAPI Generator version: 4.3.1
13
13
  require 'date'
14
14
 
15
15
  module MailSlurpClient
16
- # Paginated webhook results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
16
+ # Paginated webhook entity. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
17
17
  class PageWebhookProjection
18
18
  attr_accessor :content
19
19
 
@@ -0,0 +1,299 @@
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
+ # Paginated webhook results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
17
+ class PageWebhookResult
18
+ attr_accessor :content
19
+
20
+ attr_accessor :empty
21
+
22
+ attr_accessor :first
23
+
24
+ attr_accessor :last
25
+
26
+ attr_accessor :number
27
+
28
+ attr_accessor :number_of_elements
29
+
30
+ attr_accessor :pageable
31
+
32
+ attr_accessor :size
33
+
34
+ attr_accessor :sort
35
+
36
+ attr_accessor :total_elements
37
+
38
+ attr_accessor :total_pages
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'content' => :'content',
44
+ :'empty' => :'empty',
45
+ :'first' => :'first',
46
+ :'last' => :'last',
47
+ :'number' => :'number',
48
+ :'number_of_elements' => :'numberOfElements',
49
+ :'pageable' => :'pageable',
50
+ :'size' => :'size',
51
+ :'sort' => :'sort',
52
+ :'total_elements' => :'totalElements',
53
+ :'total_pages' => :'totalPages'
54
+ }
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.openapi_types
59
+ {
60
+ :'content' => :'Array<WebhookResultEntity>',
61
+ :'empty' => :'Boolean',
62
+ :'first' => :'Boolean',
63
+ :'last' => :'Boolean',
64
+ :'number' => :'Integer',
65
+ :'number_of_elements' => :'Integer',
66
+ :'pageable' => :'Pageable',
67
+ :'size' => :'Integer',
68
+ :'sort' => :'Sort',
69
+ :'total_elements' => :'Integer',
70
+ :'total_pages' => :'Integer'
71
+ }
72
+ end
73
+
74
+ # List of attributes with nullable: true
75
+ def self.openapi_nullable
76
+ Set.new([
77
+ ])
78
+ end
79
+
80
+ # Initializes the object
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ def initialize(attributes = {})
83
+ if (!attributes.is_a?(Hash))
84
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::PageWebhookResult` initialize method"
85
+ end
86
+
87
+ # check to see if the attribute exists and convert string to symbol for hash key
88
+ attributes = attributes.each_with_object({}) { |(k, v), h|
89
+ if (!self.class.attribute_map.key?(k.to_sym))
90
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::PageWebhookResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
91
+ end
92
+ h[k.to_sym] = v
93
+ }
94
+
95
+ if attributes.key?(:'content')
96
+ if (value = attributes[:'content']).is_a?(Array)
97
+ self.content = value
98
+ end
99
+ end
100
+
101
+ if attributes.key?(:'empty')
102
+ self.empty = attributes[:'empty']
103
+ end
104
+
105
+ if attributes.key?(:'first')
106
+ self.first = attributes[:'first']
107
+ end
108
+
109
+ if attributes.key?(:'last')
110
+ self.last = attributes[:'last']
111
+ end
112
+
113
+ if attributes.key?(:'number')
114
+ self.number = attributes[:'number']
115
+ end
116
+
117
+ if attributes.key?(:'number_of_elements')
118
+ self.number_of_elements = attributes[:'number_of_elements']
119
+ end
120
+
121
+ if attributes.key?(:'pageable')
122
+ self.pageable = attributes[:'pageable']
123
+ end
124
+
125
+ if attributes.key?(:'size')
126
+ self.size = attributes[:'size']
127
+ end
128
+
129
+ if attributes.key?(:'sort')
130
+ self.sort = attributes[:'sort']
131
+ end
132
+
133
+ if attributes.key?(:'total_elements')
134
+ self.total_elements = attributes[:'total_elements']
135
+ end
136
+
137
+ if attributes.key?(:'total_pages')
138
+ self.total_pages = attributes[:'total_pages']
139
+ end
140
+ end
141
+
142
+ # Show invalid properties with the reasons. Usually used together with valid?
143
+ # @return Array for valid properties with the reasons
144
+ def list_invalid_properties
145
+ invalid_properties = Array.new
146
+ invalid_properties
147
+ end
148
+
149
+ # Check to see if the all the properties in the model are valid
150
+ # @return true if the model is valid
151
+ def valid?
152
+ true
153
+ end
154
+
155
+ # Checks equality by comparing each attribute.
156
+ # @param [Object] Object to be compared
157
+ def ==(o)
158
+ return true if self.equal?(o)
159
+ self.class == o.class &&
160
+ content == o.content &&
161
+ empty == o.empty &&
162
+ first == o.first &&
163
+ last == o.last &&
164
+ number == o.number &&
165
+ number_of_elements == o.number_of_elements &&
166
+ pageable == o.pageable &&
167
+ size == o.size &&
168
+ sort == o.sort &&
169
+ total_elements == o.total_elements &&
170
+ total_pages == o.total_pages
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
+ [content, empty, first, last, number, number_of_elements, pageable, size, sort, total_elements, total_pages].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
+ new.build_from_hash(attributes)
190
+ end
191
+
192
+ # Builds the object from hash
193
+ # @param [Hash] attributes Model attributes in the form of hash
194
+ # @return [Object] Returns the model itself
195
+ def build_from_hash(attributes)
196
+ return nil unless attributes.is_a?(Hash)
197
+ self.class.openapi_types.each_pair do |key, type|
198
+ if type =~ /\AArray<(.*)>/i
199
+ # check to ensure the input is an array given that the attribute
200
+ # is documented as an array but the input is not
201
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
202
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
203
+ end
204
+ elsif !attributes[self.class.attribute_map[key]].nil?
205
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
206
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
207
+ end
208
+
209
+ self
210
+ end
211
+
212
+ # Deserializes the data based on type
213
+ # @param string type Data type
214
+ # @param string value Value to be deserialized
215
+ # @return [Object] Deserialized data
216
+ def _deserialize(type, value)
217
+ case type.to_sym
218
+ when :DateTime
219
+ DateTime.parse(value)
220
+ when :Date
221
+ Date.parse(value)
222
+ when :String
223
+ value.to_s
224
+ when :Integer
225
+ value.to_i
226
+ when :Float
227
+ value.to_f
228
+ when :Boolean
229
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
230
+ true
231
+ else
232
+ false
233
+ end
234
+ when :Object
235
+ # generic object (usually a Hash), return directly
236
+ value
237
+ when /\AArray<(?<inner_type>.+)>\z/
238
+ inner_type = Regexp.last_match[:inner_type]
239
+ value.map { |v| _deserialize(inner_type, v) }
240
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
241
+ k_type = Regexp.last_match[:k_type]
242
+ v_type = Regexp.last_match[:v_type]
243
+ {}.tap do |hash|
244
+ value.each do |k, v|
245
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
246
+ end
247
+ end
248
+ else # model
249
+ MailSlurpClient.const_get(type).build_from_hash(value)
250
+ end
251
+ end
252
+
253
+ # Returns the string representation of the object
254
+ # @return [String] String presentation of the object
255
+ def to_s
256
+ to_hash.to_s
257
+ end
258
+
259
+ # to_body is an alias to to_hash (backward compatibility)
260
+ # @return [Hash] Returns the object in the form of hash
261
+ def to_body
262
+ to_hash
263
+ end
264
+
265
+ # Returns the object in the form of hash
266
+ # @return [Hash] Returns the object in the form of hash
267
+ def to_hash
268
+ hash = {}
269
+ self.class.attribute_map.each_pair do |attr, param|
270
+ value = self.send(attr)
271
+ if value.nil?
272
+ is_nullable = self.class.openapi_nullable.include?(attr)
273
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
274
+ end
275
+
276
+ hash[param] = _to_hash(value)
277
+ end
278
+ hash
279
+ end
280
+
281
+ # Outputs non-array value in the form of hash
282
+ # For object, use to_hash. Otherwise, just return the value
283
+ # @param [Object] value Any valid value
284
+ # @return [Hash] Returns the value in the form of hash
285
+ def _to_hash(value)
286
+ if value.is_a?(Array)
287
+ value.compact.map { |v| _to_hash(v) }
288
+ elsif value.is_a?(Hash)
289
+ {}.tap do |hash|
290
+ value.each { |k, v| hash[k] = _to_hash(v) }
291
+ end
292
+ elsif value.respond_to? :to_hash
293
+ value.to_hash
294
+ else
295
+ value
296
+ end
297
+ end
298
+ end
299
+ end
@@ -43,6 +43,9 @@ module MailSlurpClient
43
43
  # URL of your server that the webhook will be sent to. The schema of the JSON that is sent is described by the payloadJsonSchema.
44
44
  attr_accessor :url
45
45
 
46
+ # User ID of the Webhook
47
+ attr_accessor :user_id
48
+
46
49
  class EnumAttributeValidator
47
50
  attr_reader :datatype
48
51
  attr_reader :allowable_values
@@ -77,7 +80,8 @@ module MailSlurpClient
77
80
  :'name' => :'name',
78
81
  :'payload_json_schema' => :'payloadJsonSchema',
79
82
  :'updated_at' => :'updatedAt',
80
- :'url' => :'url'
83
+ :'url' => :'url',
84
+ :'user_id' => :'userId'
81
85
  }
82
86
  end
83
87
 
@@ -93,7 +97,8 @@ module MailSlurpClient
93
97
  :'name' => :'String',
94
98
  :'payload_json_schema' => :'String',
95
99
  :'updated_at' => :'DateTime',
96
- :'url' => :'String'
100
+ :'url' => :'String',
101
+ :'user_id' => :'String'
97
102
  }
98
103
  end
99
104
 
@@ -157,6 +162,10 @@ module MailSlurpClient
157
162
  if attributes.key?(:'url')
158
163
  self.url = attributes[:'url']
159
164
  end
165
+
166
+ if attributes.key?(:'user_id')
167
+ self.user_id = attributes[:'user_id']
168
+ end
160
169
  end
161
170
 
162
171
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -215,7 +224,8 @@ module MailSlurpClient
215
224
  name == o.name &&
216
225
  payload_json_schema == o.payload_json_schema &&
217
226
  updated_at == o.updated_at &&
218
- url == o.url
227
+ url == o.url &&
228
+ user_id == o.user_id
219
229
  end
220
230
 
221
231
  # @see the `==` method
@@ -227,7 +237,7 @@ module MailSlurpClient
227
237
  # Calculates hash code according to all attributes.
228
238
  # @return [Integer] Hash code
229
239
  def hash
230
- [basic_auth, created_at, event_name, id, inbox_id, method, name, payload_json_schema, updated_at, url].hash
240
+ [basic_auth, created_at, event_name, id, inbox_id, method, name, payload_json_schema, updated_at, url, user_id].hash
231
241
  end
232
242
 
233
243
  # Builds the object from hash
@@ -0,0 +1,410 @@
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 WebhookResultEntity
17
+ attr_accessor :created_at
18
+
19
+ attr_accessor :http_method
20
+
21
+ attr_accessor :id
22
+
23
+ attr_accessor :inbox_id
24
+
25
+ attr_accessor :message_id
26
+
27
+ attr_accessor :response_body_extract
28
+
29
+ attr_accessor :response_status
30
+
31
+ attr_accessor :response_time_millis
32
+
33
+ attr_accessor :updated_at
34
+
35
+ attr_accessor :user_id
36
+
37
+ attr_accessor :webhook_event
38
+
39
+ attr_accessor :webhook_id
40
+
41
+ attr_accessor :webhook_url
42
+
43
+ class EnumAttributeValidator
44
+ attr_reader :datatype
45
+ attr_reader :allowable_values
46
+
47
+ def initialize(datatype, allowable_values)
48
+ @allowable_values = allowable_values.map do |value|
49
+ case datatype.to_s
50
+ when /Integer/i
51
+ value.to_i
52
+ when /Float/i
53
+ value.to_f
54
+ else
55
+ value
56
+ end
57
+ end
58
+ end
59
+
60
+ def valid?(value)
61
+ !value || allowable_values.include?(value)
62
+ end
63
+ end
64
+
65
+ # Attribute mapping from ruby-style variable name to JSON key.
66
+ def self.attribute_map
67
+ {
68
+ :'created_at' => :'createdAt',
69
+ :'http_method' => :'httpMethod',
70
+ :'id' => :'id',
71
+ :'inbox_id' => :'inboxId',
72
+ :'message_id' => :'messageId',
73
+ :'response_body_extract' => :'responseBodyExtract',
74
+ :'response_status' => :'responseStatus',
75
+ :'response_time_millis' => :'responseTimeMillis',
76
+ :'updated_at' => :'updatedAt',
77
+ :'user_id' => :'userId',
78
+ :'webhook_event' => :'webhookEvent',
79
+ :'webhook_id' => :'webhookId',
80
+ :'webhook_url' => :'webhookUrl'
81
+ }
82
+ end
83
+
84
+ # Attribute type mapping.
85
+ def self.openapi_types
86
+ {
87
+ :'created_at' => :'DateTime',
88
+ :'http_method' => :'String',
89
+ :'id' => :'String',
90
+ :'inbox_id' => :'String',
91
+ :'message_id' => :'String',
92
+ :'response_body_extract' => :'String',
93
+ :'response_status' => :'Integer',
94
+ :'response_time_millis' => :'Integer',
95
+ :'updated_at' => :'DateTime',
96
+ :'user_id' => :'String',
97
+ :'webhook_event' => :'String',
98
+ :'webhook_id' => :'String',
99
+ :'webhook_url' => :'String'
100
+ }
101
+ end
102
+
103
+ # List of attributes with nullable: true
104
+ def self.openapi_nullable
105
+ Set.new([
106
+ ])
107
+ end
108
+
109
+ # Initializes the object
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ def initialize(attributes = {})
112
+ if (!attributes.is_a?(Hash))
113
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::WebhookResultEntity` initialize method"
114
+ end
115
+
116
+ # check to see if the attribute exists and convert string to symbol for hash key
117
+ attributes = attributes.each_with_object({}) { |(k, v), h|
118
+ if (!self.class.attribute_map.key?(k.to_sym))
119
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::WebhookResultEntity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
120
+ end
121
+ h[k.to_sym] = v
122
+ }
123
+
124
+ if attributes.key?(:'created_at')
125
+ self.created_at = attributes[:'created_at']
126
+ end
127
+
128
+ if attributes.key?(:'http_method')
129
+ self.http_method = attributes[:'http_method']
130
+ end
131
+
132
+ if attributes.key?(:'id')
133
+ self.id = attributes[:'id']
134
+ end
135
+
136
+ if attributes.key?(:'inbox_id')
137
+ self.inbox_id = attributes[:'inbox_id']
138
+ end
139
+
140
+ if attributes.key?(:'message_id')
141
+ self.message_id = attributes[:'message_id']
142
+ end
143
+
144
+ if attributes.key?(:'response_body_extract')
145
+ self.response_body_extract = attributes[:'response_body_extract']
146
+ end
147
+
148
+ if attributes.key?(:'response_status')
149
+ self.response_status = attributes[:'response_status']
150
+ end
151
+
152
+ if attributes.key?(:'response_time_millis')
153
+ self.response_time_millis = attributes[:'response_time_millis']
154
+ end
155
+
156
+ if attributes.key?(:'updated_at')
157
+ self.updated_at = attributes[:'updated_at']
158
+ end
159
+
160
+ if attributes.key?(:'user_id')
161
+ self.user_id = attributes[:'user_id']
162
+ end
163
+
164
+ if attributes.key?(:'webhook_event')
165
+ self.webhook_event = attributes[:'webhook_event']
166
+ end
167
+
168
+ if attributes.key?(:'webhook_id')
169
+ self.webhook_id = attributes[:'webhook_id']
170
+ end
171
+
172
+ if attributes.key?(:'webhook_url')
173
+ self.webhook_url = attributes[:'webhook_url']
174
+ end
175
+ end
176
+
177
+ # Show invalid properties with the reasons. Usually used together with valid?
178
+ # @return Array for valid properties with the reasons
179
+ def list_invalid_properties
180
+ invalid_properties = Array.new
181
+ if @created_at.nil?
182
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
183
+ end
184
+
185
+ if @http_method.nil?
186
+ invalid_properties.push('invalid value for "http_method", http_method cannot be nil.')
187
+ end
188
+
189
+ if @inbox_id.nil?
190
+ invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
191
+ end
192
+
193
+ if @message_id.nil?
194
+ invalid_properties.push('invalid value for "message_id", message_id cannot be nil.')
195
+ end
196
+
197
+ if @response_time_millis.nil?
198
+ invalid_properties.push('invalid value for "response_time_millis", response_time_millis cannot be nil.')
199
+ end
200
+
201
+ if @updated_at.nil?
202
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
203
+ end
204
+
205
+ if @user_id.nil?
206
+ invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
207
+ end
208
+
209
+ if @webhook_event.nil?
210
+ invalid_properties.push('invalid value for "webhook_event", webhook_event cannot be nil.')
211
+ end
212
+
213
+ if @webhook_id.nil?
214
+ invalid_properties.push('invalid value for "webhook_id", webhook_id cannot be nil.')
215
+ end
216
+
217
+ if @webhook_url.nil?
218
+ invalid_properties.push('invalid value for "webhook_url", webhook_url cannot be nil.')
219
+ end
220
+
221
+ invalid_properties
222
+ end
223
+
224
+ # Check to see if the all the properties in the model are valid
225
+ # @return true if the model is valid
226
+ def valid?
227
+ return false if @created_at.nil?
228
+ return false if @http_method.nil?
229
+ http_method_validator = EnumAttributeValidator.new('String', ["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "TRACE"])
230
+ return false unless http_method_validator.valid?(@http_method)
231
+ return false if @inbox_id.nil?
232
+ return false if @message_id.nil?
233
+ return false if @response_time_millis.nil?
234
+ return false if @updated_at.nil?
235
+ return false if @user_id.nil?
236
+ return false if @webhook_event.nil?
237
+ webhook_event_validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT"])
238
+ return false unless webhook_event_validator.valid?(@webhook_event)
239
+ return false if @webhook_id.nil?
240
+ return false if @webhook_url.nil?
241
+ true
242
+ end
243
+
244
+ # Custom attribute writer method checking allowed values (enum).
245
+ # @param [Object] http_method Object to be assigned
246
+ def http_method=(http_method)
247
+ validator = EnumAttributeValidator.new('String', ["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "TRACE"])
248
+ unless validator.valid?(http_method)
249
+ fail ArgumentError, "invalid value for \"http_method\", must be one of #{validator.allowable_values}."
250
+ end
251
+ @http_method = http_method
252
+ end
253
+
254
+ # Custom attribute writer method checking allowed values (enum).
255
+ # @param [Object] webhook_event Object to be assigned
256
+ def webhook_event=(webhook_event)
257
+ validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT"])
258
+ unless validator.valid?(webhook_event)
259
+ fail ArgumentError, "invalid value for \"webhook_event\", must be one of #{validator.allowable_values}."
260
+ end
261
+ @webhook_event = webhook_event
262
+ end
263
+
264
+ # Checks equality by comparing each attribute.
265
+ # @param [Object] Object to be compared
266
+ def ==(o)
267
+ return true if self.equal?(o)
268
+ self.class == o.class &&
269
+ created_at == o.created_at &&
270
+ http_method == o.http_method &&
271
+ id == o.id &&
272
+ inbox_id == o.inbox_id &&
273
+ message_id == o.message_id &&
274
+ response_body_extract == o.response_body_extract &&
275
+ response_status == o.response_status &&
276
+ response_time_millis == o.response_time_millis &&
277
+ updated_at == o.updated_at &&
278
+ user_id == o.user_id &&
279
+ webhook_event == o.webhook_event &&
280
+ webhook_id == o.webhook_id &&
281
+ webhook_url == o.webhook_url
282
+ end
283
+
284
+ # @see the `==` method
285
+ # @param [Object] Object to be compared
286
+ def eql?(o)
287
+ self == o
288
+ end
289
+
290
+ # Calculates hash code according to all attributes.
291
+ # @return [Integer] Hash code
292
+ def hash
293
+ [created_at, http_method, id, inbox_id, message_id, response_body_extract, response_status, response_time_millis, updated_at, user_id, webhook_event, webhook_id, webhook_url].hash
294
+ end
295
+
296
+ # Builds the object from hash
297
+ # @param [Hash] attributes Model attributes in the form of hash
298
+ # @return [Object] Returns the model itself
299
+ def self.build_from_hash(attributes)
300
+ new.build_from_hash(attributes)
301
+ end
302
+
303
+ # Builds the object from hash
304
+ # @param [Hash] attributes Model attributes in the form of hash
305
+ # @return [Object] Returns the model itself
306
+ def build_from_hash(attributes)
307
+ return nil unless attributes.is_a?(Hash)
308
+ self.class.openapi_types.each_pair do |key, type|
309
+ if type =~ /\AArray<(.*)>/i
310
+ # check to ensure the input is an array given that the attribute
311
+ # is documented as an array but the input is not
312
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
313
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
314
+ end
315
+ elsif !attributes[self.class.attribute_map[key]].nil?
316
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
317
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
318
+ end
319
+
320
+ self
321
+ end
322
+
323
+ # Deserializes the data based on type
324
+ # @param string type Data type
325
+ # @param string value Value to be deserialized
326
+ # @return [Object] Deserialized data
327
+ def _deserialize(type, value)
328
+ case type.to_sym
329
+ when :DateTime
330
+ DateTime.parse(value)
331
+ when :Date
332
+ Date.parse(value)
333
+ when :String
334
+ value.to_s
335
+ when :Integer
336
+ value.to_i
337
+ when :Float
338
+ value.to_f
339
+ when :Boolean
340
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
341
+ true
342
+ else
343
+ false
344
+ end
345
+ when :Object
346
+ # generic object (usually a Hash), return directly
347
+ value
348
+ when /\AArray<(?<inner_type>.+)>\z/
349
+ inner_type = Regexp.last_match[:inner_type]
350
+ value.map { |v| _deserialize(inner_type, v) }
351
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
352
+ k_type = Regexp.last_match[:k_type]
353
+ v_type = Regexp.last_match[:v_type]
354
+ {}.tap do |hash|
355
+ value.each do |k, v|
356
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
357
+ end
358
+ end
359
+ else # model
360
+ MailSlurpClient.const_get(type).build_from_hash(value)
361
+ end
362
+ end
363
+
364
+ # Returns the string representation of the object
365
+ # @return [String] String presentation of the object
366
+ def to_s
367
+ to_hash.to_s
368
+ end
369
+
370
+ # to_body is an alias to to_hash (backward compatibility)
371
+ # @return [Hash] Returns the object in the form of hash
372
+ def to_body
373
+ to_hash
374
+ end
375
+
376
+ # Returns the object in the form of hash
377
+ # @return [Hash] Returns the object in the form of hash
378
+ def to_hash
379
+ hash = {}
380
+ self.class.attribute_map.each_pair do |attr, param|
381
+ value = self.send(attr)
382
+ if value.nil?
383
+ is_nullable = self.class.openapi_nullable.include?(attr)
384
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
385
+ end
386
+
387
+ hash[param] = _to_hash(value)
388
+ end
389
+ hash
390
+ end
391
+
392
+ # Outputs non-array value in the form of hash
393
+ # For object, use to_hash. Otherwise, just return the value
394
+ # @param [Object] value Any valid value
395
+ # @return [Hash] Returns the value in the form of hash
396
+ def _to_hash(value)
397
+ if value.is_a?(Array)
398
+ value.compact.map { |v| _to_hash(v) }
399
+ elsif value.is_a?(Hash)
400
+ {}.tap do |hash|
401
+ value.each { |k, v| hash[k] = _to_hash(v) }
402
+ end
403
+ elsif value.respond_to? :to_hash
404
+ value.to_hash
405
+ else
406
+ value
407
+ end
408
+ end
409
+ end
410
+ end