talktome 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/talktome/app.rb +3 -1
- data/lib/talktome/client/local.rb +1 -1
- data/lib/talktome/error.rb +1 -0
- data/lib/talktome/version.rb +1 -1
- data/spec/app/test_app.rb +14 -0
- data/spec/client/test_local.rb +1 -0
- 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: 59ff5a2d705d895d7b3e03e7b6d6a9df13e6a818df6198abb238b6b2b13f34a1
|
4
|
+
data.tar.gz: 8390299781fe6800b7e0e7b68fb5d0d504b4d90ee84c8c6452a1703b24ce2ad6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60ad688912efaefcdc60847da49b07aaadf07fdfaed1036b4905db407ff7d97c3d190ae41f8d7b70537ddfd2a7cd2dd711aa2cd1f346f48c92f6e5cac94a9686
|
7
|
+
data.tar.gz: a05b855ab7e15f29b39f8d42eee139d193788c876077e7ff0a3fd3819bb38314005a1eced8ba83c7c0d919319cb61a0adcf945e44e00847e142f1282031bebd3
|
data/lib/talktome/app.rb
CHANGED
@@ -40,8 +40,10 @@ module Talktome
|
|
40
40
|
fail!("Invalid data")
|
41
41
|
rescue Finitio::Error => ex
|
42
42
|
fail!(ex.message)
|
43
|
-
rescue ::Talktome::InvalidEmailError
|
43
|
+
rescue ::Talktome::InvalidEmailError
|
44
44
|
fail!("Invalid email address")
|
45
|
+
rescue ::Talktome::TemplateNotFoundError
|
46
|
+
fail!("No such template", 404)
|
45
47
|
end
|
46
48
|
end
|
47
49
|
|
@@ -17,7 +17,7 @@ module Talktome
|
|
17
17
|
|
18
18
|
def load_message!(identifier, strategies)
|
19
19
|
folder = self.folder/identifier
|
20
|
-
raise
|
20
|
+
raise TemplateNotFoundError, "No such message `#{identifier}`" unless folder.exists?
|
21
21
|
raise InvalidMessageError, "Message `#{identifier}` should be a folder" unless folder.directory?
|
22
22
|
strategies.each do |s|
|
23
23
|
if (file = folder.glob("#{s}.*").first) && file.file?
|
data/lib/talktome/error.rb
CHANGED
data/lib/talktome/version.rb
CHANGED
data/spec/app/test_app.rb
CHANGED
@@ -182,5 +182,19 @@ module Talktome
|
|
182
182
|
end
|
183
183
|
end
|
184
184
|
|
185
|
+
context 'POST /xxx when the template does not exist' do
|
186
|
+
|
187
|
+
it 'return a 404 error when the template doesn\'t exist' do
|
188
|
+
post "/multi-lingual/fr/", {
|
189
|
+
reply_to: 'hello@visitor.com',
|
190
|
+
message: 'Hello from visitor',
|
191
|
+
key: 'value',
|
192
|
+
}.to_json, { "CONTENT_TYPE" => "application/json" }
|
193
|
+
|
194
|
+
expect(last_response.status).to eql(404)
|
195
|
+
expect(last_response.body).to match(/No such template/)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
185
199
|
end
|
186
200
|
end
|
data/spec/client/test_local.rb
CHANGED
@@ -74,6 +74,7 @@ module Talktome
|
|
74
74
|
client.talktome("welcome", user, tpldata, [:email])
|
75
75
|
expect(strategy.last.message.to_html).to eql("<html><title>Hello Test user</title><body><h1>Hello Test user</h1>\n\n<p>Welcome to this email example!</p>\n\n<h3>Test user</h3>\n</body></html>\n")
|
76
76
|
end
|
77
|
+
|
77
78
|
end
|
78
79
|
|
79
80
|
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.3.
|
4
|
+
version: 1.3.1
|
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-
|
11
|
+
date: 2021-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|