mailmock 1.1.1.pre.34026500447

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 (67) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +111 -0
  4. data/Rakefile +10 -0
  5. data/docs/EmailApi.md +202 -0
  6. data/docs/EmailCreate200Response.md +20 -0
  7. data/docs/EmailCreateRequest.md +20 -0
  8. data/docs/EmailList200ResponseInner.md +26 -0
  9. data/docs/EmailListDefaultResponse.md +22 -0
  10. data/docs/EmailListDefaultResponseIssuesInner.md +18 -0
  11. data/docs/EmailRead200Response.md +36 -0
  12. data/docs/EmailRead200ResponseHeadersInner.md +20 -0
  13. data/docs/EmailReadRequest.md +20 -0
  14. data/docs/SendApi.md +70 -0
  15. data/docs/SendAws200Response.md +24 -0
  16. data/docs/SendAwsRequest.md +24 -0
  17. data/docs/SendAwsRequestMail.md +30 -0
  18. data/docs/SendAwsRequestMailCommonHeaders.md +28 -0
  19. data/docs/SendAwsRequestReceipt.md +34 -0
  20. data/docs/SendAwsRequestReceiptAction.md +22 -0
  21. data/docs/SendAwsRequestReceiptSpamVerdict.md +18 -0
  22. data/git_push.sh +57 -0
  23. data/lib/mailmock/api/email_api.rb +222 -0
  24. data/lib/mailmock/api/send_api.rb +86 -0
  25. data/lib/mailmock/api_client.rb +397 -0
  26. data/lib/mailmock/api_error.rb +58 -0
  27. data/lib/mailmock/api_model_base.rb +88 -0
  28. data/lib/mailmock/configuration.rb +308 -0
  29. data/lib/mailmock/models/email_create200_response.rb +190 -0
  30. data/lib/mailmock/models/email_create_request.rb +190 -0
  31. data/lib/mailmock/models/email_list200_response_inner.rb +292 -0
  32. data/lib/mailmock/models/email_list_default_response.rb +201 -0
  33. data/lib/mailmock/models/email_list_default_response_issues_inner.rb +164 -0
  34. data/lib/mailmock/models/email_read200_response.rb +370 -0
  35. data/lib/mailmock/models/email_read200_response_headers_inner.rb +190 -0
  36. data/lib/mailmock/models/email_read_request.rb +175 -0
  37. data/lib/mailmock/models/send_aws200_response.rb +242 -0
  38. data/lib/mailmock/models/send_aws_request.rb +242 -0
  39. data/lib/mailmock/models/send_aws_request_mail.rb +324 -0
  40. data/lib/mailmock/models/send_aws_request_mail_common_headers.rb +298 -0
  41. data/lib/mailmock/models/send_aws_request_receipt.rb +374 -0
  42. data/lib/mailmock/models/send_aws_request_receipt_action.rb +216 -0
  43. data/lib/mailmock/models/send_aws_request_receipt_spam_verdict.rb +164 -0
  44. data/lib/mailmock/version.rb +15 -0
  45. data/lib/mailmock.rb +57 -0
  46. data/mailmock.gemspec +39 -0
  47. data/spec/api/email_api_spec.rb +70 -0
  48. data/spec/api/send_api_spec.rb +45 -0
  49. data/spec/api_client_spec.rb +228 -0
  50. data/spec/configuration_spec.rb +42 -0
  51. data/spec/models/email_create200_response_spec.rb +40 -0
  52. data/spec/models/email_create_request_spec.rb +40 -0
  53. data/spec/models/email_list200_response_inner_spec.rb +62 -0
  54. data/spec/models/email_list_default_response_issues_inner_spec.rb +34 -0
  55. data/spec/models/email_list_default_response_spec.rb +46 -0
  56. data/spec/models/email_read200_response_headers_inner_spec.rb +40 -0
  57. data/spec/models/email_read200_response_spec.rb +88 -0
  58. data/spec/models/email_read_request_spec.rb +40 -0
  59. data/spec/models/send_aws200_response_spec.rb +52 -0
  60. data/spec/models/send_aws_request_mail_common_headers_spec.rb +64 -0
  61. data/spec/models/send_aws_request_mail_spec.rb +70 -0
  62. data/spec/models/send_aws_request_receipt_action_spec.rb +46 -0
  63. data/spec/models/send_aws_request_receipt_spam_verdict_spec.rb +34 -0
  64. data/spec/models/send_aws_request_receipt_spec.rb +82 -0
  65. data/spec/models/send_aws_request_spec.rb +52 -0
  66. data/spec/spec_helper.rb +111 -0
  67. metadata +168 -0
