mailslurp_client 8.2.11 → 8.2.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,76 +13,55 @@ OpenAPI Generator version: 4.3.1
13
13
  require 'date'
14
14
 
15
15
  module MailSlurpClient
16
- class SentEmail
17
- attr_accessor :attachments
16
+ # DNS lookup result. Includes record type, time to live, raw response, and name value for the name server response.
17
+ class DNSLookupResult
18
+ attr_accessor :data
18
19
 
19
- attr_accessor :bcc
20
+ attr_accessor :record_type
20
21
 
21
- attr_accessor :body_md5_hash
22
+ attr_accessor :ttl
22
23
 
23
- attr_accessor :body_s3_key
24
+ attr_accessor :value
24
25
 
25
- attr_accessor :cc
26
+ class EnumAttributeValidator
27
+ attr_reader :datatype
28
+ attr_reader :allowable_values
26
29
 
27
- attr_accessor :charset
28
-
29
- attr_accessor :created_at
30
-
31
- attr_accessor :from
32
-
33
- attr_accessor :id
34
-
35
- attr_accessor :inbox_id
36
-
37
- attr_accessor :is_html
38
-
39
- attr_accessor :subject
40
-
41
- attr_accessor :to
42
-
43
- attr_accessor :updated_at
30
+ def initialize(datatype, allowable_values)
31
+ @allowable_values = allowable_values.map do |value|
32
+ case datatype.to_s
33
+ when /Integer/i
34
+ value.to_i
35
+ when /Float/i
36
+ value.to_f
37
+ else
38
+ value
39
+ end
40
+ end
41
+ end
44
42
 
45
- attr_accessor :user_id
43
+ def valid?(value)
44
+ !value || allowable_values.include?(value)
45
+ end
46
+ end
46
47
 
47
48
  # Attribute mapping from ruby-style variable name to JSON key.
48
49
  def self.attribute_map
49
50
  {
50
- :'attachments' => :'attachments',
51
- :'bcc' => :'bcc',
52
- :'body_md5_hash' => :'bodyMD5Hash',
53
- :'body_s3_key' => :'bodyS3Key',
54
- :'cc' => :'cc',
55
- :'charset' => :'charset',
56
- :'created_at' => :'createdAt',
57
- :'from' => :'from',
58
- :'id' => :'id',
59
- :'inbox_id' => :'inboxId',
60
- :'is_html' => :'isHTML',
61
- :'subject' => :'subject',
62
- :'to' => :'to',
63
- :'updated_at' => :'updatedAt',
64
- :'user_id' => :'userId'
51
+ :'data' => :'data',
52
+ :'record_type' => :'recordType',
53
+ :'ttl' => :'ttl',
54
+ :'value' => :'value'
65
55
  }
66
56
  end
67
57
 
68
58
  # Attribute type mapping.
69
59
  def self.openapi_types
70
60
  {
71
- :'attachments' => :'Array<String>',
72
- :'bcc' => :'Array<String>',
73
- :'body_md5_hash' => :'String',
74
- :'body_s3_key' => :'String',
75
- :'cc' => :'Array<String>',
76
- :'charset' => :'String',
77
- :'created_at' => :'DateTime',
78
- :'from' => :'String',
79
- :'id' => :'String',
80
- :'inbox_id' => :'String',
81
- :'is_html' => :'Boolean',
82
- :'subject' => :'String',
83
- :'to' => :'Array<String>',
84
- :'updated_at' => :'DateTime',
85
- :'user_id' => :'String'
61
+ :'data' => :'String',
62
+ :'record_type' => :'String',
63
+ :'ttl' => :'Integer',
64
+ :'value' => :'String'
86
65
  }
87
66
  end
88
67
 
@@ -96,83 +75,31 @@ module MailSlurpClient
96
75
  # @param [Hash] attributes Model attributes in the form of hash
97
76
  def initialize(attributes = {})
98
77
  if (!attributes.is_a?(Hash))
99
- fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::SentEmail` initialize method"
78
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::DNSLookupResult` initialize method"
100
79
  end
101
80
 
102
81
  # check to see if the attribute exists and convert string to symbol for hash key
103
82
  attributes = attributes.each_with_object({}) { |(k, v), h|
104
83
  if (!self.class.attribute_map.key?(k.to_sym))
105
- fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::SentEmail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
84
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::DNSLookupResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
106
85
  end
107
86
  h[k.to_sym] = v
108
87
  }
109
88
 
