mailslurp_client 8.3.0 → 8.4.3

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