sendmux-sending 1.3.0 → 1.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93f7898501dac6b038c2b64530535627dd8b3178f2434a5e48cf1b99c4473561
4
- data.tar.gz: 4eeb6992dd17fef37619abfec88e608d9d58ab1766d66c959ddd8fb4fddfef4b
3
+ metadata.gz: 195959762d9b4fe1a794ad4b40bde49927733d5bf6bbbe751ff7975a74a3be4b
4
+ data.tar.gz: 0b4e725dd8a434917954bd0d0bddc0232e58f7596c6e3fada3ff404f98a017d0
5
5
  SHA512:
6
- metadata.gz: 43ebf3cd892bbd8b1a0f888e91601f825c996792d4e0958574b70d0fcfc7f5879af8dcf6217f98b88c7758053c76d9e8e1ab31dcd47ab3229f5408d0df4012f6
7
- data.tar.gz: 77cd109cdaa57e393ab4f607fa402cb2dc52c2cf7b1b4c51ca54e079c7f1116070ab5f6396947f173669494c69dfb70cb6c65aa79c5236ea147b024234345e47
6
+ metadata.gz: d14fc7657e5a681d1624acf5fa069f04d795435c6f6422662d0e4e25f2a2598d7dfe049c35deda0262ab0fca4e1f15a6610fe06bc737d7090aa8d657c5bbd377
7
+ data.tar.gz: 0d415c60df2619d31805dbc5b9aebe0580feaa47b12d6ae9e3e81826e3f5044054fb46423489f2f18f39473207cbf2c89556eb3ec7a66651c4893b231f577c02
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.4.0](https://github.com/Sendmux/sendmux-sdk/compare/ruby-sending/v1.3.0...ruby-sending/v1.4.0) (2026-09-10)
4
+
5
+
6
+ ### Features
7
+
8
+ * add REST OAuth clients and CLI token lifecycle ([cc4a3aa](https://github.com/Sendmux/sendmux-sdk/commit/cc4a3aa6110378641418a94455ed5b9a986e65ff))
9
+
3
10
  ## [1.3.0](https://github.com/Sendmux/sendmux-sdk/compare/ruby-sending/v1.2.0...ruby-sending/v1.3.0) (2026-09-08)
4
11
 
5
12
 
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 before calling generated operations.
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:, base_url: DEFAULT_BASE_URL, retry_options: nil)
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)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sendmux
4
4
  module Sending
5
- VERSION = '1.3.0'
5
+ VERSION = '1.4.0'
6
6
  end
7
7
  end
@@ -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
 
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.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sendmux
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-09-08 00:00:00.000000000 Z
10
+ date: 2026-09-10 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.2.0
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.2.0
90
+ version: 1.3.0
91
91
  - - "<"
92
92
  - !ruby/object:Gem::Version
93
93
  version: '2.0'