110
- if attributes.key?(:'attachments')
111
- if (value = attributes[:'attachments']).is_a?(Array)
112
- self.attachments = value
113
- end
114
- end
115
-
116
- if attributes.key?(:'bcc')
117
- if (value = attributes[:'bcc']).is_a?(Array)
118
- self.bcc = value
119
- end
120
- end
121
-
122
- if attributes.key?(:'body_md5_hash')
123
- self.body_md5_hash = attributes[:'body_md5_hash']
124
- end
125
-
126
- if attributes.key?(:'body_s3_key')
127
- self.body_s3_key = attributes[:'body_s3_key']
89
+ if attributes.key?(:'data')
90
+ self.data = attributes[:'data']
128
91
  end
129
92
 
130
- if attributes.key?(:'cc')
131
- if (value = attributes[:'cc']).is_a?(Array)
132
- self.cc = value
133
- end
134
- end
135
-
136
- if attributes.key?(:'charset')
137
- self.charset = attributes[:'charset']
138
- end
139
-
140
- if attributes.key?(:'created_at')
141
- self.created_at = attributes[:'created_at']
142
- end
143
-
144
- if attributes.key?(:'from')
145
- self.from = attributes[:'from']
146
- end
147
-
148
- if attributes.key?(:'id')
149
- self.id = attributes[:'id']
150
- end
151
-
152
- if attributes.key?(:'inbox_id')
153
- self.inbox_id = attributes[:'inbox_id']
93
+ if attributes.key?(:'record_type')
94
+ self.record_type = attributes[:'record_type']
154
95
  end
155
96
 
156
- if attributes.key?(:'is_html')
157
- self.is_html = attributes[:'is_html']
97
+ if attributes.key?(:'ttl')
98
+ self.ttl = attributes[:'ttl']
158
99
  end
159
100
 
160
- if attributes.key?(:'subject')
161
- self.subject = attributes[:'subject']
162
- end
163
-
164
- if attributes.key?(:'to')
165
- if (value = attributes[:'to']).is_a?(Array)
166
- self.to = value
167
- end
168
- end
169
-
170
- if attributes.key?(:'updated_at')
171
- self.updated_at = attributes[:'updated_at']
172
- end
173
-
174
- if attributes.key?(:'user_id')
175
- self.user_id = attributes[:'user_id']
101
+ if attributes.key?(:'value')
102
+ self.value = attributes[:'value']
176
103
  end
177
104
  end
178
105
 
@@ -180,20 +107,20 @@ module MailSlurpClient
180
107
  # @return Array for valid properties with the reasons
181
108
  def list_invalid_properties
182
109
  invalid_properties = Array.new
183
- if @created_at.nil?
184
- invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
110
+ if @data.nil?
111
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
185
112
  end
186
113
 
187
- if @inbox_id.nil?
188
- invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
114
+ if @record_type.nil?
115
+ invalid_properties.push('invalid value for "record_type", record_type cannot be nil.')
189
116
  end
190
117
 
191
- if @updated_at.nil?
192
- invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
118
+ if @ttl.nil?
119
+ invalid_properties.push('invalid value for "ttl", ttl cannot be nil.')
193
120
  end
194
121
 
195
- if @user_id.nil?
196
- invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
122
+ if @value.nil?
123
+ invalid_properties.push('invalid value for "value", value cannot be nil.')
197
124
  end
198
125
 
199
126
  invalid_properties
@@ -202,33 +129,34 @@ module MailSlurpClient
202
129
  # Check to see if the all the properties in the model are valid
203
130
  # @return true if the model is valid
204
131
  def valid?
205
- return false if @created_at.nil?
206
- return false if @inbox_id.nil?
207
- return false if @updated_at.nil?
208
- return false if @user_id.nil?
132
+ return false if @data.nil?
133
+ return false if @record_type.nil?
134
+ record_type_validator = EnumAttributeValidator.new('String', ["A", "NS", "MD", "MF", "CNAME", "SOA", "MB", "MG", "MR", "NULL", "WKS", "PTR", "HINFO", "MINFO", "MX", "TXT", "RP", "AFSDB", "X25", "ISDN", "RT", "NSAP", "NSAP_PTR", "SIG", "KEY", "PX", "GPOS", "AAAA", "LOC", "NXT", "EID", "NIMLOC", "SRV", "ATMA", "NAPTR", "KX", "CERT", "A6", "DNAME", "SINK", "OPT", "APL", "DS", "SSHFP", "IPSECKEY", "RRSIG", "NSEC", "DNSKEY", "DHCID", "NSEC3", "NSEC3PARAM", "TLSA", "SMIMEA", "HIP", "NINFO", "RKEY", "TALINK", "CDS", "CDNSKEY", "OPENPGPKEY", "CSYNC", "ZONEMD", "SVCB", "HTTPS", "SPF", "UINFO", "UID", "GID", "UNSPEC", "NID", "L32", "L64", "LP", "EUI48", "EUI64", "TKEY", "TSIG", "IXFR", "AXFR", "MAILB", "MAILA", "ANY", "URI", "CAA", "AVC", "DOA", "AMTRELAY", "TA", "DLV"])
135
+ return false unless record_type_validator.valid?(@record_type)
136
+ return false if @ttl.nil?
137
+ return false if @value.nil?
209
138
  true
