mailslurp_client 4.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +8 -0
  3. data/Gemfile.lock +79 -0
  4. data/LICENSE +22 -0
  5. data/README.md +126 -0
  6. data/Rakefile +10 -0
  7. data/docs/BasicAuthOptions.md +9 -0
  8. data/docs/BulkSendEmailOptions.md +9 -0
  9. data/docs/CommonOperationsApi.md +166 -0
  10. data/docs/CreateWebhookOptions.md +10 -0
  11. data/docs/Email.md +22 -0
  12. data/docs/EmailAnalysis.md +12 -0
  13. data/docs/EmailPreview.md +9 -0
  14. data/docs/ExtraOperationsApi.md +855 -0
  15. data/docs/Inbox.md +11 -0
  16. data/docs/SendEmailOptions.md +16 -0
  17. data/docs/Webhook.md +13 -0
  18. data/git_push.sh +55 -0
  19. data/lib/mailslurp_client.rb +50 -0
  20. data/lib/mailslurp_client/api/common_operations_api.rb +175 -0
  21. data/lib/mailslurp_client/api/extra_operations_api.rb +879 -0
  22. data/lib/mailslurp_client/api_client.rb +389 -0
  23. data/lib/mailslurp_client/api_error.rb +38 -0
  24. data/lib/mailslurp_client/configuration.rb +251 -0
  25. data/lib/mailslurp_client/models/basic_auth_options.rb +202 -0
  26. data/lib/mailslurp_client/models/bulk_send_email_options.rb +201 -0
  27. data/lib/mailslurp_client/models/create_webhook_options.rb +202 -0
  28. data/lib/mailslurp_client/models/email.rb +350 -0
  29. data/lib/mailslurp_client/models/email_analysis.rb +245 -0
  30. data/lib/mailslurp_client/models/email_preview.rb +203 -0
  31. data/lib/mailslurp_client/models/inbox.rb +212 -0
  32. data/lib/mailslurp_client/models/send_email_options.rb +275 -0
  33. data/lib/mailslurp_client/models/webhook.rb +242 -0
  34. data/lib/mailslurp_client/version.rb +15 -0
  35. data/mailslurp_client.gemspec +45 -0
  36. data/spec/api/common_operations_api_spec.rb +71 -0
  37. data/spec/api/extra_operations_api_spec.rb +231 -0
  38. data/spec/api_client_spec.rb +226 -0
  39. data/spec/configuration_spec.rb +42 -0
  40. data/spec/models/basic_auth_options_spec.rb +47 -0
  41. data/spec/models/bulk_send_email_options_spec.rb +47 -0
  42. data/spec/models/create_webhook_options_spec.rb +53 -0
  43. data/spec/models/email_analysis_spec.rb +65 -0
  44. data/spec/models/email_preview_spec.rb +47 -0
  45. data/spec/models/email_spec.rb +125 -0
  46. data/spec/models/inbox_spec.rb +59 -0
  47. data/spec/models/send_email_options_spec.rb +89 -0
  48. data/spec/models/webhook_spec.rb +71 -0
  49. data/spec/spec_helper.rb +111 -0
  50. metadata +287 -0
