mailslurp_client 15.5.3 → 15.5.4

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