210
139
  end
211
140
 
141
+ # Custom attribute writer method checking allowed values (enum).
142
+ # @param [Object] record_type Object to be assigned
143
+ def record_type=(record_type)
144
+ validator = EnumAttributeValidator.new('String', ["A", "NS", "MD", "MF", "CNAME", "SOA", "MB", "MG", "MR", "NULL", "WKS", "PTR", "HINFO", "MINFO", "MX", "TXT", "RP", "AFSDB", "X25", "ISDN", "RT", "NSAP", "NSAP_PTR", "SIG", "KEY", "PX", "GPOS", "AAAA", "LOC", "NXT", "EID", "NIMLOC", "SRV", "ATMA", "NAPTR", "KX", "CERT", "A6", "DNAME", "SINK", "OPT", "APL", "DS", "SSHFP", "IPSECKEY", "RRSIG", "NSEC", "DNSKEY", "DHCID", "NSEC3", "NSEC3PARAM", "TLSA", "SMIMEA", "HIP", "NINFO", "RKEY", "TALINK", "CDS", "CDNSKEY", "OPENPGPKEY", "CSYNC", "ZONEMD", "SVCB", "HTTPS", "SPF", "UINFO", "UID", "GID", "UNSPEC", "NID", "L32", "L64", "LP", "EUI48", "EUI64", "TKEY", "TSIG", "IXFR", "AXFR", "MAILB", "MAILA", "ANY", "URI", "CAA", "AVC", "DOA", "AMTRELAY", "TA", "DLV"])
145
+ unless validator.valid?(record_type)
146
+ fail ArgumentError, "invalid value for \"record_type\", must be one of #{validator.allowable_values}."
147
+ end
148
+ @record_type = record_type
149
+ end
150
+
212
151
  # Checks equality by comparing each attribute.
213
152
  # @param [Object] Object to be compared
214
153
  def ==(o)
215
154
  return true if self.equal?(o)
216
155
  self.class == o.class &&
217
- attachments == o.attachments &&
218
- bcc == o.bcc &&
219
- body_md5_hash == o.body_md5_hash &&
220
- body_s3_key == o.body_s3_key &&
221
- cc == o.cc &&
222
- charset == o.charset &&
223
- created_at == o.created_at &&
224
- from == o.from &&
225
- id == o.id &&
226
- inbox_id == o.inbox_id &&
227
- is_html == o.is_html &&
228
- subject == o.subject &&
229
- to == o.to &&
230
- updated_at == o.updated_at &&
231
- user_id == o.user_id
156
+ data == o.data &&
157
+ record_type == o.record_type &&
158
+ ttl == o.ttl &&
159
+ value == o.value
232
160
  end
233
161
 
234
162
  # @see the `==` method
@@ -240,7 +168,7 @@ module MailSlurpClient
240
168
  # Calculates hash code according to all attributes.
241
169
  # @return [Integer] Hash code
242
170
  def hash
243
- [attachments, bcc, body_md5_hash, body_s3_key, cc, charset, created_at, from, id, inbox_id, is_html, subject, to, updated_at, user_id].hash
171
+ [data, record_type, ttl, value].hash
244
172
  end
245
173
 
246
174
  # Builds the object from hash
