hey-you 1.2.3 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -1
- data/lib/hey_you/builder/email.rb +21 -4
- data/lib/hey_you/version.rb +1 -1
- 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: 6fc4f5a3d663c2e8496f01efec20e020f02b03088d4a83c182cf1a673deb2886
|
4
|
+
data.tar.gz: d442018540664c329f346ebaabd4c558d4da11b39763a703b990dd09d6e8a1dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cfad0eac54d8256b0347bffeff673e938e265c16ca4adf724390588e77046449bc62cab904171fb8baf114d47e5255cef60fa0d19b6a79f5d7fbcdf6085c113
|
7
|
+
data.tar.gz: 64b3e74fb8269048f2fc3dccd3fd49824c4d905ba0dec1376d1c8a7ab659d4af91805a7699c9d4f05e398e6e4aba212fb6bae774d38c30abc4e679b8b47b7f25
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
# Changelog for hey-you gem
|
2
|
+
## 1.3.0
|
3
|
+
- Feature: `body_part` in email builder.
|
2
4
|
|
3
5
|
### 1.2.3
|
4
6
|
- Improvement: fix ruby 2.7 warnings
|
@@ -14,4 +16,4 @@
|
|
14
16
|
|
15
17
|
### 1.2.0
|
16
18
|
- Feature: data source extensions (check readme for more information).
|
17
|
-
__Attention__: You should rewrite your configuration for use yaml data source!
|
19
|
+
__Attention__: You should rewrite your configuration for use yaml data source!
|
@@ -3,19 +3,36 @@ require_relative '_base'
|
|
3
3
|
module HeyYou
|
4
4
|
class Builder
|
5
5
|
class Email < Base
|
6
|
-
attr_reader :subject, :body, :layout, :mailer_class, :mailer_method, :delivery_method
|
6
|
+
attr_reader :subject, :body, :layout, :mailer_class, :mailer_method, :delivery_method, :body_parts
|
7
7
|
|
8
8
|
def build
|
9
9
|
@mailer_class = ch_data.fetch('mailer_class', nil)
|
10
10
|
@mailer_method = ch_data.fetch('mailer_method', nil)
|
11
11
|
@delivery_method = ch_data.fetch('delivery_method', nil)
|
12
|
-
@body = interpolate(ch_data
|
12
|
+
@body = interpolate(ch_data['body'], options) if ch_data['body']
|
13
|
+
@body_parts = interpolate_each(ch_data.fetch('body_parts', nil), options)
|
13
14
|
@subject = interpolate(ch_data.fetch('subject'), options)
|
14
15
|
end
|
15
16
|
|
16
17
|
def to_hash
|
17
|
-
{ body: body, subject: subject }
|
18
|
+
{ body: body, subject: subject, body_parts: body_parts }
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def interpolate_each(notification_hash, options)
|
24
|
+
return notification_hash unless notification_hash.is_a?(Hash)
|
25
|
+
|
26
|
+
notification_hash.each do |k, v|
|
27
|
+
next interpolate_each(v, options) if v.is_a?(Hash)
|
28
|
+
|
29
|
+
begin
|
30
|
+
notification_hash[k] = v % options
|
31
|
+
rescue KeyError
|
32
|
+
raise InterpolationError, "Failed build notification string `#{v}`: #{err.message}"
|
33
|
+
end
|
34
|
+
end
|
18
35
|
end
|
19
36
|
end
|
20
37
|
end
|
21
|
-
end
|
38
|
+
end
|
data/lib/hey_you/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hey-you
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Nesterov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fcm
|