@@ -0,0 +1,370 @@
1
+ =begin
2
+ #Mailmock API
3
+
4
+ #Mailmock API
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.24.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Mailmock
17
+ class EmailRead200Response < ApiModelBase
18
+ attr_accessor :from
19
+
20
+ attr_accessor :to
21
+
22
+ attr_accessor :subject
23
+
24
+ attr_accessor :headers
25
+
26
+ attr_accessor :text
27
+
28
+ attr_accessor :html
29
+
30
+ attr_accessor :timestamp
31
+
32
+ attr_accessor :unread
33
+
34
+ attr_accessor :ttl
35
+
36
+ attr_accessor :error
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'from' => :'from',
42
+ :'to' => :'to',
43
+ :'subject' => :'subject',
44
+ :'headers' => :'headers',
45
+ :'text' => :'text',
46
+ :'html' => :'html',
47
+ :'timestamp' => :'timestamp',
48
+ :'unread' => :'unread',
49
+ :'ttl' => :'ttl',
50
+ :'error' => :'error'
51
+ }
52
+ end
53
+
54
+ # Returns attribute mapping this model knows about
55
+ def self.acceptable_attribute_map
56
+ attribute_map
57
+ end
58
+
59
+ # Returns all the JSON keys this model knows about
60
+ def self.acceptable_attributes
61
+ acceptable_attribute_map.values
62
+ end
63
+
64
+ # Attribute type mapping.
65
+ def self.openapi_types
66
+ {
67
+ :'from' => :'Array<String>',
68
+ :'to' => :'Array<String>',
69
+ :'subject' => :'String',
70
+ :'headers' => :'Array<EmailRead200ResponseHeadersInner>',
71
+ :'text' => :'String',
72
+ :'html' => :'String',
73
+ :'timestamp' => :'Time',
74
+ :'unread' => :'Boolean',
75
+ :'ttl' => :'Float',
76
+ :'error' => :'String'
77
+ }
78
+ end
79
+
80
+ # List of attributes with nullable: true
81
+ def self.openapi_nullable
82
+ Set.new([
83
+ ])
84
+ end
85
+
86
+ # Initializes the object
87
+ # @param [Hash] attributes Model attributes in the form of hash
88
+ def initialize(attributes = {})
89
+ if (!attributes.is_a?(Hash))
90
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Mailmock::EmailRead200Response` initialize method"
91
+ end
92
+
93
+ # check to see if the attribute exists and convert string to symbol for hash key
94
+ acceptable_attribute_map = self.class.acceptable_attribute_map
95
+ attributes = attributes.each_with_object({}) { |(k, v), h|
96
+ if (!acceptable_attribute_map.key?(k.to_sym))
97
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Mailmock::EmailRead200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
98
+ end
99
+ h[k.to_sym] = v
100
+ }
101
+
102
+ if attributes.key?(:'from')
103
+ if (value = attributes[:'from']).is_a?(Array)
104
+ self.from = value
105
+ end
106
+ else
107
+ self.from = nil
108
+ end
109
+
110
+ if attributes.key?(:'to')
111
+ if (value = attributes[:'to']).is_a?(Array)
112
+ self.to = value
113
+ end
114
+ else
115
+ self.to = nil
116
+ end
117
+
118
+ if attributes.key?(:'subject')
119
+ self.subject = attributes[:'subject']
120
+ else
121
+ self.subject = nil
122
+ end
123
+
124
+ if attributes.key?(:'headers')
125
+ if (value = attributes[:'headers']).is_a?(Array)
126
+ self.headers = value
127
+ end
128
+ else
129
+ self.headers = nil
130
+ end
131
+
132
+ if attributes.key?(:'text')
133
+ self.text = attributes[:'text']
134
+ else
135
+ self.text = nil
136
+ end
137
+
138
+ if attributes.key?(:'html')
139
+ self.html = attributes[:'html']
140
+ end
141
+
142
+ if attributes.key?(:'timestamp')
143
+ self.timestamp = attributes[:'timestamp']
144
+ else
145
+ self.timestamp = nil
146
+ end
147
+
148
+ if attributes.key?(:'unread')
149
+ self.unread = attributes[:'unread']
150
+ else
151
+ self.unread = nil
152
+ end
153
+
154
+ if attributes.key?(:'ttl')
155
+ self.ttl = attributes[:'ttl']
156
+ else
157
+ self.ttl = nil
158
+ end
159
+
160
+ if attributes.key?(:'error')
161
+ self.error = attributes[:'error']
162
+ end
163
+ end
164
+
165
+ # Show invalid properties with the reasons. Usually used together with valid?
166
+ # @return Array for valid properties with the reasons
167
+ def list_invalid_properties
168
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
169
+ invalid_properties = Array.new
170
+ if @from.nil?
171
+ invalid_properties.push('invalid value for "from", from cannot be nil.')
172
+ end
173
+
174
+ if @to.nil?
175
+ invalid_properties.push('invalid value for "to", to cannot be nil.')
176
+ end
177
+
178
+ if @subject.nil?
179
+ invalid_properties.push('invalid value for "subject", subject cannot be nil.')
180
+ end
181
+
182
+ if @headers.nil?
183
+ invalid_properties.push('invalid value for "headers", headers cannot be nil.')
184
+ end
185
+
186
+ if @text.nil?
187
+ invalid_properties.push('invalid value for "text", text cannot be nil.')
188
+ end
189
+
190
+ if @timestamp.nil?
191
+ invalid_properties.push('invalid value for "timestamp", timestamp cannot be nil.')
192
+ end
193
+
194
+ if @unread.nil?
195
+ invalid_properties.push('invalid value for "unread", unread cannot be nil.')
196
+ end
197
+
198
+ if @ttl.nil?
199
+ invalid_properties.push('invalid value for "ttl", ttl cannot be nil.')
200
+ end
201
+
202
+ invalid_properties
203
+ end
204
+
205
+ # Check to see if the all the properties in the model are valid
206
+ # @return true if the model is valid
207
+ def valid?
208
+ warn '[DEPRECATED] the `valid?` method is obsolete'
209
+ return false if @from.nil?
210
+ return false if @to.nil?
211
+ return false if @subject.nil?
212
+ return false if @headers.nil?
213
+ return false if @text.nil?
214
+ return false if @timestamp.nil?
215
+ return false if @unread.nil?
216
+ return false if @ttl.nil?
217
+ true
218
+ end
219
+
220
+ # Custom attribute writer method with validation
221
+ # @param [Object] from Value to be assigned
222
+ def from=(from)
223
+ if from.nil?
224
+ fail ArgumentError, 'from cannot be nil'
225
+ end
226
+
227
+ @from = from
228
+ end
229
+
230
+ # Custom attribute writer method with validation
231
+ # @param [Object] to Value to be assigned
232
+ def to=(to)
233
+ if to.nil?
234
+ fail ArgumentError, 'to cannot be nil'
235
+ end
236
+
237
+ @to = to
238
+ end
239
+
240
+ # Custom attribute writer method with validation
241
+ # @param [Object] subject Value to be assigned
242
+ def subject=(subject)
243
+ if subject.nil?
244
+ fail ArgumentError, 'subject cannot be nil'
245
+ end
246
+
247
+ @subject = subject
248
+ end
249
+
250
+ # Custom attribute writer method with validation
251
+ # @param [Object] headers Value to be assigned
252
+ def headers=(headers)
253
+ if headers.nil?
254
+ fail ArgumentError, 'headers cannot be nil'
255
+ end
256
+
257
+ @headers = headers
258
+ end
259
+
260
+ # Custom attribute writer method with validation
261
+ # @param [Object] text Value to be assigned
262
+ def text=(text)
263
+ if text.nil?
264
+ fail ArgumentError, 'text cannot be nil'
265
+ end
266
+
267
+ @text = text
268
+ end
269
+
270
+ # Custom attribute writer method with validation
271
+ # @param [Object] timestamp Value to be assigned
272
+ def timestamp=(timestamp)
273
+ if timestamp.nil?
274
+ fail ArgumentError, 'timestamp cannot be nil'
275
+ end
276
+
277
+ @timestamp = timestamp
278
+ end
279
+
280
+ # Custom attribute writer method with validation
281
+ # @param [Object] unread Value to be assigned
282
+ def unread=(unread)
283
+ if unread.nil?
284
+ fail ArgumentError, 'unread cannot be nil'
285
+ end
286
+
287
+ @unread = unread
288
+ end
289
+
290
+ # Custom attribute writer method with validation
291
+ # @param [Object] ttl Value to be assigned
292
+ def ttl=(ttl)
293
+ if ttl.nil?
294
+ fail ArgumentError, 'ttl cannot be nil'
295
+ end
296
+
297
+ @ttl = ttl
298
+ end
299
+
300
+ # Checks equality by comparing each attribute.
301
+ # @param [Object] Object to be compared
302
+ def ==(o)
303
+ return true if self.equal?(o)
304
+ self.class == o.class &&
305
+ from == o.from &&
306
+ to == o.to &&
307
+ subject == o.subject &&
308
+ headers == o.headers &&
309
+ text == o.text &&
310
+ html == o.html &&
311
+ timestamp == o.timestamp &&
312
+ unread == o.unread &&
313
+ ttl == o.ttl &&
314
+ error == o.error
315
+ end
316
+
317
+ # @see the `==` method
318
+ # @param [Object] Object to be compared
319
+ def eql?(o)
320
+ self == o
321
+ end
322
+
323
+ # Calculates hash code according to all attributes.
324
+ # @return [Integer] Hash code
325
+ def hash
326
+ [from, to, subject, headers, text, html, timestamp, unread, ttl, error].hash
327
+ end
328
+
329
+ # Builds the object from hash
330
+ # @param [Hash] attributes Model attributes in the form of hash
331
+ # @return [Object] Returns the model itself
332
+ def self.build_from_hash(attributes)
333
+ return nil unless attributes.is_a?(Hash)
334
+ attributes = attributes.transform_keys(&:to_sym)
335
+ transformed_hash = {}
336
+ openapi_types.each_pair do |key, type|
337
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
338
+ transformed_hash["#{key}"] = nil
339
+ elsif type =~ /\AArray<(.*)>/i
340
+ # check to ensure the input is an array given that the attribute
341
+ # is documented as an array but the input is not
342
+ if attributes[attribute_map[key]].is_a?(Array)
343
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
344
+ end
345
+ elsif !attributes[attribute_map[key]].nil?
346
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
347
+ end
348
+ end
349
+ new(transformed_hash)
350
+ end
351
+
352
+ # Returns the object in the form of hash
353
+ # @return [Hash] Returns the object in the form of hash
354
+ def to_hash
355
+ hash = {}
356
+ self.class.attribute_map.each_pair do |attr, param|
357
+ value = self.send(attr)
358
+ if value.nil?
359
+ is_nullable = self.class.openapi_nullable.include?(attr)
360
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
361
+ end
362
+
363
+ hash[param] = _to_hash(value)
364
+ end
365
+ hash
366
+ end
367
+
368
+ end
369
+
370
+ end
@@ -0,0 +1,190 @@
1
+ =begin
2
+ #Mailmock API
3
+
4
+ #Mailmock API
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.24.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Mailmock
17
+ class EmailRead200ResponseHeadersInner < ApiModelBase
18
+ attr_accessor :name
19
+
20
+ attr_accessor :value
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'name' => :'name',
26
+ :'value' => :'value'
27
+ }
28
+ end
29
+
30
+ # Returns attribute mapping this model knows about
31
+ def self.acceptable_attribute_map
32
+ attribute_map
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ acceptable_attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'name' => :'String',
44
+ :'value' => :'String'
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 `Mailmock::EmailRead200ResponseHeadersInner` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ acceptable_attribute_map = self.class.acceptable_attribute_map
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!acceptable_attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Mailmock::EmailRead200ResponseHeadersInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'name')
71
+ self.name = attributes[:'name']
72
+ else
73
+ self.name = nil
74
+ end
75
+
76
+ if attributes.key?(:'value')
77
+ self.value = attributes[:'value']
78
+ else
79
+ self.value = nil
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
87
+ invalid_properties = Array.new
88
+ if @name.nil?
89
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
90
+ end
91
+
92
+ if @value.nil?
93
+ invalid_properties.push('invalid value for "value", value cannot be nil.')
94
+ end
95
+
96
+ invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ warn '[DEPRECATED] the `valid?` method is obsolete'
103
+ return false if @name.nil?
104
+ return false if @value.nil?
105
+ true
106
+ end
107
+
108
+ # Custom attribute writer method with validation
109
+ # @param [Object] name Value to be assigned
110
+ def name=(name)
111
+ if name.nil?
112
+ fail ArgumentError, 'name cannot be nil'
113
+ end
114
+
115
+ @name = name
116
+ end
117
+
118
+ # Custom attribute writer method with validation
119
+ # @param [Object] value Value to be assigned
120
+ def value=(value)
121
+ if value.nil?
122
+ fail ArgumentError, 'value cannot be nil'
123
+ end
124
+
125
+ @value = value
126
+ end
127
+
128
+ # Checks equality by comparing each attribute.
129
+ # @param [Object] Object to be compared
130
+ def ==(o)
131
+ return true if self.equal?(o)
132
+ self.class == o.class &&
133
+ name == o.name &&
134
+ value == o.value
135
+ end
136
+
137
+ # @see the `==` method
138
+ # @param [Object] Object to be compared
139
+ def eql?(o)
140
+ self == o
141
+ end
142
+
143
+ # Calculates hash code according to all attributes.
144
+ # @return [Integer] Hash code
145
+ def hash
146
+ [name, value].hash
147
+ end
148
+
149
+ # Builds the object from hash
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ # @return [Object] Returns the model itself
152
+ def self.build_from_hash(attributes)
153
+ return nil unless attributes.is_a?(Hash)
154
+ attributes = attributes.transform_keys(&:to_sym)
155
+ transformed_hash = {}
156
+ openapi_types.each_pair do |key, type|
157
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
158
+ transformed_hash["#{key}"] = nil
159
+ elsif type =~ /\AArray<(.*)>/i
160
+ # check to ensure the input is an array given that the attribute
161
+ # is documented as an array but the input is not
162
+ if attributes[attribute_map[key]].is_a?(Array)
163
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
164
+ end
165
+ elsif !attributes[attribute_map[key]].nil?
166
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
167
+ end
168
+ end
169
+ new(transformed_hash)
170
+ end
171
+
172
+ # Returns the object in the form of hash
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_hash
175
+ hash = {}
176
+ self.class.attribute_map.each_pair do |attr, param|
177
+ value = self.send(attr)
178
+ if value.nil?
179
+ is_nullable = self.class.openapi_nullable.include?(attr)
180
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
181
+ end
182
+
183
+ hash[param] = _to_hash(value)
184
+ end
185
+ hash
186
+ end
187
+
188
+ end
189
+
190
+ end