sendmux-sending 1.0.0 → 1.2.0

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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/LICENSE +21 -0
  4. data/README.md +95 -0
  5. data/lib/sendmux/sending/client.rb +9 -1
  6. data/lib/sendmux/sending/version.rb +1 -1
  7. data/lib/sendmux_sending_generated/api/attachments_api.rb +370 -0
  8. data/lib/sendmux_sending_generated/api/emails_api.rb +2 -20
  9. data/lib/sendmux_sending_generated/api/meta_api.rb +82 -0
  10. data/lib/sendmux_sending_generated/api_client.rb +9 -3
  11. data/lib/sendmux_sending_generated/api_error.rb +2 -2
  12. data/lib/sendmux_sending_generated/api_model_base.rb +2 -2
  13. data/lib/sendmux_sending_generated/configuration.rb +2 -2
  14. data/lib/sendmux_sending_generated/models/address.rb +2 -2
  15. data/lib/sendmux_sending_generated/models/attachment.rb +78 -249
  16. data/lib/sendmux_sending_generated/models/attachment_upload_data.rb +284 -0
  17. data/lib/sendmux_sending_generated/models/attachment_upload_intent_data.rb +337 -0
  18. data/lib/sendmux_sending_generated/models/attachment_upload_intent_request.rb +279 -0
  19. data/lib/sendmux_sending_generated/models/attachment_upload_intent_response.rb +223 -0
  20. data/lib/sendmux_sending_generated/models/attachment_upload_response.rb +223 -0
  21. data/lib/sendmux_sending_generated/models/batch_result_item.rb +2 -2
  22. data/lib/sendmux_sending_generated/models/batch_send_request.rb +2 -2
  23. data/lib/sendmux_sending_generated/models/batch_send_success_data.rb +2 -2
  24. data/lib/sendmux_sending_generated/models/batch_send_success_response.rb +2 -2
  25. data/lib/sendmux_sending_generated/models/batch_summary.rb +2 -2
  26. data/lib/sendmux_sending_generated/models/email_send_request.rb +3 -3
  27. data/lib/sendmux_sending_generated/models/error_detail.rb +2 -2
  28. data/lib/sendmux_sending_generated/models/error_issue.rb +2 -2
  29. data/lib/sendmux_sending_generated/models/error_response.rb +2 -2
  30. data/lib/sendmux_sending_generated/models/inline_attachment.rb +274 -0
  31. data/lib/sendmux_sending_generated/models/meta.rb +2 -2
  32. data/lib/sendmux_sending_generated/models/recipient.rb +2 -2
  33. data/lib/sendmux_sending_generated/models/send_success_data.rb +2 -2
  34. data/lib/sendmux_sending_generated/models/send_success_response.rb +2 -2
  35. data/lib/sendmux_sending_generated/models/success_envelope.rb +2 -2
  36. data/lib/sendmux_sending_generated/models/uploaded_attachment_ref.rb +176 -0
  37. data/lib/sendmux_sending_generated/version.rb +2 -2
  38. data/lib/sendmux_sending_generated.rb +11 -2
  39. metadata +22 -6
