mailslurp_client 12.8.0 → 12.8.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,289 @@
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 AttachmentEntity
17
+ attr_accessor :attachment_id
18
+
19
+ attr_accessor :content_length
20
+
21
+ attr_accessor :content_type
22
+
23
+ attr_accessor :created_at
24
+
25
+ attr_accessor :id
26
+
27
+ attr_accessor :name
28
+
29
+ attr_accessor :updated_at
30
+
31
+ attr_accessor :user_id
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'attachment_id' => :'attachmentId',
37
+ :'content_length' => :'contentLength',
38
+ :'content_type' => :'contentType',
39
+ :'created_at' => :'createdAt',
40
+ :'id' => :'id',
41
+ :'name' => :'name',
42
+ :'updated_at' => :'updatedAt',
43
+ :'user_id' => :'userId'
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'attachment_id' => :'String',
51
+ :'content_length' => :'Integer',
52
+ :'content_type' => :'String',
53
+ :'created_at' => :'DateTime',
54
+ :'id' => :'String',
55
+ :'name' => :'String',
56
+ :'updated_at' => :'DateTime',
57
+ :'user_id' => :'String'
58
+ }
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new([
64
+ ])
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::AttachmentEntity` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!self.class.attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::AttachmentEntity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'attachment_id')
83
+ self.attachment_id = attributes[:'attachment_id']
84
+ end
85
+
86
+ if attributes.key?(:'content_length')
87
+ self.content_length = attributes[:'content_length']
88
+ end
89
+
90
+ if attributes.key?(:'content_type')
91
+ self.content_type = attributes[:'content_type']
92
+ end
93
+
94
+ if attributes.key?(:'created_at')
95
+ self.created_at = attributes[:'created_at']
96
+ end
97
+
98
+ if attributes.key?(:'id')
99
+ self.id = attributes[:'id']
100
+ end
101
+
102
+ if attributes.key?(:'name')
103
+ self.name = attributes[:'name']
104
+ end
105
+
106
+ if attributes.key?(:'updated_at')
107
+ self.updated_at = attributes[:'updated_at']
108
+ end
109
+
110
+ if attributes.key?(:'user_id')
111
+ self.user_id = attributes[:'user_id']
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ invalid_properties = Array.new
119
+ if @attachment_id.nil?
120
+ invalid_properties.push('invalid value for "attachment_id", attachment_id cannot be nil.')
121
+ end
122
+
123
+ if @created_at.nil?
124
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
125
+ end
126
+
127
+ if @updated_at.nil?
128
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
129
+ end
130
+
131
+ if @user_id.nil?
132
+ invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
133
+ end
134
+
135
+ invalid_properties
136
+ end
137
+
138
+ # Check to see if the all the properties in the model are valid
139
+ # @return true if the model is valid
140
+ def valid?
141
+ return false if @attachment_id.nil?
142
+ return false if @created_at.nil?
143
+ return false if @updated_at.nil?
144
+ return false if @user_id.nil?
145
+ true
146
+ end
147
+
148
+ # Checks equality by comparing each attribute.
149
+ # @param [Object] Object to be compared
150
+ def ==(o)
151
+ return true if self.equal?(o)
152
+ self.class == o.class &&
153
+ attachment_id == o.attachment_id &&
154
+ content_length == o.content_length &&
155
+ content_type == o.content_type &&
156
+ created_at == o.created_at &&
157
+ id == o.id &&
158
+ name == o.name &&
159
+ updated_at == o.updated_at &&
160
+ user_id == o.user_id
161
+ end
162
+
163
+ # @see the `==` method
164
+ # @param [Object] Object to be compared
165
+ def eql?(o)
166
+ self == o
167
+ end
168
+
169
+ # Calculates hash code according to all attributes.
170
+ # @return [Integer] Hash code
171
+ def hash
172
+ [attachment_id, content_length, content_type, created_at, id, name, updated_at, user_id].hash
173
+ end
174
+
175
+ # Builds the object from hash
176
+ # @param [Hash] attributes Model attributes in the form of hash
177
+ # @return [Object] Returns the model itself
178
+ def self.build_from_hash(attributes)
179
+ new.build_from_hash(attributes)
180
+ end
181
+
182
+ # Builds the object from hash
183
+ # @param [Hash] attributes Model attributes in the form of hash
184
+ # @return [Object] Returns the model itself
185
+ def build_from_hash(attributes)
186
+ return nil unless attributes.is_a?(Hash)
187
+ self.class.openapi_types.each_pair do |key, type|
188
+ if type =~ /\AArray<(.*)>/i
189
+ # check to ensure the input is an array given that the attribute
190
+ # is documented as an array but the input is not
191
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
192
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
193
+ end
194
+ elsif !attributes[self.class.attribute_map[key]].nil?
195
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
196
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
197
+ end
198
+
199
+ self
200
+ end
201
+
202
+ # Deserializes the data based on type
203
+ # @param string type Data type
204
+ # @param string value Value to be deserialized
205
+ # @return [Object] Deserialized data
206
+ def _deserialize(type, value)
207
+ case type.to_sym
208
+ when :DateTime
209
+ DateTime.parse(value)
210
+ when :Date
211
+ Date.parse(value)
212
+ when :String
213
+ value.to_s
214
+ when :Integer
215
+ value.to_i
216
+ when :Float
217
+ value.to_f
218
+ when :Boolean
219
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
220
+ true
221
+ else
222
+ false
223
+ end
224
+ when :Object
225
+ # generic object (usually a Hash), return directly
226
+ value
227
+ when /\AArray<(?<inner_type>.+)>\z/
228
+ inner_type = Regexp.last_match[:inner_type]
229
+ value.map { |v| _deserialize(inner_type, v) }
230
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
231
+ k_type = Regexp.last_match[:k_type]
232
+ v_type = Regexp.last_match[:v_type]
233
+ {}.tap do |hash|
234
+ value.each do |k, v|
235
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
236
+ end
237
+ end
238
+ else # model
239
+ MailSlurpClient.const_get(type).build_from_hash(value)
240
+ end
241
+ end
242
+
243
+ # Returns the string representation of the object
244
+ # @return [String] String presentation of the object
245
+ def to_s
246
+ to_hash.to_s
247
+ end
248
+
249
+ # to_body is an alias to to_hash (backward compatibility)
250
+ # @return [Hash] Returns the object in the form of hash
251
+ def to_body
252
+ to_hash
253
+ end
254
+
255
+ # Returns the object in the form of hash
256
+ # @return [Hash] Returns the object in the form of hash
257
+ def to_hash
258
+ hash = {}
259
+ self.class.attribute_map.each_pair do |attr, param|
260
+ value = self.send(attr)
261
+ if value.nil?
262
+ is_nullable = self.class.openapi_nullable.include?(attr)
263
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
264
+ end
265
+
266
+ hash[param] = _to_hash(value)
267
+ end
268
+ hash
269
+ end
270
+
271
+ # Outputs non-array value in the form of hash
272
+ # For object, use to_hash. Otherwise, just return the value
273
+ # @param [Object] value Any valid value
274
+ # @return [Hash] Returns the value in the form of hash
275
+ def _to_hash(value)
276
+ if value.is_a?(Array)
277
+ value.compact.map { |v| _to_hash(v) }
278
+ elsif value.is_a?(Hash)
279
+ {}.tap do |hash|
280
+ value.each { |k, v| hash[k] = _to_hash(v) }
281
+ end
282
+ elsif value.respond_to? :to_hash
283
+ value.to_hash
284
+ else
285
+ value
286
+ end
287
+ end
288
+ end
289
+ end
@@ -13,7 +13,8 @@ OpenAPI Generator version: 4.3.1
13
13
  require 'date'
14
14
 
15
15
  module MailSlurpClient
16
- class Bounce
16
+ # Bounced email
17
+ class BouncedEmailDto
17
18
  attr_accessor :bounce_mta
18
19
 
19
20
  attr_accessor :bounce_recipients
@@ -32,8 +33,6 @@ module MailSlurpClient
32
33
 
33
34
  attr_accessor :sent_to_recipients
34
35
 
35
- attr_accessor :updated_at
36
-
37
36
  attr_accessor :user_id
38
37
 
39
38
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -48,7 +47,6 @@ module MailSlurpClient
48
47
  :'notification_type' => :'notificationType',
49
48
  :'sender' => :'sender',
50
49
  :'sent_to_recipients' => :'sentToRecipients',
51
- :'updated_at' => :'updatedAt',
52
50
  :'user_id' => :'userId'
53
51
  }
54
52
  end
@@ -65,7 +63,6 @@ module MailSlurpClient
65
63
  :'notification_type' => :'String',
66
64
  :'sender' => :'String',
67
65
  :'sent_to_recipients' => :'Array<String>',
68
- :'updated_at' => :'DateTime',
69
66
  :'user_id' => :'String'
70
67
  }
71
68
  end
@@ -80,13 +77,13 @@ module MailSlurpClient
80
77
  # @param [Hash] attributes Model attributes in the form of hash
81
78
  def initialize(attributes = {})
82
79
  if (!attributes.is_a?(Hash))
83
- fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::Bounce` initialize method"
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::BouncedEmailDto` initialize method"
84
81
  end
85
82
 
86
83
  # check to see if the attribute exists and convert string to symbol for hash key
87
84
  attributes = attributes.each_with_object({}) { |(k, v), h|
88
85
  if (!self.class.attribute_map.key?(k.to_sym))
89
- fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::Bounce`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
86
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::BouncedEmailDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
87
  end
