talktome 1.2.0 → 1.3.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/lib/talktome/app.rb +3 -4
- data/lib/talktome/version.rb +1 -1
- data/spec/app/test_app.rb +20 -0
- data/spec/fixtures/contact-us/email.md +13 -0
- data/spec/fixtures/multi-lingual/en/email.md +13 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ca8cf300ad4144fd6336f1ff56e4fc97140742869f10397ce62c9d0fecd3c03
|
4
|
+
data.tar.gz: 9d439309e79ebb3da0ea177af0606e882a643adc55e045cca5a56bb154ac6888
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4bd93a6e3bde5390185ebd55844a0db7b48fd81ca0c0982289d67ca15c5866f402b645191f6ba1826a7c4b5147b67937e0d7c07cd9f08788a616b2f019751c4
|
7
|
+
data.tar.gz: 9b255ab12108b8e37c024aff7bbe49b8ce85c543cc14fe62b797d64aadcbd59c2a9fe33530bdfa3e35872a7a3a553673ff064472e4fbf4cf4563377c2de4ad14
|
data/lib/talktome/app.rb
CHANGED
@@ -13,6 +13,7 @@ module Talktome
|
|
13
13
|
|
14
14
|
set :raise_errors, true
|
15
15
|
set :show_exceptions, false
|
16
|
+
set :talktome, Talktome::Client::Local.new(ROOT_FOLDER/'templates')
|
16
17
|
|
17
18
|
VALIDATION_SCHEMA = ::Finitio.system(<<~FIO)
|
18
19
|
@import finitio/data
|
@@ -24,16 +25,14 @@ module Talktome
|
|
24
25
|
}
|
25
26
|
FIO
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
post %r{/([a-z-]+)/} do |action|
|
28
|
+
post %r{/([a-z-]+([\/][a-z-]+)*)/} do |action, _|
|
30
29
|
begin
|
31
30
|
as_array = info.map{|k,v| {'key' => k.capitalize, 'value' => v}}
|
32
31
|
subject = Talktome.env('TALKTOME_EMAIL_SUBJECT', 'Someone wants to reach you!')
|
33
32
|
footer = Talktome.env('TALKTOME_EMAIL_FOOTER', "Truly yours,\n
|
34
33
|
Sent by [Enspirit.be](https://enspirit.be/), contact us if you need help with any IT task.")
|
35
34
|
user = load_user_from_info!
|
36
|
-
|
35
|
+
settings.talktome.talktome(action, user, info.merge(allvars: as_array, subject: subject, footer: footer), [:email]){|email|
|
37
36
|
email.reply_to = info[:reply_to] if info.has_key?(:reply_to)
|
38
37
|
}
|
39
38
|
[ 200, { "Content-Type" => "text/plain"}, ["Ok"] ]
|
data/lib/talktome/version.rb
CHANGED
data/spec/app/test_app.rb
CHANGED
@@ -9,6 +9,7 @@ module Talktome
|
|
9
9
|
}
|
10
10
|
|
11
11
|
before(:each) do
|
12
|
+
Talktome::App.set :talktome, Talktome::Client::Local.new(Path.dir.parent/'fixtures')
|
12
13
|
ENV['TALKTOME_EMAIL_DEFAULT_TO'] = "to@talktome.com"
|
13
14
|
ENV['TALKTOME_EMAIL_DEFAULT_FROM'] = "from@talktome.com"
|
14
15
|
Mail::TestMailer.deliveries.clear
|
@@ -162,5 +163,24 @@ module Talktome
|
|
162
163
|
end
|
163
164
|
end
|
164
165
|
|
166
|
+
context 'POST /multi-lingual/en/' do
|
167
|
+
|
168
|
+
it 'works' do
|
169
|
+
post "/multi-lingual/en/", {
|
170
|
+
reply_to: 'hello@visitor.com',
|
171
|
+
message: 'Hello from visitor',
|
172
|
+
key: 'value',
|
173
|
+
}.to_json, { "CONTENT_TYPE" => "application/json" }
|
174
|
+
expect(last_response.status).to eql(200)
|
175
|
+
expect(last_response).to be_ok
|
176
|
+
expect(Mail::TestMailer.deliveries.length).to eql(1)
|
177
|
+
expect(Mail::TestMailer.deliveries.first.to).to eql(["to@talktome.com"])
|
178
|
+
expect(Mail::TestMailer.deliveries.first.from).to eql(["from@talktome.com"])
|
179
|
+
expect(Mail::TestMailer.deliveries.first.subject).to eql("Someone wants to reach you!")
|
180
|
+
expect(Mail::TestMailer.deliveries.first.html_part.body).to include("<li>Key: value</li>")
|
181
|
+
expect(Mail::TestMailer.deliveries.first.html_part.body).to include("Truly yours")
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
165
185
|
end
|
166
186
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: talktome
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bernard Lambeau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -191,7 +191,9 @@ files:
|
|
191
191
|
- lib/talktome/version.rb
|
192
192
|
- spec/app/test_app.rb
|
193
193
|
- spec/client/test_local.rb
|
194
|
+
- spec/fixtures/contact-us/email.md
|
194
195
|
- spec/fixtures/layouts/email.html
|
196
|
+
- spec/fixtures/multi-lingual/en/email.md
|
195
197
|
- spec/fixtures/welcome/email.md
|
196
198
|
- spec/fixtures/welcome/footer.mustache
|
197
199
|
- spec/message/test_initialize.rb
|