@@ -0,0 +1,350 @@
1
+ =begin
2
+ #MailSlurp API
3
+
4
+ #For documentation see [developer guide](https://www.mailslurp.com/developers). [Create an account](https://app.mailslurp.com) in the MailSlurp Dashboard to [view your API Key](https://app). For all bugs, feature requests, or help please [see support](https://www.mailslurp.com/support/).
5
+
6
+ OpenAPI spec version: 0.0.1-alpha
7
+ Contact: contact@mailslurp.dev
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.4
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module MailSlurpClient
16
+ # Representation of an email
17
+ class Email
18
+ attr_accessor :analysis
19
+
20
+ attr_accessor :attachments
21
+
22
+ attr_accessor :bcc
23
+
24
+ attr_accessor :body
25
+
26
+ attr_accessor :cc
27
+
28
+ attr_accessor :created_at
29
+
30
+ attr_accessor :from
31
+
32
+ attr_accessor :headers
33
+
34
+ attr_accessor :id
35
+
36
+ attr_accessor :inbox_id
37
+
38
+ attr_accessor :raw_url
39
+
40
+ attr_accessor :subject
41
+
42
+ attr_accessor :to
43
+
44
+ attr_accessor :updated_at
45
+
46
+ attr_accessor :user_id
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'analysis' => :'analysis',
52
+ :'attachments' => :'attachments',
53
+ :'bcc' => :'bcc',
54
+ :'body' => :'body',
55
+ :'cc' => :'cc',
56
+ :'created_at' => :'createdAt',
57
+ :'from' => :'from',
58
+ :'headers' => :'headers',
59
+ :'id' => :'id',
60
+ :'inbox_id' => :'inboxId',
61
+ :'raw_url' => :'rawUrl',
62
+ :'subject' => :'subject',
63
+ :'to' => :'to',
64
+ :'updated_at' => :'updatedAt',
65
+ :'user_id' => :'userId'
66
+ }
67
+ end
68
+
69
+ # Attribute type mapping.
70
+ def self.openapi_types
71
+ {
72
+ :'analysis' => :'EmailAnalysis',
73
+ :'attachments' => :'Array<String>',
74
+ :'bcc' => :'Array<String>',
75
+ :'body' => :'String',
76
+ :'cc' => :'Array<String>',
77
+ :'created_at' => :'DateTime',
78
+ :'from' => :'String',
79
+ :'headers' => :'Hash<String, String>',
80
+ :'id' => :'String',
81
+ :'inbox_id' => :'String',
82
+ :'raw_url' => :'String',
83
+ :'subject' => :'String',
84
+ :'to' => :'Array<String>',
85
+ :'updated_at' => :'DateTime',
86
+ :'user_id' => :'String'
87
+ }
88
+ end
89
+
90
+ # Initializes the object
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ def initialize(attributes = {})
93
+ return unless attributes.is_a?(Hash)
94
+
95
+ # convert string to symbol for hash key
96
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
97
+
98
+ if attributes.has_key?(:'analysis')
99
+ self.analysis = attributes[:'analysis']
100
+ end
101
+
102
+ if attributes.has_key?(:'attachments')
103
+ if (value = attributes[:'attachments']).is_a?(Array)
104
+ self.attachments = value
105
+ end
106
+ end
107
+
108
+ if attributes.has_key?(:'bcc')
109
+ if (value = attributes[:'bcc']).is_a?(Array)
110
+ self.bcc = value
111
+ end
112
+ end
113
+
114
+ if attributes.has_key?(:'body')
115
+ self.body = attributes[:'body']
116
+ end
117
+
118
+ if attributes.has_key?(:'cc')
119
+ if (value = attributes[:'cc']).is_a?(Array)
120
+ self.cc = value
121
+ end
122
+ end
123
+
124
+ if attributes.has_key?(:'createdAt')
125
+ self.created_at = attributes[:'createdAt']
126
+ end
127
+
128
+ if attributes.has_key?(:'from')
129
+ self.from = attributes[:'from']
130
+ end
131
+
132
+ if attributes.has_key?(:'headers')
133
+ if (value = attributes[:'headers']).is_a?(Hash)
134
+ self.headers = value
135
+ end
136
+ end
137
+
138
+ if attributes.has_key?(:'id')
139
+ self.id = attributes[:'id']
140
+ end
141
+
142
+ if attributes.has_key?(:'inboxId')
143
+ self.inbox_id = attributes[:'inboxId']
144
+ end
145
+
146
+ if attributes.has_key?(:'rawUrl')
147
+ self.raw_url = attributes[:'rawUrl']
148
+ end
149
+
150
+ if attributes.has_key?(:'subject')
151
+ self.subject = attributes[:'subject']
152
+ end
153
+
154
+ if attributes.has_key?(:'to')
155
+ if (value = attributes[:'to']).is_a?(Array)
156
+ self.to = value
157
+ end
158
+ end
159
+
160
+ if attributes.has_key?(:'updatedAt')
161
+ self.updated_at = attributes[:'updatedAt']
162
+ end
163
+
164
+ if attributes.has_key?(:'userId')
165
+ self.user_id = attributes[:'userId']
166
+ end
167
+ end
168
+
169
+ # Show invalid properties with the reasons. Usually used together with valid?
170
+ # @return Array for valid properties with the reasons
171
+ def list_invalid_properties
172
+ invalid_properties = Array.new
173
+ if @created_at.nil?
174
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
175
+ end
176
+
177
+ if @id.nil?
178
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
179
+ end
180
+
181
+ if @inbox_id.nil?
182
+ invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
183
+ end
184
+
185
+ if @to.nil?
186
+ invalid_properties.push('invalid value for "to", to cannot be nil.')
187
+ end
188
+
189
+ if @updated_at.nil?
190
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
191
+ end
192
+
193
+ if @user_id.nil?
194
+ invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
195
+ end
196
+
197
+ invalid_properties
198
+ end
199
+
200
+ # Check to see if the all the properties in the model are valid
201
+ # @return true if the model is valid
202
+ def valid?
203
+ return false if @created_at.nil?
204
+ return false if @id.nil?
205
+ return false if @inbox_id.nil?
206
+ return false if @to.nil?
207
+ return false if @updated_at.nil?
208
+ return false if @user_id.nil?
209
+ true
210
+ end
211
+
212
+ # Checks equality by comparing each attribute.
213
+ # @param [Object] Object to be compared
214
+ def ==(o)
215
+ return true if self.equal?(o)
216
+ self.class == o.class &&
217
+ analysis == o.analysis &&
218
+ attachments == o.attachments &&
219
+ bcc == o.bcc &&
220
+ body == o.body &&
221
+ cc == o.cc &&
222
+ created_at == o.created_at &&
223
+ from == o.from &&
224
+ headers == o.headers &&
225
+ id == o.id &&
226
+ inbox_id == o.inbox_id &&
227
+ raw_url == o.raw_url &&
228
+ subject == o.subject &&
229
+ to == o.to &&
230
+ updated_at == o.updated_at &&
231
+ user_id == o.user_id
232
+ end
233
+
234
+ # @see the `==` method
235
+ # @param [Object] Object to be compared
236
+ def eql?(o)
237
+ self == o
238
+ end
239
+
240
+ # Calculates hash code according to all attributes.
241
+ # @return [Fixnum] Hash code
242
+ def hash
243
+ [analysis, attachments, bcc, body, cc, created_at, from, headers, id, inbox_id, raw_url, subject, to, updated_at, user_id].hash
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 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
+ temp_model = MailSlurpClient.const_get(type).new
304
+ temp_model.build_from_hash(value)
305
+ end
306
+ end
307
+
308
+ # Returns the string representation of the object
309
+ # @return [String] String presentation of the object
310
+ def to_s
311
+ to_hash.to_s
312
+ end
313
+
314
+ # to_body is an alias to to_hash (backward compatibility)
315
+ # @return [Hash] Returns the object in the form of hash
316
+ def to_body
317
+ to_hash
318
+ end
319
+
320
+ # Returns the object in the form of hash
321
+ # @return [Hash] Returns the object in the form of hash
322
+ def to_hash
323
+ hash = {}
324
+ self.class.attribute_map.each_pair do |attr, param|
325
+ value = self.send(attr)
326
+ next if value.nil?
327
+ hash[param] = _to_hash(value)
328
+ end
329
+ hash
330
+ end
331
+
332
+ # Outputs non-array value in the form of hash
333
+ # For object, use to_hash. Otherwise, just return the value
334
+ # @param [Object] value Any valid value
335
+ # @return [Hash] Returns the value in the form of hash
336
+ def _to_hash(value)
337
+ if value.is_a?(Array)
338
+ value.compact.map { |v| _to_hash(v) }
339
+ elsif value.is_a?(Hash)
340
+ {}.tap do |hash|
341
+ value.each { |k, v| hash[k] = _to_hash(v) }
342
+ end
343
+ elsif value.respond_to? :to_hash
344
+ value.to_hash
345
+ else
346
+ value
347
+ end
348
+ end
349
+ end
350
+ end
@@ -0,0 +1,245 @@
1
+ =begin
2
+ #MailSlurp API
3
+
4
+ #For documentation see [developer guide](https://www.mailslurp.com/developers). [Create an account](https://app.mailslurp.com) in the MailSlurp Dashboard to [view your API Key](https://app). For all bugs, feature requests, or help please [see support](https://www.mailslurp.com/support/).
5
+
6
+ OpenAPI spec version: 0.0.1-alpha
7
+ Contact: contact@mailslurp.dev
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.4
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module MailSlurpClient
16
+ # Analysis of email
17
+ class EmailAnalysis
18
+ attr_accessor :dkim_verdict
19
+
20
+ attr_accessor :dmarc_verdict
21
+
22
+ attr_accessor :spam_verdict
23
+
24
+ attr_accessor :spf_verdict
25
+
26
+ attr_accessor :virus_verdict
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'dkim_verdict' => :'dkimVerdict',
32
+ :'dmarc_verdict' => :'dmarcVerdict',
33
+ :'spam_verdict' => :'spamVerdict',
34
+ :'spf_verdict' => :'spfVerdict',
35
+ :'virus_verdict' => :'virusVerdict'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'dkim_verdict' => :'String',
43
+ :'dmarc_verdict' => :'String',
44
+ :'spam_verdict' => :'String',
45
+ :'spf_verdict' => :'String',
46
+ :'virus_verdict' => :'String'
47
+ }
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ return unless attributes.is_a?(Hash)
54
+
55
+ # convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
57
+
58
+ if attributes.has_key?(:'dkimVerdict')
59
+ self.dkim_verdict = attributes[:'dkimVerdict']
60
+ end
61
+
62
+ if attributes.has_key?(:'dmarcVerdict')
63
+ self.dmarc_verdict = attributes[:'dmarcVerdict']
64
+ end
65
+
66
+ if attributes.has_key?(:'spamVerdict')
67
+ self.spam_verdict = attributes[:'spamVerdict']
68
+ end
69
+
70
+ if attributes.has_key?(:'spfVerdict')
71
+ self.spf_verdict = attributes[:'spfVerdict']
72
+ end
73
+
74
+ if attributes.has_key?(:'virusVerdict')
75
+ self.virus_verdict = attributes[:'virusVerdict']
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ if @dkim_verdict.nil?
84
+ invalid_properties.push('invalid value for "dkim_verdict", dkim_verdict cannot be nil.')
85
+ end
86
+
87
+ if @dmarc_verdict.nil?
88
+ invalid_properties.push('invalid value for "dmarc_verdict", dmarc_verdict cannot be nil.')
89
+ end
90
+
91
+ if @spam_verdict.nil?
92
+ invalid_properties.push('invalid value for "spam_verdict", spam_verdict cannot be nil.')
93
+ end
94
+
95
+ if @spf_verdict.nil?
96
+ invalid_properties.push('invalid value for "spf_verdict", spf_verdict cannot be nil.')
97
+ end
98
+
99
+ if @virus_verdict.nil?
100
+ invalid_properties.push('invalid value for "virus_verdict", virus_verdict cannot be nil.')
101
+ end
102
+
103
+ invalid_properties
104
+ end
105
+
106
+ # Check to see if the all the properties in the model are valid
107
+ # @return true if the model is valid
108
+ def valid?
109
+ return false if @dkim_verdict.nil?
110
+ return false if @dmarc_verdict.nil?
111
+ return false if @spam_verdict.nil?
112
+ return false if @spf_verdict.nil?
113
+ return false if @virus_verdict.nil?
114
+ true
115
+ end
116
+
117
+ # Checks equality by comparing each attribute.
118
+ # @param [Object] Object to be compared
119
+ def ==(o)
120
+ return true if self.equal?(o)
121
+ self.class == o.class &&
122
+ dkim_verdict == o.dkim_verdict &&
123
+ dmarc_verdict == o.dmarc_verdict &&
124
+ spam_verdict == o.spam_verdict &&
125
+ spf_verdict == o.spf_verdict &&
126
+ virus_verdict == o.virus_verdict
127
+ end
128
+
129
+ # @see the `==` method
130
+ # @param [Object] Object to be compared
131
+ def eql?(o)
132
+ self == o
133
+ end
134
+
135
+ # Calculates hash code according to all attributes.
136
+ # @return [Fixnum] Hash code
137
+ def hash
138
+ [dkim_verdict, dmarc_verdict, spam_verdict, spf_verdict, virus_verdict].hash
139
+ end
140
+
141
+ # Builds the object from hash
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ # @return [Object] Returns the model itself
144
+ def build_from_hash(attributes)
145
+ return nil unless attributes.is_a?(Hash)
146
+ self.class.openapi_types.each_pair do |key, type|
147
+ if type =~ /\AArray<(.*)>/i
148
+ # check to ensure the input is an array given that the the attribute
149
+ # is documented as an array but the input is not
150
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
151
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
152
+ end
153
+ elsif !attributes[self.class.attribute_map[key]].nil?
154
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
155
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
156
+ end
157
+
158
+ self
159
+ end
160
+
161
+ # Deserializes the data based on type
162
+ # @param string type Data type
163
+ # @param string value Value to be deserialized
164
+ # @return [Object] Deserialized data
165
+ def _deserialize(type, value)
166
+ case type.to_sym
167
+ when :DateTime
168
+ DateTime.parse(value)
169
+ when :Date
170
+ Date.parse(value)
171
+ when :String
172
+ value.to_s
173
+ when :Integer
174
+ value.to_i
175
+ when :Float
176
+ value.to_f
177
+ when :BOOLEAN
178
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
179
+ true
180
+ else
181
+ false
182
+ end
183
+ when :Object
184
+ # generic object (usually a Hash), return directly
185
+ value
186
+ when /\AArray<(?<inner_type>.+)>\z/
187
+ inner_type = Regexp.last_match[:inner_type]
188
+ value.map { |v| _deserialize(inner_type, v) }
189
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
190
+ k_type = Regexp.last_match[:k_type]
191
+ v_type = Regexp.last_match[:v_type]
192
+ {}.tap do |hash|
193
+ value.each do |k, v|
194
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
195
+ end
196
+ end
197
+ else # model
198
+ temp_model = MailSlurpClient.const_get(type).new
199
+ temp_model.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
+ next if value.nil?
222
+ hash[param] = _to_hash(value)
223
+ end
224
+ hash
225
+ end
226
+
227
+ # Outputs non-array value in the form of hash
228
+ # For object, use to_hash. Otherwise, just return the value
229
+ # @param [Object] value Any valid value
230
+ # @return [Hash] Returns the value in the form of hash
231
+ def _to_hash(value)
232
+ if value.is_a?(Array)
233
+ value.compact.map { |v| _to_hash(v) }
234
+ elsif value.is_a?(Hash)
235
+ {}.tap do |hash|
236
+ value.each { |k, v| hash[k] = _to_hash(v) }
237
+ end
238
+ elsif value.respond_to? :to_hash
239
+ value.to_hash
240
+ else
241
+ value
242
+ end
243
+ end
244
+ end
245
+ end