sendmux-sending 1.3.0 → 1.5.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/README.md +15 -1
- data/lib/sendmux/sending/client.rb +9 -2
- data/lib/sendmux/sending/version.rb +1 -1
- data/lib/sendmux_sending_generated/api/attachments_api.rb +3 -3
- data/lib/sendmux_sending_generated/api/emails_api.rb +2 -2
- data/lib/sendmux_sending_generated/api/meta_api.rb +1 -1
- data/lib/sendmux_sending_generated/configuration.rb +7 -0
- data/lib/sendmux_sending_generated/models/email_send_request.rb +10 -1
- data/lib/sendmux_sending_generated/models/email_send_request_delivery_group.rb +105 -0
- data/lib/sendmux_sending_generated.rb +1 -0
- metadata +5 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 821d58d8a919591323d101d48bb9c4f53d14cb5085ac2d71f6ed5142a0273958
|
|
4
|
+
data.tar.gz: 742e3fe7e4a957c8eeca20f60e3905b58a242ccf862dd1e59046bfe753e7f1f9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 48d0e04ccf42e9c2a5886621d42263688354f716886cf3df5b0d06f803e9321e472eb5035ba3ed7da07ebe1269e4db6a288d3925d2adcebe5e2f8c937421b8fd
|
|
7
|
+
data.tar.gz: b80609c92fb6144f7adcf1faf06de6adba24c7789ac7533df72fa20972c3c4a2c6a574d8c796582d013b5a493fffeaf012022008b52d6decc4b137bf3fe742f0
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* Add one delivery group or a list of `delivery_group` IDs to email send requests.
|
|
8
|
+
|
|
9
|
+
## [1.5.0](https://github.com/Sendmux/sendmux-sdk/compare/ruby-sending/v1.4.0...ruby-sending/v1.5.0) (2026-09-19)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* integrate combined provider variables and delivery routing ([81bbf22](https://github.com/Sendmux/sendmux-sdk/commit/81bbf221a357bf5d588eba654184ff34491473df))
|
|
15
|
+
* **sdk:** add provider variables and delivery group routing ([94f52d4](https://github.com/Sendmux/sendmux-sdk/commit/94f52d4e9f6157e197308541cc5987517bac7a4a))
|
|
16
|
+
|
|
17
|
+
## [1.4.0](https://github.com/Sendmux/sendmux-sdk/compare/ruby-sending/v1.3.0...ruby-sending/v1.4.0) (2026-09-10)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* add REST OAuth clients and CLI token lifecycle ([cc4a3aa](https://github.com/Sendmux/sendmux-sdk/commit/cc4a3aa6110378641418a94455ed5b9a986e65ff))
|
|
23
|
+
|
|
3
24
|
## [1.3.0](https://github.com/Sendmux/sendmux-sdk/compare/ruby-sending/v1.2.0...ruby-sending/v1.3.0) (2026-09-08)
|
|
4
25
|
|
|
5
26
|
|
data/README.md
CHANGED
|
@@ -18,6 +18,8 @@ Ruby SDK package for the Sendmux Sending API.
|
|
|
18
18
|
- Ruby 3.1 or newer.
|
|
19
19
|
- A send-capable `smx_mbx_` key or owner-approved Sending-resource `smx_agent_` token.
|
|
20
20
|
|
|
21
|
+
For OAuth, use a REST access token with the scopes and mailbox access required by the operation. See [OAuth for REST APIs](https://sendmux.ai/docs/developer-tools/oauth).
|
|
22
|
+
|
|
21
23
|
## Installation
|
|
22
24
|
|
|
23
25
|
```sh
|
|
@@ -30,9 +32,21 @@ Or add it to your Gemfile:
|
|
|
30
32
|
gem "sendmux-sending", "~> 1.0"
|
|
31
33
|
```
|
|
32
34
|
|
|
35
|
+
## OAuth access tokens
|
|
36
|
+
|
|
37
|
+
Pass either `api_key:` or `access_token:`. `access_token:` accepts a bare token string or a callable; the callable is evaluated once per authenticated request. Your application owns token storage, expiry checks and refresh coordination.
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
require "sendmux/sending"
|
|
41
|
+
|
|
42
|
+
client = Sendmux::Sending::Client.new(
|
|
43
|
+
access_token: -> { ENV.fetch("SENDMUX_ACCESS_TOKEN") }
|
|
44
|
+
)
|
|
45
|
+
```
|
|
46
|
+
|
|
33
47
|
## Usage
|
|
34
48
|
|
|
35
|
-
Create a sending client with a send-capable key
|
|
49
|
+
Create a sending client with a send-capable key for the API-key example below.
|
|
36
50
|
|
|
37
51
|
```ruby
|
|
38
52
|
require "sendmux/sending"
|
|
@@ -5,6 +5,12 @@ module Sendmux
|
|
|
5
5
|
DEFAULT_BASE_URL = 'https://smtp.sendmux.ai/api/v1'
|
|
6
6
|
|
|
7
7
|
class ApiClient < Generated::ApiClient
|
|
8
|
+
def update_params_for_auth!(header_params, query_params, auth_names)
|
|
9
|
+
return super unless config.access_token_getter && !Array(auth_names).empty?
|
|
10
|
+
|
|
11
|
+
header_params['Authorization'] = "Bearer #{config.access_token_with_refresh}"
|
|
12
|
+
end
|
|
13
|
+
|
|
8
14
|
def call_api(...)
|
|
9
15
|
super
|
|
10
16
|
rescue Generated::ApiError => e
|
|
@@ -15,12 +21,13 @@ module Sendmux
|
|
|
15
21
|
class Client
|
|
16
22
|
attr_reader :api_client, :configuration
|
|
17
23
|
|
|
18
|
-
def initialize(api_key
|
|
24
|
+
def initialize(api_key: nil, access_token: nil, base_url: DEFAULT_BASE_URL, retry_options: nil)
|
|
19
25
|
@configuration = Sendmux::Core::Auth.configure_bearer(
|
|
20
26
|
Generated::Configuration.new,
|
|
21
27
|
api_key,
|
|
22
28
|
Sendmux::Core::ApiKeySurface::SENDING,
|
|
23
|
-
base_url: base_url
|
|
29
|
+
base_url: base_url,
|
|
30
|
+
access_token: access_token
|
|
24
31
|
)
|
|
25
32
|
Sendmux::Core::Retry.configure(@configuration, retry_options)
|
|
26
33
|
@api_client = ApiClient.new(@configuration)
|
|
@@ -172,7 +172,7 @@ module Sendmux::Sending::Generated
|
|
|
172
172
|
return_type = opts[:debug_return_type] || 'AttachmentUploadIntentResponse'
|
|
173
173
|
|
|
174
174
|
# auth_names
|
|
175
|
-
auth_names = opts[:debug_auth_names] || ['BearerAuth']
|
|
175
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2', 'BearerAuth']
|
|
176
176
|
|
|
177
177
|
new_options = opts.merge(
|
|
178
178
|
:operation => :"AttachmentsApi.sending_create_attachment_upload",
|
|
@@ -240,7 +240,7 @@ module Sendmux::Sending::Generated
|
|
|
240
240
|
return_type = opts[:debug_return_type] || 'AttachmentUploadResponse'
|
|
241
241
|
|
|
242
242
|
# auth_names
|
|
243
|
-
auth_names = opts[:debug_auth_names] || ['BearerAuth']
|
|
243
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2', 'BearerAuth']
|
|
244
244
|
|
|
245
245
|
new_options = opts.merge(
|
|
246
246
|
:operation => :"AttachmentsApi.sending_get_attachment",
|
|
@@ -348,7 +348,7 @@ module Sendmux::Sending::Generated
|
|
|
348
348
|
return_type = opts[:debug_return_type] || 'AttachmentUploadResponse'
|
|
349
349
|
|
|
350
350
|
# auth_names
|
|
351
|
-
auth_names = opts[:debug_auth_names] || ['BearerAuth']
|
|
351
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2', 'BearerAuth']
|
|
352
352
|
|
|
353
353
|
new_options = opts.merge(
|
|
354
354
|
:operation => :"AttachmentsApi.sending_upload_attachment",
|
|
@@ -75,7 +75,7 @@ module Sendmux::Sending::Generated
|
|
|
75
75
|
return_type = opts[:debug_return_type] || 'SendSuccessResponse'
|
|
76
76
|
|
|
77
77
|
# auth_names
|
|
78
|
-
auth_names = opts[:debug_auth_names] || ['BearerAuth']
|
|
78
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2', 'BearerAuth']
|
|
79
79
|
|
|
80
80
|
new_options = opts.merge(
|
|
81
81
|
:operation => :"EmailsApi.sending_send_email",
|
|
@@ -150,7 +150,7 @@ module Sendmux::Sending::Generated
|
|
|
150
150
|
return_type = opts[:debug_return_type] || 'BatchSendSuccessResponse'
|
|
151
151
|
|
|
152
152
|
# auth_names
|
|
153
|
-
auth_names = opts[:debug_auth_names] || ['BearerAuth']
|
|
153
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2', 'BearerAuth']
|
|
154
154
|
|
|
155
155
|
new_options = opts.merge(
|
|
156
156
|
:operation => :"EmailsApi.sending_send_email_batch",
|
|
@@ -60,7 +60,7 @@ module Sendmux::Sending::Generated
|
|
|
60
60
|
return_type = opts[:debug_return_type] || 'ConnectionResponse'
|
|
61
61
|
|
|
62
62
|
# auth_names
|
|
63
|
-
auth_names = opts[:debug_auth_names] || ['BearerAuth']
|
|
63
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2', 'BearerAuth']
|
|
64
64
|
|
|
65
65
|
new_options = opts.merge(
|
|
66
66
|
:operation => :"MetaApi.sending_get_connection",
|
|
@@ -255,6 +255,13 @@ module Sendmux::Sending::Generated
|
|
|
255
255
|
key: 'Authorization',
|
|
256
256
|
value: "Bearer #{access_token_with_refresh}"
|
|
257
257
|
},
|
|
258
|
+
'OAuth2' =>
|
|
259
|
+
{
|
|
260
|
+
type: 'oauth2',
|
|
261
|
+
in: 'header',
|
|
262
|
+
key: 'Authorization',
|
|
263
|
+
value: "Bearer #{access_token_with_refresh}"
|
|
264
|
+
},
|
|
258
265
|
}
|
|
259
266
|
end
|
|
260
267
|
|
|
@@ -27,6 +27,8 @@ module Sendmux::Sending::Generated
|
|
|
27
27
|
# Custom X-* headers to include in the email
|
|
28
28
|
attr_accessor :custom_headers
|
|
29
29
|
|
|
30
|
+
attr_accessor :delivery_group
|
|
31
|
+
|
|
30
32
|
attr_accessor :from
|
|
31
33
|
|
|
32
34
|
# HTML email content (max 25MB)
|
|
@@ -54,6 +56,7 @@ module Sendmux::Sending::Generated
|
|
|
54
56
|
:'bcc' => :'bcc',
|
|
55
57
|
:'cc' => :'cc',
|
|
56
58
|
:'custom_headers' => :'custom_headers',
|
|
59
|
+
:'delivery_group' => :'delivery_group',
|
|
57
60
|
:'from' => :'from',
|
|
58
61
|
:'html_body' => :'html_body',
|
|
59
62
|
:'reply_to' => :'reply_to',
|
|
@@ -81,6 +84,7 @@ module Sendmux::Sending::Generated
|
|
|
81
84
|
:'bcc' => :'Array<Recipient>',
|
|
82
85
|
:'cc' => :'Array<Recipient>',
|
|
83
86
|
:'custom_headers' => :'Hash<String, String>',
|
|
87
|
+
:'delivery_group' => :'EmailSendRequestDeliveryGroup',
|
|
84
88
|
:'from' => :'Address',
|
|
85
89
|
:'html_body' => :'String',
|
|
86
90
|
:'reply_to' => :'Address',
|
|
@@ -137,6 +141,10 @@ module Sendmux::Sending::Generated
|
|
|
137
141
|
end
|
|
138
142
|
end
|
|
139
143
|
|
|
144
|
+
if attributes.key?(:'delivery_group')
|
|
145
|
+
self.delivery_group = attributes[:'delivery_group']
|
|
146
|
+
end
|
|
147
|
+
|
|
140
148
|
if attributes.key?(:'from')
|
|
141
149
|
self.from = attributes[:'from']
|
|
142
150
|
else
|
|
@@ -400,6 +408,7 @@ module Sendmux::Sending::Generated
|
|
|
400
408
|
bcc == o.bcc &&
|
|
401
409
|
cc == o.cc &&
|
|
402
410
|
custom_headers == o.custom_headers &&
|
|
411
|
+
delivery_group == o.delivery_group &&
|
|
403
412
|
from == o.from &&
|
|
404
413
|
html_body == o.html_body &&
|
|
405
414
|
reply_to == o.reply_to &&
|
|
@@ -418,7 +427,7 @@ module Sendmux::Sending::Generated
|
|
|
418
427
|
# Calculates hash code according to all attributes.
|
|
419
428
|
# @return [Integer] Hash code
|
|
420
429
|
def hash
|
|
421
|
-
[attachments, bcc, cc, custom_headers, from, html_body, reply_to, return_path, subject, text_body, to].hash
|
|
430
|
+
[attachments, bcc, cc, custom_headers, delivery_group, from, html_body, reply_to, return_path, subject, text_body, to].hash
|
|
422
431
|
end
|
|
423
432
|
|
|
424
433
|
# Builds the object from hash
|
|
@@ -0,0 +1,105 @@
|
|
|
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
|
+
# One delivery group public ID or a non-empty array of up to 50 IDs
|
|
18
|
+
module EmailSendRequestDeliveryGroup
|
|
19
|
+
class << self
|
|
20
|
+
# List of class defined in oneOf (OpenAPI v3)
|
|
21
|
+
def openapi_one_of
|
|
22
|
+
[
|
|
23
|
+
:'Array<String>',
|
|
24
|
+
:'String'
|
|
25
|
+
]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Builds the object
|
|
29
|
+
# @param [Mixed] Data to be matched against the list of oneOf items
|
|
30
|
+
# @return [Object] Returns the model or the data itself
|
|
31
|
+
def build(data)
|
|
32
|
+
# Go through the list of oneOf items and attempt to identify the appropriate one.
|
|
33
|
+
# Note:
|
|
34
|
+
# - We do not attempt to check whether exactly one item matches.
|
|
35
|
+
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
|
36
|
+
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
|
37
|
+
# - TODO: scalar values are de facto behaving as if they were nullable.
|
|
38
|
+
# - TODO: logging when debugging is set.
|
|
39
|
+
openapi_one_of.each do |klass|
|
|
40
|
+
begin
|
|
41
|
+
next if klass == :AnyType # "nullable: true"
|
|
42
|
+
return find_and_cast_into_type(klass, data)
|
|
43
|
+
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
openapi_one_of.include?(:AnyType) ? data : nil
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
private
|
|
51
|
+
|
|
52
|
+
SchemaMismatchError = Class.new(StandardError)
|
|
53
|
+
|
|
54
|
+
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
|
55
|
+
def find_and_cast_into_type(klass, data)
|
|
56
|
+
return if data.nil?
|
|
57
|
+
|
|
58
|
+
case klass.to_s
|
|
59
|
+
when 'Boolean'
|
|
60
|
+
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
|
61
|
+
when 'Float'
|
|
62
|
+
return data if data.instance_of?(Float)
|
|
63
|
+
when 'Integer'
|
|
64
|
+
return data if data.instance_of?(Integer)
|
|
65
|
+
when 'Time'
|
|
66
|
+
return Time.parse(data)
|
|
67
|
+
when 'Date'
|
|
68
|
+
return Date.iso8601(data)
|
|
69
|
+
when 'String'
|
|
70
|
+
return data if data.instance_of?(String)
|
|
71
|
+
when 'Object' # "type: object"
|
|
72
|
+
return data if data.instance_of?(Hash)
|
|
73
|
+
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
|
74
|
+
if data.instance_of?(Array)
|
|
75
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
76
|
+
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
|
77
|
+
end
|
|
78
|
+
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
|
79
|
+
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
|
80
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
81
|
+
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
|
82
|
+
end
|
|
83
|
+
else # model
|
|
84
|
+
const = Sendmux::Sending::Generated.const_get(klass)
|
|
85
|
+
if const
|
|
86
|
+
if const.respond_to?(:openapi_one_of) # nested oneOf model
|
|
87
|
+
model = const.build(data)
|
|
88
|
+
return model if model
|
|
89
|
+
else
|
|
90
|
+
# raise if data contains keys that are not known to the model
|
|
91
|
+
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
|
|
92
|
+
model = const.build_from_hash(data)
|
|
93
|
+
return model if model
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
raise # if no match by now, raise
|
|
99
|
+
rescue
|
|
100
|
+
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
end
|
|
@@ -36,6 +36,7 @@ require 'sendmux_sending_generated/models/connection_mailboxes_inner'
|
|
|
36
36
|
require 'sendmux_sending_generated/models/connection_response'
|
|
37
37
|
require 'sendmux_sending_generated/models/connection_team'
|
|
38
38
|
require 'sendmux_sending_generated/models/email_send_request'
|
|
39
|
+
require 'sendmux_sending_generated/models/email_send_request_delivery_group'
|
|
39
40
|
require 'sendmux_sending_generated/models/error_detail'
|
|
40
41
|
require 'sendmux_sending_generated/models/error_issue'
|
|
41
42
|
require 'sendmux_sending_generated/models/error_response'
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sendmux-sending
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sendmux
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-09-
|
|
10
|
+
date: 2026-09-19 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: faraday
|
|
@@ -77,7 +77,7 @@ dependencies:
|
|
|
77
77
|
requirements:
|
|
78
78
|
- - ">="
|
|
79
79
|
- !ruby/object:Gem::Version
|
|
80
|
-
version: 1.
|
|
80
|
+
version: 1.3.0
|
|
81
81
|
- - "<"
|
|
82
82
|
- !ruby/object:Gem::Version
|
|
83
83
|
version: '2.0'
|
|
@@ -87,7 +87,7 @@ dependencies:
|
|
|
87
87
|
requirements:
|
|
88
88
|
- - ">="
|
|
89
89
|
- !ruby/object:Gem::Version
|
|
90
|
-
version: 1.
|
|
90
|
+
version: 1.3.0
|
|
91
91
|
- - "<"
|
|
92
92
|
- !ruby/object:Gem::Version
|
|
93
93
|
version: '2.0'
|
|
@@ -129,6 +129,7 @@ files:
|
|
|
129
129
|
- lib/sendmux_sending_generated/models/connection_response.rb
|
|
130
130
|
- lib/sendmux_sending_generated/models/connection_team.rb
|
|
131
131
|
- lib/sendmux_sending_generated/models/email_send_request.rb
|
|
132
|
+
- lib/sendmux_sending_generated/models/email_send_request_delivery_group.rb
|
|
132
133
|
- lib/sendmux_sending_generated/models/error_detail.rb
|
|
133
134
|
- lib/sendmux_sending_generated/models/error_issue.rb
|
|
134
135
|
- lib/sendmux_sending_generated/models/error_response.rb
|