mailslurp_client 15.21.1 → 16.0.2

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.
@@ -20,12 +20,12 @@ module MailSlurpClient
20
20
 
21
21
  attr_accessor :created
22
22
 
23
- attr_accessor :from_phone_number
24
-
25
23
  attr_accessor :to_phone_number
26
24
 
27
25
  attr_accessor :message_direction
28
26
 
27
+ attr_accessor :from_phone_number
28
+
29
29
  class EnumAttributeValidator
30
30
  attr_reader :datatype
31
31
  attr_reader :allowable_values
@@ -54,9 +54,9 @@ module MailSlurpClient
54
54
  :'body' => :'body',
55
55
  :'phone_number_id' => :'phoneNumberId',
56
56
  :'created' => :'created',
57
- :'from_phone_number' => :'fromPhoneNumber',
58
57
  :'to_phone_number' => :'toPhoneNumber',
59
- :'message_direction' => :'messageDirection'
58
+ :'message_direction' => :'messageDirection',
59
+ :'from_phone_number' => :'fromPhoneNumber'
60
60
  }
61
61
  end
62
62
 
@@ -66,9 +66,9 @@ module MailSlurpClient
66
66
  :'body' => :'String',
67
67
  :'phone_number_id' => :'String',
68
68
  :'created' => :'DateTime',
69
- :'from_phone_number' => :'String',
70
69
  :'to_phone_number' => :'String',
71
- :'message_direction' => :'String'
70
+ :'message_direction' => :'String',
71
+ :'from_phone_number' => :'String'
72
72
  }
73
73
  end
74
74
 
@@ -105,10 +105,6 @@ module MailSlurpClient
105
105
  self.created = attributes[:'created']
106
106
  end
107
107
 
108
- if attributes.key?(:'from_phone_number')
109
- self.from_phone_number = attributes[:'from_phone_number']
110
- end
111
-
112
108
  if attributes.key?(:'to_phone_number')
113
109
  self.to_phone_number = attributes[:'to_phone_number']
114
110
  end
@@ -116,6 +112,10 @@ module MailSlurpClient
116
112
  if attributes.key?(:'message_direction')
117
113
  self.message_direction = attributes[:'message_direction']
118
114
  end
115
+
116
+ if attributes.key?(:'from_phone_number')
117
+ self.from_phone_number = attributes[:'from_phone_number']
118
+ end
119
119
  end
120
120
 
121
121
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -134,10 +134,6 @@ module MailSlurpClient
134
134
  invalid_properties.push('invalid value for "created", created cannot be nil.')
135
135
  end
136
136
 
137
- if @from_phone_number.nil?
138
- invalid_properties.push('invalid value for "from_phone_number", from_phone_number cannot be nil.')
139
- end
140
-
141
137
  if @to_phone_number.nil?
142
138
  invalid_properties.push('invalid value for "to_phone_number", to_phone_number cannot be nil.')
143
139
  end
@@ -146,6 +142,10 @@ module MailSlurpClient
146
142
  invalid_properties.push('invalid value for "message_direction", message_direction cannot be nil.')
147
143
  end
148
144
 
145
+ if @from_phone_number.nil?
146
+ invalid_properties.push('invalid value for "from_phone_number", from_phone_number cannot be nil.')
147
+ end
148
+
149
149
  invalid_properties
150
150
  end
151
151
 
@@ -155,11 +155,11 @@ module MailSlurpClient
155
155
  return false if @body.nil?
156
156
  return false if @phone_number_id.nil?
157
157
  return false if @created.nil?
158
- return false if @from_phone_number.nil?
159
158
  return false if @to_phone_number.nil?
160
159
  return false if @message_direction.nil?
161
160
  message_direction_validator = EnumAttributeValidator.new('String', ["OUTBOUND", "INBOUND"])
162
161
  return false unless message_direction_validator.valid?(@message_direction)
162
+ return false if @from_phone_number.nil?
163
163
  true
164
164
  end
165
165
 
@@ -181,9 +181,9 @@ module MailSlurpClient
181
181
  body == o.body &&
182
182
  phone_number_id == o.phone_number_id &&
183
183
  created == o.created &&
184
- from_phone_number == o.from_phone_number &&
185
184
  to_phone_number == o.to_phone_number &&
186
- message_direction == o.message_direction
185
+ message_direction == o.message_direction &&
186
+ from_phone_number == o.from_phone_number
187
187
  end
188
188
 
189
189
  # @see the `==` method
@@ -195,7 +195,7 @@ module MailSlurpClient
195
195
  # Calculates hash code according to all attributes.
196
196
  # @return [Integer] Hash code
197
197
  def hash
198
- [body, phone_number_id, created, from_phone_number, to_phone_number, message_direction].hash
198
+ [body, phone_number_id, created, to_phone_number, message_direction, from_phone_number].hash
199
199
  end
200
200
 
201
201
  # Builds the object from hash
