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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ca8cf300ad4144fd6336f1ff56e4fc97140742869f10397ce62c9d0fecd3c03
4
- data.tar.gz: 9d439309e79ebb3da0ea177af0606e882a643adc55e045cca5a56bb154ac6888
3
+ metadata.gz: 59ff5a2d705d895d7b3e03e7b6d6a9df13e6a818df6198abb238b6b2b13f34a1
4
+ data.tar.gz: 8390299781fe6800b7e0e7b68fb5d0d504b4d90ee84c8c6452a1703b24ce2ad6
5
5
  SHA512:
6
- metadata.gz: d4bd93a6e3bde5390185ebd55844a0db7b48fd81ca0c0982289d67ca15c5866f402b645191f6ba1826a7c4b5147b67937e0d7c07cd9f08788a616b2f019751c4
7
- data.tar.gz: 9b255ab12108b8e37c024aff7bbe49b8ce85c543cc14fe62b797d64aadcbd59c2a9fe33530bdfa3e35872a7a3a553673ff064472e4fbf4cf4563377c2de4ad14
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 => ex
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 InvalidMessageError, "No such message `#{identifier}`" unless folder.exists?
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?
@@ -2,4 +2,5 @@ module Talktome
2
2
  class Error < StandardError; end
3
3
  class InvalidMessageError < Error; end
4
4
  class InvalidEmailError < Error; end
5
+ class TemplateNotFoundError < Error; end
5
6
  end
@@ -2,7 +2,7 @@ module Talktome
2
2
  module Version
3
3
  MAJOR = 1
4
4
  MINOR = 3
5
- TINY = 0
5
+ TINY = 1
6
6
  end
7
7
  VERSION = "#{Version::MAJOR}.#{Version::MINOR}.#{Version::TINY}"
8
8
  end
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
@@ -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.0
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-05-31 00:00:00.000000000 Z
11
+ date: 2021-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake