emailbutler 0.9.0 → 0.9.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.
- checksums.yaml +4 -4
- data/lib/emailbutler/adapters/active_record.rb +3 -2
- data/lib/emailbutler/configuration.rb +3 -4
- data/lib/emailbutler/version.rb +1 -1
- data/lib/emailbutler/webhooks/mappers/mailjet.rb +11 -4
- data/lib/emailbutler/webhooks/mappers/mailtrap.rb +11 -4
- data/lib/emailbutler/webhooks/mappers/mandrill.rb +11 -4
- data/lib/emailbutler/webhooks/mappers/resend.rb +11 -4
- data/lib/emailbutler/webhooks/mappers/sendgrid.rb +13 -6
- data/lib/emailbutler/webhooks/mappers/smtp2go.rb +11 -4
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e383f6ed08c050c7149654b5c8799486a3a0dd896e2af2fa8148524c9dd73428
|
|
4
|
+
data.tar.gz: 1e6934ee8b820cb46d586899bf30bcb818944de02c3e466e3feb18f5baef367a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5f40fda2c1f56e1fa61cb2e54e039470bbd6ff885c9e63e3caa77306789e7d661c410f560fb9f185ab491273abf173bed36b46e1512ef62b73aff8b77b6f80f5
|
|
7
|
+
data.tar.gz: 7ead6ad7e71e30e67094a28700913d166bea96a3daa09541f6e770c04a16f541bf28cf007f4f3644309884c6e0cb3cc2a66fd7f0bf6bd289faca0db41d789299
|
|
@@ -20,11 +20,12 @@ module Emailbutler
|
|
|
20
20
|
PROCESSED = 'processed'
|
|
21
21
|
FAILED = 'failed'
|
|
22
22
|
DELIVERED = 'delivered'
|
|
23
|
+
OPENED = 'opened'
|
|
23
24
|
|
|
24
25
|
if Gem.loaded_specs['activerecord'].version < Gem::Version.create('7.0')
|
|
25
|
-
enum status: { CREATED => 0, REJECTED => 1, PROCESSED => 2, FAILED => 3, DELIVERED => 4 }
|
|
26
|
+
enum status: { CREATED => 0, REJECTED => 1, PROCESSED => 2, FAILED => 3, DELIVERED => 4, OPENED => 5 }
|
|
26
27
|
else
|
|
27
|
-
enum :status, { CREATED => 0, REJECTED => 1, PROCESSED => 2, FAILED => 3, DELIVERED => 4 }
|
|
28
|
+
enum :status, { CREATED => 0, REJECTED => 1, PROCESSED => 2, FAILED => 3, DELIVERED => 4, OPENED => 5 }
|
|
28
29
|
end
|
|
29
30
|
|
|
30
31
|
after_initialize :generate_uuid
|
|
@@ -4,16 +4,15 @@ module Emailbutler
|
|
|
4
4
|
class Configuration
|
|
5
5
|
InitializeError = Class.new(StandardError)
|
|
6
6
|
|
|
7
|
-
AVAILABLE_ADAPTERS = %w[
|
|
8
|
-
Emailbutler::Adapters::ActiveRecord
|
|
9
|
-
].freeze
|
|
7
|
+
AVAILABLE_ADAPTERS = %w[Emailbutler::Adapters::ActiveRecord].freeze
|
|
10
8
|
AVAILABLE_PROVIDERS = %w[sendgrid smtp2go resend mailjet mailtrap mandrill].freeze
|
|
11
9
|
|
|
12
|
-
attr_reader :adapter, :providers, :ui_username, :ui_password, :ui_secured_environments
|
|
10
|
+
attr_reader :adapter, :providers, :mapping, :ui_username, :ui_password, :ui_secured_environments
|
|
13
11
|
|
|
14
12
|
def initialize
|
|
15
13
|
@adapter = nil
|
|
16
14
|
@providers = []
|
|
15
|
+
@mapping = true
|
|
17
16
|
|
|
18
17
|
# It's required to specify these 3 variables to enable basic auth to UI
|
|
19
18
|
@ui_username = ''
|
data/lib/emailbutler/version.rb
CHANGED
|
@@ -6,8 +6,8 @@ module Emailbutler
|
|
|
6
6
|
class Mailjet
|
|
7
7
|
DELIVERABILITY_MAPPER = {
|
|
8
8
|
'sent' => 'processed',
|
|
9
|
-
'open' => '
|
|
10
|
-
'click' => '
|
|
9
|
+
'open' => 'opened',
|
|
10
|
+
'click' => 'opened'
|
|
11
11
|
}.freeze
|
|
12
12
|
|
|
13
13
|
def call(payload:)
|
|
@@ -15,17 +15,24 @@ module Emailbutler
|
|
|
15
15
|
# message-id contains data like <uuid>
|
|
16
16
|
message_uuid = payload['Message_GUID']
|
|
17
17
|
message_uuid = message_uuid[1..-2] if message_uuid.starts_with?('<') && message_uuid.ends_with?('>')
|
|
18
|
-
status = DELIVERABILITY_MAPPER[payload['event']] || Emailbutler::Message::FAILED
|
|
19
18
|
return [] if message_uuid.nil?
|
|
20
19
|
|
|
21
20
|
[
|
|
22
21
|
{
|
|
23
22
|
message_uuid: message_uuid,
|
|
24
|
-
status:
|
|
23
|
+
status: transform_status(payload['event']),
|
|
25
24
|
timestamp: payload['time'] ? Time.at(payload['time'].to_i).utc.to_datetime : nil
|
|
26
25
|
}
|
|
27
26
|
]
|
|
28
27
|
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
def transform_status(value)
|
|
32
|
+
return DELIVERABILITY_MAPPER[value] || Emailbutler::Message::FAILED if Emailbutler.configuration.mapping
|
|
33
|
+
|
|
34
|
+
value
|
|
35
|
+
end
|
|
29
36
|
end
|
|
30
37
|
end
|
|
31
38
|
end
|
|
@@ -6,8 +6,8 @@ module Emailbutler
|
|
|
6
6
|
class Mailtrap
|
|
7
7
|
DELIVERABILITY_MAPPER = {
|
|
8
8
|
'delivery' => 'delivered',
|
|
9
|
-
'open' => '
|
|
10
|
-
'click' => '
|
|
9
|
+
'open' => 'opened',
|
|
10
|
+
'click' => 'opened'
|
|
11
11
|
}.freeze
|
|
12
12
|
|
|
13
13
|
def call(payload:)
|
|
@@ -15,16 +15,23 @@ module Emailbutler
|
|
|
15
15
|
message.stringify_keys!
|
|
16
16
|
message_uuid = message['message_id']
|
|
17
17
|
message_uuid = message_uuid[1..-2] if message_uuid.starts_with?('<') && message_uuid.ends_with?('>')
|
|
18
|
-
status = DELIVERABILITY_MAPPER[message['event']] || Emailbutler::Message::FAILED
|
|
19
18
|
next if message_uuid.nil?
|
|
20
19
|
|
|
21
20
|
{
|
|
22
21
|
message_uuid: message_uuid,
|
|
23
|
-
status:
|
|
22
|
+
status: transform_status(message['event']),
|
|
24
23
|
timestamp: message['timestamp'] ? Time.at(message['timestamp']).utc.to_datetime : nil
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
26
|
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
def transform_status(value)
|
|
31
|
+
return DELIVERABILITY_MAPPER[value] || Emailbutler::Message::FAILED if Emailbutler.configuration.mapping
|
|
32
|
+
|
|
33
|
+
value
|
|
34
|
+
end
|
|
28
35
|
end
|
|
29
36
|
end
|
|
30
37
|
end
|
|
@@ -6,8 +6,8 @@ module Emailbutler
|
|
|
6
6
|
class Mandrill
|
|
7
7
|
DELIVERABILITY_MAPPER = {
|
|
8
8
|
'send' => 'processed',
|
|
9
|
-
'open' => '
|
|
10
|
-
'click' => '
|
|
9
|
+
'open' => 'opened',
|
|
10
|
+
'click' => 'opened'
|
|
11
11
|
}.freeze
|
|
12
12
|
|
|
13
13
|
def call(payload:)
|
|
@@ -15,16 +15,23 @@ module Emailbutler
|
|
|
15
15
|
message.stringify_keys!
|
|
16
16
|
message_uuid = message['_id']
|
|
17
17
|
message_uuid = message_uuid[1..-2] if message_uuid.starts_with?('<') && message_uuid.ends_with?('>')
|
|
18
|
-
status = DELIVERABILITY_MAPPER[message['event']] || Emailbutler::Message::FAILED
|
|
19
18
|
next if message_uuid.nil?
|
|
20
19
|
|
|
21
20
|
{
|
|
22
21
|
message_uuid: message_uuid,
|
|
23
|
-
status:
|
|
22
|
+
status: transform_status(message['event']),
|
|
24
23
|
timestamp: message['ts'] ? Time.at(message['ts']).utc.to_datetime : nil
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
26
|
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
def transform_status(value)
|
|
31
|
+
return DELIVERABILITY_MAPPER[value] || Emailbutler::Message::FAILED if Emailbutler.configuration.mapping
|
|
32
|
+
|
|
33
|
+
value
|
|
34
|
+
end
|
|
28
35
|
end
|
|
29
36
|
end
|
|
30
37
|
end
|
|
@@ -7,25 +7,32 @@ module Emailbutler
|
|
|
7
7
|
DELIVERABILITY_MAPPER = {
|
|
8
8
|
'email.sent' => 'processed',
|
|
9
9
|
'email.delivered' => 'delivered',
|
|
10
|
-
'email.opened' => '
|
|
11
|
-
'email.clicked' => '
|
|
10
|
+
'email.opened' => 'opened',
|
|
11
|
+
'email.clicked' => 'opened'
|
|
12
12
|
}.freeze
|
|
13
13
|
|
|
14
14
|
def call(payload:)
|
|
15
15
|
payload.stringify_keys!
|
|
16
16
|
message_uuid = payload.dig('data', 'email_id')
|
|
17
17
|
message_uuid = message_uuid[1..-2] if message_uuid.starts_with?('<') && message_uuid.ends_with?('>')
|
|
18
|
-
status = DELIVERABILITY_MAPPER[payload['type']] || Emailbutler::Message::FAILED
|
|
19
18
|
return [] if message_uuid.nil?
|
|
20
19
|
|
|
21
20
|
[
|
|
22
21
|
{
|
|
23
22
|
message_uuid: message_uuid,
|
|
24
|
-
status:
|
|
23
|
+
status: transform_status(payload['type']),
|
|
25
24
|
timestamp: payload['created_at'] ? DateTime.parse(payload['created_at']).utc : nil
|
|
26
25
|
}
|
|
27
26
|
]
|
|
28
27
|
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
def transform_status(value)
|
|
32
|
+
return DELIVERABILITY_MAPPER[value] || Emailbutler::Message::FAILED if Emailbutler.configuration.mapping
|
|
33
|
+
|
|
34
|
+
value
|
|
35
|
+
end
|
|
29
36
|
end
|
|
30
37
|
end
|
|
31
38
|
end
|
|
@@ -7,25 +7,32 @@ module Emailbutler
|
|
|
7
7
|
DELIVERABILITY_MAPPER = {
|
|
8
8
|
'processed' => 'processed',
|
|
9
9
|
'delivered' => 'delivered',
|
|
10
|
-
'open' => '
|
|
11
|
-
'click' => '
|
|
10
|
+
'open' => 'opened',
|
|
11
|
+
'click' => 'opened'
|
|
12
12
|
}.freeze
|
|
13
13
|
|
|
14
|
-
def call(payload:) # rubocop: disable Metrics/AbcSize, Metrics/CyclomaticComplexity
|
|
14
|
+
def call(payload:) # rubocop: disable Metrics/AbcSize, Metrics/CyclomaticComplexity
|
|
15
15
|
payload['_json'].filter_map { |message|
|
|
16
16
|
message.stringify_keys!
|
|
17
17
|
message_uuid = message['smtp-id'] || message['sg_message_id']
|
|
18
18
|
message_uuid = message_uuid[1..-2] if message_uuid.starts_with?('<') && message_uuid.ends_with?('>')
|
|
19
|
-
|
|
20
|
-
next if message_uuid.nil? || status.nil?
|
|
19
|
+
next if message_uuid.nil?
|
|
21
20
|
|
|
22
21
|
{
|
|
23
22
|
message_uuid: message_uuid,
|
|
24
|
-
status:
|
|
23
|
+
status: transform_status(message['event']),
|
|
25
24
|
timestamp: message['timestamp'] ? Time.at(message['timestamp'].to_i).utc.to_datetime : nil
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
27
|
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
def transform_status(value)
|
|
32
|
+
return DELIVERABILITY_MAPPER[value] || Emailbutler::Message::FAILED if Emailbutler.configuration.mapping
|
|
33
|
+
|
|
34
|
+
value
|
|
35
|
+
end
|
|
29
36
|
end
|
|
30
37
|
end
|
|
31
38
|
end
|
|
@@ -7,8 +7,8 @@ module Emailbutler
|
|
|
7
7
|
DELIVERABILITY_MAPPER = {
|
|
8
8
|
'processed' => 'processed',
|
|
9
9
|
'delivered' => 'delivered',
|
|
10
|
-
'open' => '
|
|
11
|
-
'click' => '
|
|
10
|
+
'open' => 'opened',
|
|
11
|
+
'click' => 'opened'
|
|
12
12
|
}.freeze
|
|
13
13
|
|
|
14
14
|
def call(payload:)
|
|
@@ -16,17 +16,24 @@ module Emailbutler
|
|
|
16
16
|
# message-id contains data like <uuid>
|
|
17
17
|
message_uuid = payload['message-id']
|
|
18
18
|
message_uuid = message_uuid[1..-2] if message_uuid.starts_with?('<') && message_uuid.ends_with?('>')
|
|
19
|
-
status = DELIVERABILITY_MAPPER[payload['event']] || Emailbutler::Message::FAILED
|
|
20
19
|
return [] if message_uuid.nil?
|
|
21
20
|
|
|
22
21
|
[
|
|
23
22
|
{
|
|
24
23
|
message_uuid: message_uuid,
|
|
25
|
-
status:
|
|
24
|
+
status: transform_status(payload['event']),
|
|
26
25
|
timestamp: payload['sendtime'] ? Time.at(payload['sendtime'].to_i).utc.to_datetime : nil
|
|
27
26
|
}
|
|
28
27
|
]
|
|
29
28
|
end
|
|
29
|
+
|
|
30
|
+
private
|
|
31
|
+
|
|
32
|
+
def transform_status(value)
|
|
33
|
+
return DELIVERABILITY_MAPPER[value] || Emailbutler::Message::FAILED if Emailbutler.configuration.mapping
|
|
34
|
+
|
|
35
|
+
value
|
|
36
|
+
end
|
|
30
37
|
end
|
|
31
38
|
end
|
|
32
39
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: emailbutler
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bogdanov Anton
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-05-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: dry-container
|