mailtrap 2.14.0 → 2.15.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 +9 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/lib/mailtrap/account_accesses_api.rb +0 -2
- data/lib/mailtrap/accounts_api.rb +0 -2
- data/lib/mailtrap/email_campaigns_api.rb +0 -2
- data/lib/mailtrap/inbound_folders_api.rb +0 -1
- data/lib/mailtrap/inbound_inboxes_api.rb +0 -1
- data/lib/mailtrap/inbound_messages_api.rb +0 -1
- data/lib/mailtrap/inbound_threads_api.rb +0 -1
- data/lib/mailtrap/sandbox_attachments_api.rb +1 -1
- data/lib/mailtrap/sandbox_messages_api.rb +1 -1
- data/lib/mailtrap/sending_domain.rb +2 -0
- data/lib/mailtrap/sending_domains_api.rb +9 -1
- data/lib/mailtrap/suppressions_api.rb +20 -2
- data/lib/mailtrap/tracking_opt_out.rb +17 -0
- data/lib/mailtrap/tracking_opt_outs_api.rb +70 -0
- data/lib/mailtrap/tracking_opt_outs_list_response.rb +13 -0
- data/lib/mailtrap/version.rb +1 -1
- data/lib/mailtrap.rb +1 -0
- metadata +5 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ba78e8e22574eb5404c0e4d14f5a4ad764dabc559a3fd58bc0ae9ba46a49ea3f
|
|
4
|
+
data.tar.gz: da43055430599e2f496fc794fb145bacb7d589785b2387f6296ed978db57c4ac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7e5eb305e76d483f99711da0d2c913b1fdab00c8010bd55b697171284bd712d78545096dd5af9ffeab6886c06518b8c8f515edf42cf0b3e41dab4d98f7265a5b
|
|
7
|
+
data.tar.gz: e9c400428a9e86678a2b6fd6c6ef6ddbada0726ecfac29e9b254021b6a9f9143f912e81f6ba967084fa94c16c4ac19aaaa7e01699ad98a31ef4d3e934d37cd9d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [2.15.0] - 2026-08-28
|
|
2
|
+
|
|
3
|
+
## What's Changed
|
|
4
|
+
* Accept all sending domain update options by @mklocek in https://github.com/mailtrap/mailtrap-ruby/pull/126
|
|
5
|
+
* Add tracking opt-outs and create-suppression endpoints by @mklocek in https://github.com/mailtrap/mailtrap-ruby/pull/127
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
**Full Changelog**: https://github.com/mailtrap/mailtrap-ruby/compare/v2.14.0...v2.15.0
|
|
9
|
+
|
|
1
10
|
## [2.14.0] - 2026-08-14
|
|
2
11
|
|
|
3
12
|
## What's Changed
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -179,6 +179,8 @@ Email API:
|
|
|
179
179
|
- Sending Stats API – [`stats_api.rb`](examples/stats_api.rb)
|
|
180
180
|
- Email Logs API – [`email_logs_api.rb`](examples/email_logs_api.rb)
|
|
181
181
|
- Webhooks API – [`webhooks_api.rb`](examples/webhooks_api.rb)
|
|
182
|
+
- Suppressions API – [`suppressions_api.rb`](examples/suppressions_api.rb)
|
|
183
|
+
- Tracking Opt-outs API – [`tracking_opt_outs_api.rb`](examples/tracking_opt_outs_api.rb)
|
|
182
184
|
|
|
183
185
|
Email Sandbox (Testing):
|
|
184
186
|
|
|
@@ -10,7 +10,6 @@ module Mailtrap
|
|
|
10
10
|
self.supported_options = %i[name]
|
|
11
11
|
self.response_class = InboundFolder
|
|
12
12
|
|
|
13
|
-
# Inbound is scoped to the token's account, so no account_id is required.
|
|
14
13
|
# @param client [Mailtrap::Client] The client instance
|
|
15
14
|
def initialize(client = Mailtrap::Client.new)
|
|
16
15
|
@client = client
|
|
@@ -12,7 +12,6 @@ module Mailtrap
|
|
|
12
12
|
CREATE_OPTIONS = %i[name domain_id].freeze
|
|
13
13
|
UPDATE_OPTIONS = %i[name].freeze
|
|
14
14
|
|
|
15
|
-
# Inbound is scoped to the token's account, so no account_id is required.
|
|
16
15
|
# @param client [Mailtrap::Client] The client instance
|
|
17
16
|
def initialize(client = Mailtrap::Client.new)
|
|
18
17
|
@client = client
|
|
@@ -14,7 +14,6 @@ module Mailtrap
|
|
|
14
14
|
|
|
15
15
|
SEND_OPTIONS = %i[from to cc bcc reply_to text html category attachments headers custom_variables].freeze
|
|
16
16
|
|
|
17
|
-
# Inbound is scoped to the token's account, so no account_id is required.
|
|
18
17
|
# @param client [Mailtrap::Client] The client instance
|
|
19
18
|
def initialize(client = Mailtrap::Client.new)
|
|
20
19
|
@client = client
|
|
@@ -12,7 +12,6 @@ module Mailtrap
|
|
|
12
12
|
|
|
13
13
|
self.response_class = InboundThread
|
|
14
14
|
|
|
15
|
-
# Inbound is scoped to the token's account, so no account_id is required.
|
|
16
15
|
# @param client [Mailtrap::Client] The client instance
|
|
17
16
|
def initialize(client = Mailtrap::Client.new)
|
|
18
17
|
@client = client
|
|
@@ -12,6 +12,7 @@ module Mailtrap
|
|
|
12
12
|
# @attr_reader dns_records [Array] The DNS records for the sending domain
|
|
13
13
|
# @attr_reader open_tracking_enabled [Boolean] Whether open tracking is enabled
|
|
14
14
|
# @attr_reader click_tracking_enabled [Boolean] Whether click tracking is enabled
|
|
15
|
+
# @attr_reader tracking_opt_out_enabled [Boolean] Whether the tracking opt-out link is enabled
|
|
15
16
|
# @attr_reader auto_unsubscribe_link_enabled [Boolean] Whether auto unsubscribe link is enabled
|
|
16
17
|
# @attr_reader custom_domain_tracking_enabled [Boolean] Whether custom domain tracking is enabled
|
|
17
18
|
# @attr_reader health_alerts_enabled [Boolean] Whether health alerts are enabled
|
|
@@ -31,6 +32,7 @@ module Mailtrap
|
|
|
31
32
|
:dns_records,
|
|
32
33
|
:open_tracking_enabled,
|
|
33
34
|
:click_tracking_enabled,
|
|
35
|
+
:tracking_opt_out_enabled,
|
|
34
36
|
:auto_unsubscribe_link_enabled,
|
|
35
37
|
:custom_domain_tracking_enabled,
|
|
36
38
|
:health_alerts_enabled,
|
|
@@ -7,7 +7,13 @@ module Mailtrap
|
|
|
7
7
|
class SendingDomainsAPI
|
|
8
8
|
include BaseAPI
|
|
9
9
|
|
|
10
|
-
self.supported_options = %i[
|
|
10
|
+
self.supported_options = %i[
|
|
11
|
+
open_tracking_enabled
|
|
12
|
+
click_tracking_enabled
|
|
13
|
+
tracking_opt_out_enabled
|
|
14
|
+
auto_unsubscribe_link_enabled
|
|
15
|
+
inbound_enabled
|
|
16
|
+
]
|
|
11
17
|
|
|
12
18
|
self.response_class = SendingDomain
|
|
13
19
|
|
|
@@ -50,7 +56,9 @@ module Mailtrap
|
|
|
50
56
|
# @param [Hash] options The parameters to update
|
|
51
57
|
# @option options [Boolean] :open_tracking_enabled Enable open tracking for emails sent from this domain
|
|
52
58
|
# @option options [Boolean] :click_tracking_enabled Enable click tracking for links in emails sent from this domain
|
|
59
|
+
# @option options [Boolean] :tracking_opt_out_enabled Enable the tracking opt-out link in tracked emails
|
|
53
60
|
# @option options [Boolean] :auto_unsubscribe_link_enabled Automatically add an unsubscribe link to emails
|
|
61
|
+
# @option options [Boolean] :inbound_enabled Enable inbound email for this domain
|
|
54
62
|
# @return [SendingDomain] Updated sending domain
|
|
55
63
|
# @!macro api_errors
|
|
56
64
|
# @raise [ArgumentError] If invalid options are provided
|
|
@@ -7,6 +7,8 @@ module Mailtrap
|
|
|
7
7
|
class SuppressionsAPI
|
|
8
8
|
include BaseAPI
|
|
9
9
|
|
|
10
|
+
self.supported_options = %i[email domain_id sending_stream type].freeze
|
|
11
|
+
|
|
10
12
|
self.response_class = Suppression
|
|
11
13
|
|
|
12
14
|
# Lists all suppressions for the account
|
|
@@ -20,12 +22,28 @@ module Mailtrap
|
|
|
20
22
|
base_list(query_params)
|
|
21
23
|
end
|
|
22
24
|
|
|
25
|
+
# Adds an email address to the account's suppression list
|
|
26
|
+
# @param [Hash] options The suppression attributes
|
|
27
|
+
# @option options [String] :email Email address to suppress
|
|
28
|
+
# @option options [Integer] :domain_id ID of the domain to suppress this email for
|
|
29
|
+
# @option options [String] :sending_stream The sending stream to suppress for: "transactional" or "bulk"
|
|
30
|
+
# @option options [String] :type Reason for the suppression, defaults to "manual import" when omitted
|
|
31
|
+
# @return [Suppression] Created suppression
|
|
32
|
+
# @!macro api_errors
|
|
33
|
+
# @raise [ArgumentError] If invalid options are provided
|
|
34
|
+
def create(options)
|
|
35
|
+
validate_options!(options, supported_options)
|
|
36
|
+
response = client.post(base_path, options)
|
|
37
|
+
build_entity(response[:data], Suppression)
|
|
38
|
+
end
|
|
39
|
+
|
|
23
40
|
# Deletes a suppression
|
|
24
41
|
# @param suppression_id [String] The suppression UUID
|
|
25
|
-
# @return
|
|
42
|
+
# @return [Suppression] The deleted suppression
|
|
26
43
|
# @!macro api_errors
|
|
27
44
|
def delete(suppression_id)
|
|
28
|
-
client.delete("#{base_path}/#{suppression_id}")
|
|
45
|
+
response = client.delete("#{base_path}/#{suppression_id}")
|
|
46
|
+
build_entity(response, Suppression)
|
|
29
47
|
end
|
|
30
48
|
|
|
31
49
|
private
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Mailtrap
|
|
4
|
+
# Data Transfer Object for Tracking Opt-out
|
|
5
|
+
# @see https://docs.mailtrap.io/developers/management/tracking-opt-outs
|
|
6
|
+
# @attr_reader id [String] The tracking opt-out UUID
|
|
7
|
+
# @attr_reader email [String] The email address opted out of tracking
|
|
8
|
+
# @attr_reader created_at [String] The creation timestamp
|
|
9
|
+
# @attr_reader domain_name [String, nil] Sending domain the tracking opt-out applies to
|
|
10
|
+
TrackingOptOut = Struct.new(
|
|
11
|
+
:id,
|
|
12
|
+
:email,
|
|
13
|
+
:created_at,
|
|
14
|
+
:domain_name,
|
|
15
|
+
keyword_init: true
|
|
16
|
+
)
|
|
17
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'base_api'
|
|
4
|
+
require_relative 'tracking_opt_out'
|
|
5
|
+
require_relative 'tracking_opt_outs_list_response'
|
|
6
|
+
|
|
7
|
+
module Mailtrap
|
|
8
|
+
class TrackingOptOutsAPI
|
|
9
|
+
include BaseAPI
|
|
10
|
+
|
|
11
|
+
self.supported_options = %i[email domain_id].freeze
|
|
12
|
+
|
|
13
|
+
self.response_class = TrackingOptOut
|
|
14
|
+
|
|
15
|
+
# @param client [Mailtrap::Client] The client instance
|
|
16
|
+
def initialize(client = Mailtrap::Client.new)
|
|
17
|
+
@client = client
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Lists email addresses that have opted out of open and click tracking
|
|
21
|
+
# @param email [String, nil] Filter by exact email address (case-insensitive)
|
|
22
|
+
# @param start_time [String, nil] Only opt-outs created at or after this ISO 8601 timestamp
|
|
23
|
+
# @param end_time [String, nil] Only opt-outs created at or before this ISO 8601 timestamp
|
|
24
|
+
# @param last_id [String, nil] Cursor from the previous response's +last_id+ for the next page
|
|
25
|
+
# @return [TrackingOptOutsListResponse] The page of tracking opt-outs and the next cursor
|
|
26
|
+
# @!macro api_errors
|
|
27
|
+
def list(email: nil, start_time: nil, end_time: nil, last_id: nil)
|
|
28
|
+
query_params = {}
|
|
29
|
+
query_params[:email] = email unless email.nil?
|
|
30
|
+
query_params[:start_time] = start_time unless start_time.nil?
|
|
31
|
+
query_params[:end_time] = end_time unless end_time.nil?
|
|
32
|
+
query_params[:last_id] = last_id unless last_id.nil?
|
|
33
|
+
|
|
34
|
+
response = client.get(base_path, query_params)
|
|
35
|
+
|
|
36
|
+
TrackingOptOutsListResponse.new(
|
|
37
|
+
data: Array(response[:data]).map { |item| build_entity(item, TrackingOptOut) },
|
|
38
|
+
last_id: response[:last_id]
|
|
39
|
+
)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Adds an email address to the tracking opt-out list for a sending domain
|
|
43
|
+
# @param [Hash] options The tracking opt-out attributes
|
|
44
|
+
# @option options [String] :email Email address to opt out of tracking
|
|
45
|
+
# @option options [Integer] :domain_id ID of the sending domain the opt-out applies to
|
|
46
|
+
# @return [TrackingOptOut] Created tracking opt-out
|
|
47
|
+
# @!macro api_errors
|
|
48
|
+
# @raise [ArgumentError] If invalid options are provided
|
|
49
|
+
def create(options)
|
|
50
|
+
validate_options!(options, supported_options)
|
|
51
|
+
response = client.post(base_path, options)
|
|
52
|
+
build_entity(response[:data], TrackingOptOut)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Removes an email address from the tracking opt-out list
|
|
56
|
+
# @param tracking_opt_out_id [String] The tracking opt-out UUID
|
|
57
|
+
# @return [TrackingOptOut] The deleted tracking opt-out
|
|
58
|
+
# @!macro api_errors
|
|
59
|
+
def delete(tracking_opt_out_id)
|
|
60
|
+
response = client.delete("#{base_path}/#{tracking_opt_out_id}")
|
|
61
|
+
build_entity(response, TrackingOptOut)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
private
|
|
65
|
+
|
|
66
|
+
def base_path
|
|
67
|
+
'/api/tracking_opt_outs'
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Mailtrap
|
|
4
|
+
# Data Transfer Object for a paginated list of tracking opt-outs
|
|
5
|
+
# @see https://docs.mailtrap.io/developers/management/tracking-opt-outs
|
|
6
|
+
# @attr_reader data [Array<TrackingOptOut>] The tracking opt-outs on this page
|
|
7
|
+
# @attr_reader last_id [String, nil] Cursor for the next page, or nil if this is the last page
|
|
8
|
+
TrackingOptOutsListResponse = Struct.new(
|
|
9
|
+
:data,
|
|
10
|
+
:last_id,
|
|
11
|
+
keyword_init: true
|
|
12
|
+
)
|
|
13
|
+
end
|
data/lib/mailtrap/version.rb
CHANGED
data/lib/mailtrap.rb
CHANGED
|
@@ -18,6 +18,7 @@ require_relative 'mailtrap/contact_imports_api'
|
|
|
18
18
|
require_relative 'mailtrap/contact_exports_api'
|
|
19
19
|
require_relative 'mailtrap/contact_events_api'
|
|
20
20
|
require_relative 'mailtrap/suppressions_api'
|
|
21
|
+
require_relative 'mailtrap/tracking_opt_outs_api'
|
|
21
22
|
require_relative 'mailtrap/email_campaigns_api'
|
|
22
23
|
require_relative 'mailtrap/sending_domains_api'
|
|
23
24
|
require_relative 'mailtrap/company_info_api'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mailtrap
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.15.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Railsware Products Studio LLC
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-08-
|
|
11
|
+
date: 2026-08-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|
|
@@ -117,6 +117,9 @@ files:
|
|
|
117
117
|
- lib/mailtrap/sub_accounts_api.rb
|
|
118
118
|
- lib/mailtrap/suppression.rb
|
|
119
119
|
- lib/mailtrap/suppressions_api.rb
|
|
120
|
+
- lib/mailtrap/tracking_opt_out.rb
|
|
121
|
+
- lib/mailtrap/tracking_opt_outs_api.rb
|
|
122
|
+
- lib/mailtrap/tracking_opt_outs_list_response.rb
|
|
120
123
|
- lib/mailtrap/version.rb
|
|
121
124
|
- lib/mailtrap/webhook.rb
|
|
122
125
|
- lib/mailtrap/webhooks.rb
|