91
88
  h[k.to_sym] = v
92
89
  }
@@ -131,10 +128,6 @@ module MailSlurpClient
131
128
  end
132
129
  end
133
130
 
134
- if attributes.key?(:'updated_at')
135
- self.updated_at = attributes[:'updated_at']
136
- end
137
-
138
131
  if attributes.key?(:'user_id')
139
132
  self.user_id = attributes[:'user_id']
140
133
  end
@@ -156,10 +149,6 @@ module MailSlurpClient
156
149
  invalid_properties.push('invalid value for "sender", sender cannot be nil.')
157
150
  end
158
151
 
159
- if @updated_at.nil?
160
- invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
161
- end
162
-
163
152
  if @user_id.nil?
164
153
  invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
165
154
  end
@@ -173,7 +162,6 @@ module MailSlurpClient
173
162
  return false if @created_at.nil?
174
163
  return false if @notification_type.nil?
175
164
  return false if @sender.nil?
176
- return false if @updated_at.nil?
177
165
  return false if @user_id.nil?
178
166
  true
179
167
  end
@@ -192,7 +180,6 @@ module MailSlurpClient
192
180
  notification_type == o.notification_type &&
193
181
  sender == o.sender &&
194
182
  sent_to_recipients == o.sent_to_recipients &&