@@ -0,0 +1,214 @@
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
+ # Results of query on domain name servers
17
+ class DNSLookupResults
18
+ attr_accessor :results
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'results' => :'results'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.openapi_types
29
+ {
30
+ :'results' => :'Array<DNSLookupResult>'
31
+ }
32
+ end
33
+
34
+ # List of attributes with nullable: true
35
+ def self.openapi_nullable
36
+ Set.new([
37
+ ])
38
+ end
39
+
40
+ # Initializes the object
41
+ # @param [Hash] attributes Model attributes in the form of hash
42
+ def initialize(attributes = {})
43
+ if (!attributes.is_a?(Hash))
44
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::DNSLookupResults` initialize method"
45
+ end
46
+
47
+ # check to see if the attribute exists and convert string to symbol for hash key
48
+ attributes = attributes.each_with_object({}) { |(k, v), h|
49
+ if (!self.class.attribute_map.key?(k.to_sym))
50
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::DNSLookupResults`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
51
+ end
52
+ h[k.to_sym] = v
53
+ }
54
+
55
+ if attributes.key?(:'results')
56
+ if (value = attributes[:'results']).is_a?(Array)
57
+ self.results = value
58
+ end
59
+ end
60
+ end
61
+
62
+ # Show invalid properties with the reasons. Usually used together with valid?
63
+ # @return Array for valid properties with the reasons
64
+ def list_invalid_properties
65
+ invalid_properties = Array.new
66
+ if @results.nil?
67
+ invalid_properties.push('invalid value for "results", results cannot be nil.')
68
+ end
69
+
70
+ invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ return false if @results.nil?
77
+ true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ results == o.results
86
+ end
87
+
88
+ # @see the `==` method
89
+ # @param [Object] Object to be compared
90
+ def eql?(o)
91
+ self == o
92
+ end
93
+
94
+ # Calculates hash code according to all attributes.
95
+ # @return [Integer] Hash code
96
+ def hash
97
+ [results].hash
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def self.build_from_hash(attributes)
104
+ new.build_from_hash(attributes)
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+ self.class.openapi_types.each_pair do |key, type|
113
+ if type =~ /\AArray<(.*)>/i
114
+ # check to ensure the input is an array given that the attribute
115
+ # is documented as an array but the input is not
116
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
117
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
118
+ end
119
+ elsif !attributes[self.class.attribute_map[key]].nil?
120
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
121
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
122
+ end
123
+
124
+ self
125
+ end
126
+
127
+ # Deserializes the data based on type
128
+ # @param string type Data type
129
+ # @param string value Value to be deserialized
130
+ # @return [Object] Deserialized data
131
+ def _deserialize(type, value)
132
+ case type.to_sym
133
+ when :DateTime
134
+ DateTime.parse(value)
135
+ when :Date
136
+ Date.parse(value)
137
+ when :String
138
+ value.to_s
139
+ when :Integer
140
+ value.to_i
141
+ when :Float
142
+ value.to_f
143
+ when :Boolean
144
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
145
+ true
146
+ else
147
+ false
148
+ end
149
+ when :Object
150
+ # generic object (usually a Hash), return directly
151
+ value
152
+ when /\AArray<(?<inner_type>.+)>\z/
153
+ inner_type = Regexp.last_match[:inner_type]
154
+ value.map { |v| _deserialize(inner_type, v) }
155
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
156
+ k_type = Regexp.last_match[:k_type]
157
+ v_type = Regexp.last_match[:v_type]
158
+ {}.tap do |hash|
159
+ value.each do |k, v|
160
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
161
+ end
162
+ end
163
+ else # model
164
+ MailSlurpClient.const_get(type).build_from_hash(value)
165
+ end
166
+ end
167
+
168
+ # Returns the string representation of the object
169
+ # @return [String] String presentation of the object
170
+ def to_s
171
+ to_hash.to_s
172
+ end
173
+
174
+ # to_body is an alias to to_hash (backward compatibility)
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_body
177
+ to_hash
178
+ end
179
+
180
+ # Returns the object in the form of hash
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_hash
183
+ hash = {}
184
+ self.class.attribute_map.each_pair do |attr, param|
185
+ value = self.send(attr)
186
+ if value.nil?
187
+ is_nullable = self.class.openapi_nullable.include?(attr)
188
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
189
+ end
190
+
191
+ hash[param] = _to_hash(value)
192
+ end
193
+ hash
194
+ end
195
+
196
+ # Outputs non-array value in the form of hash
197
+ # For object, use to_hash. Otherwise, just return the value
198
+ # @param [Object] value Any valid value
199
+ # @return [Hash] Returns the value in the form of hash
200
+ def _to_hash(value)
201
+ if value.is_a?(Array)
202
+ value.compact.map { |v| _to_hash(v) }
203
+ elsif value.is_a?(Hash)
204
+ {}.tap do |hash|
205
+ value.each { |k, v| hash[k] = _to_hash(v) }
206
+ end
207
+ elsif value.respond_to? :to_hash
208
+ value.to_hash
209
+ else
210
+ value
211
+ end
212
+ end
213
+ end
214
+ end