@@ -0,0 +1,279 @@
1
+ =begin
2
+ #Sendmux Sending API
3
+
4
+ #Send emails programmatically via the Sendmux email infrastructure. Every response carries an `X-Request-Id` header; errors include a `retryable` flag. 429 and 503 responses include `Retry-After`. Mutating endpoints accept an `Idempotency-Key` header for safe retries.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Sendmux::Sending::Generated
17
+ class AttachmentUploadIntentRequest < ApiModelBase
18
+ # MIME type expected for the upload.
19
+ attr_accessor :content_type
20
+
21
+ # Filename to associate with the uploaded attachment.
22
+ attr_accessor :filename
23
+
24
+ # Optional SHA-256 hex digest for the upload bytes.
25
+ attr_accessor :sha256
26
+
27
+ # Exact byte size that will be uploaded.
28
+ attr_accessor :size_bytes
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'content_type' => :'content_type',
34
+ :'filename' => :'filename',
35
+ :'sha256' => :'sha256',
36
+ :'size_bytes' => :'size_bytes'
37
+ }
38
+ end
39
+
40
+ # Returns attribute mapping this model knows about
41
+ def self.acceptable_attribute_map
42
+ attribute_map
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ acceptable_attribute_map.values
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'content_type' => :'String',
54
+ :'filename' => :'String',
55
+ :'sha256' => :'String',
56
+ :'size_bytes' => :'Integer'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Sendmux::Sending::Generated::AttachmentUploadIntentRequest` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ acceptable_attribute_map = self.class.acceptable_attribute_map
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!acceptable_attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Sendmux::Sending::Generated::AttachmentUploadIntentRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'content_type')
83
+ self.content_type = attributes[:'content_type']
84
+ end
85
+
86
+ if attributes.key?(:'filename')
87
+ self.filename = attributes[:'filename']
88
+ else
89
+ self.filename = nil
90
+ end
91
+
92
+ if attributes.key?(:'sha256')
93
+ self.sha256 = attributes[:'sha256']
94
+ end
95
+
96
+ if attributes.key?(:'size_bytes')
97
+ self.size_bytes = attributes[:'size_bytes']
98
+ else
99
+ self.size_bytes = nil
100
+ end
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
107
+ invalid_properties = Array.new
108
+ if !@content_type.nil? && @content_type.to_s.length > 255
109
+ invalid_properties.push('invalid value for "content_type", the character length must be smaller than or equal to 255.')
110
+ end
111
+
112
+ if @filename.nil?
113
+ invalid_properties.push('invalid value for "filename", filename cannot be nil.')
114
+ end
115
+
116
+ if @filename.to_s.length > 255
117
+ invalid_properties.push('invalid value for "filename", the character length must be smaller than or equal to 255.')
118
+ end
119
+
120
+ if @filename.to_s.length < 1
121
+ invalid_properties.push('invalid value for "filename", the character length must be greater than or equal to 1.')
122
+ end
123
+
124
+ pattern = Regexp.new(/^[a-f0-9]{64}$/)
125
+ if !@sha256.nil? && @sha256 !~ pattern
126
+ invalid_properties.push("invalid value for \"sha256\", must conform to the pattern #{pattern}.")
127
+ end
128
+
129
+ if @size_bytes.nil?
130
+ invalid_properties.push('invalid value for "size_bytes", size_bytes cannot be nil.')
131
+ end
132
+
133
+ if @size_bytes <= 0
134
+ invalid_properties.push('invalid value for "size_bytes", must be greater than 0.')
135
+ end
136
+
137
+ invalid_properties
138
+ end
139
+
140
+ # Check to see if the all the properties in the model are valid
141
+ # @return true if the model is valid
142
+ def valid?
143
+ warn '[DEPRECATED] the `valid?` method is obsolete'
144
+ return false if !@content_type.nil? && @content_type.to_s.length > 255
145
+ return false if @filename.nil?
146
+ return false if @filename.to_s.length > 255
147
+ return false if @filename.to_s.length < 1
148
+ return false if !@sha256.nil? && @sha256 !~ Regexp.new(/^[a-f0-9]{64}$/)
149
+ return false if @size_bytes.nil?
150
+ return false if @size_bytes <= 0
151
+ true
152
+ end
153
+
154
+ # Custom attribute writer method with validation
155
+ # @param [Object] content_type Value to be assigned
156
+ def content_type=(content_type)
157
+ if content_type.nil?
158
+ fail ArgumentError, 'content_type cannot be nil'
159
+ end
160
+
161
+ if content_type.to_s.length > 255
162
+ fail ArgumentError, 'invalid value for "content_type", the character length must be smaller than or equal to 255.'
163
+ end
164
+
165
+ @content_type = content_type
166
+ end
167
+
168
+ # Custom attribute writer method with validation
169
+ # @param [Object] filename Value to be assigned
170
+ def filename=(filename)
171
+ if filename.nil?
172
+ fail ArgumentError, 'filename cannot be nil'
173
+ end
174
+
175
+ if filename.to_s.length > 255
176
+ fail ArgumentError, 'invalid value for "filename", the character length must be smaller than or equal to 255.'
177
+ end
178
+
179
+ if filename.to_s.length < 1
180
+ fail ArgumentError, 'invalid value for "filename", the character length must be greater than or equal to 1.'
181
+ end
182
+
183
+ @filename = filename
184
+ end
185
+
186
+ # Custom attribute writer method with validation
187
+ # @param [Object] sha256 Value to be assigned
188
+ def sha256=(sha256)
189
+ if sha256.nil?
190
+ fail ArgumentError, 'sha256 cannot be nil'
191
+ end
192
+
193
+ pattern = Regexp.new(/^[a-f0-9]{64}$/)
194
+ if sha256 !~ pattern
195
+ fail ArgumentError, "invalid value for \"sha256\", must conform to the pattern #{pattern}."
196
+ end
197
+
198
+ @sha256 = sha256
199
+ end
200
+
201
+ # Custom attribute writer method with validation
202
+ # @param [Object] size_bytes Value to be assigned
203
+ def size_bytes=(size_bytes)
204
+ if size_bytes.nil?
205
+ fail ArgumentError, 'size_bytes cannot be nil'
206
+ end
207
+
208
+ if size_bytes <= 0
209
+ fail ArgumentError, 'invalid value for "size_bytes", must be greater than 0.'
210
+ end
211
+
212
+ @size_bytes = size_bytes
213
+ end
214
+
215
+ # Checks equality by comparing each attribute.
216
+ # @param [Object] Object to be compared
217
+ def ==(o)
218
+ return true if self.equal?(o)
219
+ self.class == o.class &&
220
+ content_type == o.content_type &&
221
+ filename == o.filename &&
222
+ sha256 == o.sha256 &&
223
+ size_bytes == o.size_bytes
224
+ end
225
+
226
+ # @see the `==` method
227
+ # @param [Object] Object to be compared
228
+ def eql?(o)
229
+ self == o
230
+ end
231
+
232
+ # Calculates hash code according to all attributes.
233
+ # @return [Integer] Hash code
234
+ def hash
235
+ [content_type, filename, sha256, size_bytes].hash
236
+ end
237
+
238
+ # Builds the object from hash
239
+ # @param [Hash] attributes Model attributes in the form of hash
240
+ # @return [Object] Returns the model itself
241
+ def self.build_from_hash(attributes)
242
+ return nil unless attributes.is_a?(Hash)
243
+ attributes = attributes.transform_keys(&:to_sym)
244
+ transformed_hash = {}
245
+ openapi_types.each_pair do |key, type|
246
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
247
+ transformed_hash["#{key}"] = nil
248
+ elsif type =~ /\AArray<(.*)>/i
249
+ # check to ensure the input is an array given that the attribute
250
+ # is documented as an array but the input is not
251
+ if attributes[attribute_map[key]].is_a?(Array)
252
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
253
+ end
254
+ elsif !attributes[attribute_map[key]].nil?
255
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
256
+ end
257
+ end
258
+ new(transformed_hash)
259
+ end
260
+
261
+ # Returns the object in the form of hash
262
+ # @return [Hash] Returns the object in the form of hash
263
+ def to_hash
264
+ hash = {}
265
+ self.class.attribute_map.each_pair do |attr, param|
266
+ value = self.send(attr)
267
+ if value.nil?
268
+ is_nullable = self.class.openapi_nullable.include?(attr)
269
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
270
+ end
271
+
272
+ hash[param] = _to_hash(value)
273
+ end
274
+ hash
275
+ end
276
+
277
+ end
278
+
279
+ end
@@ -0,0 +1,223 @@
1
+ =begin
2
+ #Sendmux Sending API
3
+
4
+ #Send emails programmatically via the Sendmux email infrastructure. Every response carries an `X-Request-Id` header; errors include a `retryable` flag. 429 and 503 responses include `Retry-After`. Mutating endpoints accept an `Idempotency-Key` header for safe retries.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Sendmux::Sending::Generated
17
+ class AttachmentUploadIntentResponse < ApiModelBase
18
+ attr_accessor :meta
19
+
20
+ attr_accessor :ok
21
+
22
+ attr_accessor :data
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'meta' => :'meta',
28
+ :'ok' => :'ok',
29
+ :'data' => :'data'
30
+ }
31
+ end
32
+
33
+ # Returns attribute mapping this model knows about
34
+ def self.acceptable_attribute_map
35
+ attribute_map
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ acceptable_attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'meta' => :'Meta',
47
+ :'ok' => :'Boolean',
48
+ :'data' => :'AttachmentUploadIntentData'
49
+ }
50
+ end
51
+
52
+ # List of attributes with nullable: true
53
+ def self.openapi_nullable
54
+ Set.new([
55
+ ])
56
+ end
57
+
58
+ # List of class defined in allOf (OpenAPI v3)
59
+ def self.openapi_all_of
60
+ [
61
+ :'SuccessEnvelope'
62
+ ]
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ if (!attributes.is_a?(Hash))
69
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Sendmux::Sending::Generated::AttachmentUploadIntentResponse` initialize method"
70
+ end
71
+
72
+ # check to see if the attribute exists and convert string to symbol for hash key
73
+ acceptable_attribute_map = self.class.acceptable_attribute_map
74
+ attributes = attributes.each_with_object({}) { |(k, v), h|
75
+ if (!acceptable_attribute_map.key?(k.to_sym))
76
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Sendmux::Sending::Generated::AttachmentUploadIntentResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
77
+ end
78
+ h[k.to_sym] = v
79
+ }
80
+
81
+ if attributes.key?(:'meta')
82
+ self.meta = attributes[:'meta']
83
+ else
84
+ self.meta = nil
85
+ end
86
+
87
+ if attributes.key?(:'ok')
88
+ self.ok = attributes[:'ok']
89
+ else
90
+ self.ok = nil
91
+ end
92
+
93
+ if attributes.key?(:'data')
94
+ self.data = attributes[:'data']
95
+ else
96
+ self.data = nil
97
+ end
98
+ end
99
+
100
+ # Show invalid properties with the reasons. Usually used together with valid?
101
+ # @return Array for valid properties with the reasons
102
+ def list_invalid_properties
103
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
104
+ invalid_properties = Array.new
105
+ if @meta.nil?
106
+ invalid_properties.push('invalid value for "meta", meta cannot be nil.')
107
+ end
108
+
109
+ if @ok.nil?
110
+ invalid_properties.push('invalid value for "ok", ok cannot be nil.')
111
+ end
112
+
113
+ if @data.nil?
114
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
115
+ end
116
+
117
+ invalid_properties
118
+ end
119
+
120
+ # Check to see if the all the properties in the model are valid
121
+ # @return true if the model is valid
122
+ def valid?
123
+ warn '[DEPRECATED] the `valid?` method is obsolete'
124
+ return false if @meta.nil?
125
+ return false if @ok.nil?
126
+ return false if @data.nil?
127
+ true
128
+ end
129
+
130
+ # Custom attribute writer method with validation
131
+ # @param [Object] meta Value to be assigned
132
+ def meta=(meta)
133
+ if meta.nil?
134
+ fail ArgumentError, 'meta cannot be nil'
135
+ end
136
+
137
+ @meta = meta
138
+ end
139
+
140
+ # Custom attribute writer method with validation
141
+ # @param [Object] ok Value to be assigned
142
+ def ok=(ok)
143
+ if ok.nil?
144
+ fail ArgumentError, 'ok cannot be nil'
145
+ end
146
+
147
+ @ok = ok
148
+ end
149
+
150
+ # Custom attribute writer method with validation
151
+ # @param [Object] data Value to be assigned
152
+ def data=(data)
153
+ if data.nil?
154
+ fail ArgumentError, 'data cannot be nil'
155
+ end
156
+
157
+ @data = data
158
+ end
159
+
160
+ # Checks equality by comparing each attribute.
161
+ # @param [Object] Object to be compared
162
+ def ==(o)
163
+ return true if self.equal?(o)
164
+ self.class == o.class &&
165
+ meta == o.meta &&
166
+ ok == o.ok &&
167
+ data == o.data
168
+ end
169
+
170
+ # @see the `==` method
171
+ # @param [Object] Object to be compared
172
+ def eql?(o)
173
+ self == o
174
+ end
175
+
176
+ # Calculates hash code according to all attributes.
177
+ # @return [Integer] Hash code
178
+ def hash
179
+ [meta, ok, data].hash
180
+ end
181
+
182
+ # Builds the object from hash
183
+ # @param [Hash] attributes Model attributes in the form of hash
184
+ # @return [Object] Returns the model itself
185
+ def self.build_from_hash(attributes)
186
+ return nil unless attributes.is_a?(Hash)
187
+ attributes = attributes.transform_keys(&:to_sym)
188
+ transformed_hash = {}
189
+ openapi_types.each_pair do |key, type|
190
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
191
+ transformed_hash["#{key}"] = nil
192
+ elsif type =~ /\AArray<(.*)>/i
193
+ # check to ensure the input is an array given that the attribute
194
+ # is documented as an array but the input is not
195
+ if attributes[attribute_map[key]].is_a?(Array)
196
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
197
+ end
198
+ elsif !attributes[attribute_map[key]].nil?
199
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
200
+ end
201
+ end
202
+ new(transformed_hash)
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ if value.nil?
212
+ is_nullable = self.class.openapi_nullable.include?(attr)
213
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
214
+ end
215
+
216
+ hash[param] = _to_hash(value)
217
+ end
218
+ hash
219
+ end
220
+
221
+ end
222
+
223
+ end