mailslurp_client 15.12.13 → 15.12.14

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