195
- updated_at == o.updated_at &&
196
183
  user_id == o.user_id
197
184
  end
198
185
 
@@ -205,7 +192,7 @@ module MailSlurpClient
205
192
  # Calculates hash code according to all attributes.
206
193
  # @return [Integer] Hash code
207
194
  def hash
208
- [bounce_mta, bounce_recipients, bounce_sub_type, bounce_type, created_at, id, notification_type, sender, sent_to_recipients, updated_at, user_id].hash
195
+ [bounce_mta, bounce_recipients, bounce_sub_type, bounce_type, created_at, id, notification_type, sender, sent_to_recipients, user_id].hash
209
196
  end
210
197
 
211
198
  # Builds the object from hash
@@ -0,0 +1,249 @@
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
+ # Bounced recipient
17
+ class BouncedRecipientDto
18
+ attr_accessor :created_at
19
+
20
+ attr_accessor :id
21
+
22
+ attr_accessor :recipient
23
+
24
+ attr_accessor :user_id
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'created_at' => :'createdAt',
30
+ :'id' => :'id',
31
+ :'recipient' => :'recipient',
32
+ :'user_id' => :'userId'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'created_at' => :'DateTime',
40
+ :'id' => :'String',
41
+ :'recipient' => :'String',
42
+ :'user_id' => :'String'
43
+ }
44
+ end
45
+
46
+ # List of attributes with nullable: true
47
+ def self.openapi_nullable
48
+ Set.new([
49
+ ])
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ if (!attributes.is_a?(Hash))
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::BouncedRecipientDto` initialize method"
57
+ end
58
+
59
+ # check to see if the attribute exists and convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!self.class.attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::BouncedRecipientDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'created_at')
68
+ self.created_at = attributes[:'created_at']
69
+ end
70
+
71
+ if attributes.key?(:'id')
72
+ self.id = attributes[:'id']
73
+ end
74
+
75
+ if attributes.key?(:'recipient')
76
+ self.recipient = attributes[:'recipient']
77
+ end
78
+
79
+ if attributes.key?(:'user_id')
80
+ self.user_id = attributes[:'user_id']
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ if @created_at.nil?
89
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
90
+ end
91
+
92
+ if @recipient.nil?
93
+ invalid_properties.push('invalid value for "recipient", recipient cannot be nil.')
94
+ end
95
+
96
+ if @user_id.nil?
97
+ invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
98
+ end
99
+
100
+ invalid_properties
101
+ end
102
+
103
+ # Check to see if the all the properties in the model are valid
104
+ # @return true if the model is valid
105
+ def valid?
106
+ return false if @created_at.nil?
107
+ return false if @recipient.nil?
108
+ return false if @user_id.nil?
109
+ true
110
+ end
111
+
112
+ # Checks equality by comparing each attribute.
113
+ # @param [Object] Object to be compared
114
+ def ==(o)
115
+ return true if self.equal?(o)
116
+ self.class == o.class &&
117
+ created_at == o.created_at &&
118
+ id == o.id &&
119
+ recipient == o.recipient &&
120
+ user_id == o.user_id
121
+ end
122
+
123
+ # @see the `==` method
124
+ # @param [Object] Object to be compared
125
+ def eql?(o)
126
+ self == o
127
+ end
128
+
129
+ # Calculates hash code according to all attributes.
130
+ # @return [Integer] Hash code
131
+ def hash
132
+ [created_at, id, recipient, user_id].hash
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def self.build_from_hash(attributes)
139
+ new.build_from_hash(attributes)
140
+ end
141
+
142
+ # Builds the object from hash
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ # @return [Object] Returns the model itself
145
+ def build_from_hash(attributes)
146
+ return nil unless attributes.is_a?(Hash)
147
+ self.class.openapi_types.each_pair do |key, type|
148
+ if type =~ /\AArray<(.*)>/i
149
+ # check to ensure the input is an array given that the attribute
150
+ # is documented as an array but the input is not
151
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
152
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
153
+ end
154
+ elsif !attributes[self.class.attribute_map[key]].nil?
155
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
156
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
157
+ end
158
+
159
+ self
160
+ end
161
+
162
+ # Deserializes the data based on type
163
+ # @param string type Data type
164
+ # @param string value Value to be deserialized
165
+ # @return [Object] Deserialized data
166
+ def _deserialize(type, value)
167
+ case type.to_sym
168
+ when :DateTime
169
+ DateTime.parse(value)
170
+ when :Date
171
+ Date.parse(value)
172
+ when :String
173
+ value.to_s
174
+ when :Integer
175
+ value.to_i
176
+ when :Float
177
+ value.to_f
178
+ when :Boolean
179
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
180
+ true
181
+ else
182
+ false
183
+ end
184
+ when :Object
185
+ # generic object (usually a Hash), return directly
186
+ value
187
+ when /\AArray<(?<inner_type>.+)>\z/
188
+ inner_type = Regexp.last_match[:inner_type]
189
+ value.map { |v| _deserialize(inner_type, v) }
190
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
191
+ k_type = Regexp.last_match[:k_type]
192
+ v_type = Regexp.last_match[:v_type]
193
+ {}.tap do |hash|
194
+ value.each do |k, v|
195
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
196
+ end
197
+ end
198
+ else # model
199
+ MailSlurpClient.const_get(type).build_from_hash(value)
200
+ end
201
+ end
202
+
203
+ # Returns the string representation of the object
204
+ # @return [String] String presentation of the object
205
+ def to_s
206
+ to_hash.to_s
207
+ end
208
+
209
+ # to_body is an alias to to_hash (backward compatibility)
210
+ # @return [Hash] Returns the object in the form of hash
211
+ def to_body
212
+ to_hash
213
+ end
214
+
215
+ # Returns the object in the form of hash
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_hash
218
+ hash = {}
219
+ self.class.attribute_map.each_pair do |attr, param|
220
+ value = self.send(attr)
221
+ if value.nil?
222
+ is_nullable = self.class.openapi_nullable.include?(attr)
223
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
224
+ end
225
+
226
+ hash[param] = _to_hash(value)
227
+ end
228
+ hash
229
+ end
230
+
231
+ # Outputs non-array value in the form of hash
232
+ # For object, use to_hash. Otherwise, just return the value
233
+ # @param [Object] value Any valid value
234
+ # @return [Hash] Returns the value in the form of hash
235
+ def _to_hash(value)
236
+ if value.is_a?(Array)
237
+ value.compact.map { |v| _to_hash(v) }
238
+ elsif value.is_a?(Hash)
239
+ {}.tap do |hash|
240
+ value.each { |k, v| hash[k] = _to_hash(v) }
241
+ end
242
+ elsif value.respond_to? :to_hash
243
+ value.to_hash
244
+ else
245
+ value
246
+ end
247
+ end
248
+ end
249
+ end