@@ -16,14 +16,14 @@ module MailSlurpClient
16
16
  class SentEmailProjection
17
17
  attr_accessor :id
18
18
 
19
- attr_accessor :from
20
-
21
- attr_accessor :sender
22
-
23
19
  attr_accessor :recipients
24
20
 
25
21
  attr_accessor :subject
26
22
 
23
+ attr_accessor :from
24
+
25
+ attr_accessor :sender
26
+
27
27
  attr_accessor :user_id
28
28
 
29
29
  attr_accessor :attachments
@@ -56,10 +56,10 @@ module MailSlurpClient
56
56
  def self.attribute_map
57
57
  {
58
58
  :'id' => :'id',
59
- :'from' => :'from',
60
- :'sender' => :'sender',
61
59
  :'recipients' => :'recipients',
62
60
  :'subject' => :'subject',
61
+ :'from' => :'from',
62
+ :'sender' => :'sender',
63
63
  :'user_id' => :'userId',
64
64
  :'attachments' => :'attachments',
65
65
  :'inbox_id' => :'inboxId',
@@ -81,10 +81,10 @@ module MailSlurpClient
81
81
  def self.openapi_types
82
82
  {
83
83
  :'id' => :'String',
84
- :'from' => :'String',
85
- :'sender' => :'Sender',
86
84
  :'recipients' => :'EmailRecipients',
87
85
  :'subject' => :'String',
86
+ :'from' => :'String',
87
+ :'sender' => :'Sender',
88
88
  :'user_id' => :'String',
89
89
  :'attachments' => :'Array<String>',
90
90
  :'inbox_id' => :'String',
@@ -105,10 +105,10 @@ module MailSlurpClient
105
105
  # List of attributes with nullable: true
106
106
  def self.openapi_nullable
107
107
  Set.new([
108
- :'from',
109
- :'sender',
110
108
  :'recipients',
111
109
  :'subject',
110
+ :'from',
111
+ :'sender',
112
112
  :'attachments',
113
113
  :'message_id',
114
114
  :'in_reply_to',
@@ -138,14 +138,6 @@ module MailSlurpClient
138
138
  self.id = attributes[:'id']
139
139
  end
140
140
 
141
- if attributes.key?(:'from')
142
- self.from = attributes[:'from']
143
- end
144
-
145
- if attributes.key?(:'sender')
146
- self.sender = attributes[:'sender']
147
- end
148
-
149
141
  if attributes.key?(:'recipients')
150
142
  self.recipients = attributes[:'recipients']
151
143
  end
@@ -154,6 +146,14 @@ module MailSlurpClient
154
146
  self.subject = attributes[:'subject']
155
147
  end
156
148
 
149
+ if attributes.key?(:'from')
150
+ self.from = attributes[:'from']
151
+ end
152
+
153
+ if attributes.key?(:'sender')
154
+ self.sender = attributes[:'sender']
155
+ end
156
+
157
157
  if attributes.key?(:'user_id')
158
158
  self.user_id = attributes[:'user_id']
159
159
  end
@@ -278,10 +278,10 @@ module MailSlurpClient
278
278
  return true if self.equal?(o)
279
279
  self.class == o.class &&
280
280
  id == o.id &&
281
- from == o.from &&
282
- sender == o.sender &&
283
281
  recipients == o.recipients &&
284
282
  subject == o.subject &&
283
+ from == o.from &&
284
+ sender == o.sender &&
285
285
  user_id == o.user_id &&
286
286
  attachments == o.attachments &&
287
287
  inbox_id == o.inbox_id &&
@@ -307,7 +307,7 @@ module MailSlurpClient
307
307
  # Calculates hash code according to all attributes.
308
308
  # @return [Integer] Hash code
309
309
  def hash
310
- [id, from, sender, recipients, subject, user_id, attachments, inbox_id, created_at, to, cc, bcc, message_id, in_reply_to, body_excerpt, text_excerpt, body_md5_hash, virtual_send, thread_id].hash
310
+ [id, recipients, subject, from, sender, user_id, attachments, inbox_id, created_at, to, cc, bcc, message_id, in_reply_to, body_excerpt, text_excerpt, body_md5_hash, virtual_send, thread_id].hash
311
311
  end
312
312
 
313
313
  # Builds the object from hash
@@ -0,0 +1,211 @@
1
+ =begin
2
+ #MailSlurp API
3
+
4
+ #MailSlurp is an API for sending and receiving emails and SMS from dynamically allocated email addresses and phone numbers. 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
+ class StructuredContentResult
17
+ attr_accessor :result
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'result' => :'result'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'result' => :'Object'
30
+ }
31
+ end
32
+
33
+ # List of attributes with nullable: true
34
+ def self.openapi_nullable
35
+ Set.new([
36
+ ])
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ if (!attributes.is_a?(Hash))
43
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::StructuredContentResult` initialize method"
44
+ end
45
+
46
+ # check to see if the attribute exists and convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}) { |(k, v), h|
48
+ if (!self.class.attribute_map.key?(k.to_sym))
49
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::StructuredContentResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
+ end
51
+ h[k.to_sym] = v
52
+ }
53
+
54
+ if attributes.key?(:'result')
55
+ self.result = attributes[:'result']
56
+ end
57
+ end
58
+
59
+ # Show invalid properties with the reasons. Usually used together with valid?
60
+ # @return Array for valid properties with the reasons
61
+ def list_invalid_properties
62
+ invalid_properties = Array.new
63
+ if @result.nil?
64
+ invalid_properties.push('invalid value for "result", result cannot be nil.')
65
+ end
66
+
67
+ invalid_properties
68
+ end
69
+
70
+ # Check to see if the all the properties in the model are valid
71
+ # @return true if the model is valid
72
+ def valid?
73
+ return false if @result.nil?
74
+ true
75
+ end
76
+
77
+ # Checks equality by comparing each attribute.
78
+ # @param [Object] Object to be compared
79
+ def ==(o)
80
+ return true if self.equal?(o)
81
+ self.class == o.class &&
82
+ result == o.result
83
+ end
84
+
85
+ # @see the `==` method
86
+ # @param [Object] Object to be compared
87
+ def eql?(o)
88
+ self == o
89
+ end
90
+
91
+ # Calculates hash code according to all attributes.
92
+ # @return [Integer] Hash code
93
+ def hash
94
+ [result].hash
95
+ end
96
+
97
+ # Builds the object from hash
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ # @return [Object] Returns the model itself
100
+ def self.build_from_hash(attributes)
101
+ new.build_from_hash(attributes)
102
+ end
103
+
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def build_from_hash(attributes)
108
+ return nil unless attributes.is_a?(Hash)
109
+ self.class.openapi_types.each_pair do |key, type|
110
+ if type =~ /\AArray<(.*)>/i
111
+ # check to ensure the input is an array given that the attribute
112
+ # is documented as an array but the input is not
113
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
114
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
115
+ end
116
+ elsif !attributes[self.class.attribute_map[key]].nil?
117
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
118
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
119
+ end
120
+
121
+ self
122
+ end
123
+
124
+ # Deserializes the data based on type
125
+ # @param string type Data type
126
+ # @param string value Value to be deserialized
127
+ # @return [Object] Deserialized data
128
+ def _deserialize(type, value)
129
+ case type.to_sym
130
+ when :DateTime
131
+ DateTime.parse(value)
132
+ when :Date
133
+ Date.parse(value)
134
+ when :String
135
+ value.to_s
136
+ when :Integer
137
+ value.to_i
138
+ when :Float
139
+ value.to_f
140
+ when :Boolean
141
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
142
+ true
143
+ else
144
+ false
145
+ end
146
+ when :Object
147
+ # generic object (usually a Hash), return directly
148
+ value
149
+ when /\AArray<(?<inner_type>.+)>\z/
150
+ inner_type = Regexp.last_match[:inner_type]
151
+ value.map { |v| _deserialize(inner_type, v) }
152
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
153
+ k_type = Regexp.last_match[:k_type]
154
+ v_type = Regexp.last_match[:v_type]
155
+ {}.tap do |hash|
156
+ value.each do |k, v|
157
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
158
+ end
159
+ end
160
+ else # model
161
+ MailSlurpClient.const_get(type).build_from_hash(value)
162
+ end
163
+ end
164
+
165
+ # Returns the string representation of the object
166
+ # @return [String] String presentation of the object
167
+ def to_s
168
+ to_hash.to_s
169
+ end
170
+
171
+ # to_body is an alias to to_hash (backward compatibility)
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_body
174
+ to_hash
175
+ end
176
+
177
+ # Returns the object in the form of hash
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_hash
180
+ hash = {}
181
+ self.class.attribute_map.each_pair do |attr, param|
182
+ value = self.send(attr)
183
+ if value.nil?
184
+ is_nullable = self.class.openapi_nullable.include?(attr)
185
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
186
+ end
187
+
188
+ hash[param] = _to_hash(value)
189
+ end
190
+ hash
191
+ end
192
+
193
+ # Outputs non-array value in the form of hash
194
+ # For object, use to_hash. Otherwise, just return the value
195
+ # @param [Object] value Any valid value
196
+ # @return [Hash] Returns the value in the form of hash
197
+ def _to_hash(value)
198
+ if value.is_a?(Array)
199
+ value.compact.map { |v| _to_hash(v) }
200
+ elsif value.is_a?(Hash)
201
+ {}.tap do |hash|
202
+ value.each { |k, v| hash[k] = _to_hash(v) }
203
+ end
204
+ elsif value.respond_to? :to_hash
205
+ value.to_hash
206
+ else
207
+ value
208
+ end
209
+ end
210
+ end
211
+ end