talktome 2.2.3 → 2.3.0

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: e9dd35ad880a0a27e0085b32cb0cf9648b5bf85d857978fc84fce93143020ba4
4
- data.tar.gz: 4b70b7cfc20322e78a95fb9484df703e9a906c11b066f04df70967f762d938cd
3
+ metadata.gz: 72edf2de6b2406e20eee455867bb42317c2ba5c66aa20b793239a4cccbd1d7d3
4
+ data.tar.gz: 5660f0b9a92b83be2ab3cb895c3cc62de855b94a693e00c0a2b66efce4b19238
5
5
  SHA512:
6
- metadata.gz: aa7a01025400f5baf5035ed420e5e543ced378301e133b4f59f3b66217ba8d9f839b5e387a294dbb81829eca34f66d1f57c52a9c573d2e5e79d6f2784bc33b96
7
- data.tar.gz: c52d495efe5858346ec799788a4b6aebff3402f0233522836425e6e88548f541b61d3290fad85cfe9233986d9feb4219fffc16a1283405090e89ceb08aacd7d5
6
+ metadata.gz: 1b02bf96b1ea49d168f4a83e0518c1539e45a6cd5fd4e5dd2a5e68b00be1ee745ffe58ec90ec70715e7c73a6229d3653c285e9f270bceb5ae8c459343c4c0fe3
7
+ data.tar.gz: 505955c6bd32a11f217f45df2af21fd54a4b028b95843eb0d4c7bade2a7da35f916e011b75c29d7dfb749440abf0833c518133575cab89b9660a10457388747f
data/lib/talktome/app.rb CHANGED
@@ -23,15 +23,16 @@ module Talktome
23
23
  encoding :? String
24
24
  }
25
25
  Email = String(s | s =~ /^[^@]+@[^@]+$/ )
26
- {
26
+ Base = {
27
27
  to :? Email
28
28
  reply_to :? Email
29
29
  in_reply_to :? String
30
30
  attachments :? {
31
31
  ... : Attachment
32
32
  }
33
- ... : .Object
33
+ ... : .Object
34
34
  }
35
+ #{Talktome.env('TALKTOME_VALIDATION_SCHEMA', 'Base')}
35
36
  FIO
36
37
 
37
38
  post %r{/([a-z-]+([\/][a-z-]+)*)/} do |action, _|
@@ -34,9 +34,13 @@ module Talktome
34
34
 
35
35
  def templater(strategy)
36
36
  return nil unless tpl_folder = options[:layouts] || options[:templates]
37
+
37
38
  ->(message, src, ctype) {
38
39
  if (file = tpl_folder/"#{strategy}.#{ctype}").file?
39
- data = { metadata: message.metadata, yield: src }
40
+ data = message.data.merge({
41
+ metadata: message.metadata,
42
+ yield: src
43
+ })
40
44
  Mustache.render(file.read, data)
41
45
  else
42
46
  src
@@ -1,8 +1,8 @@
1
1
  module Talktome
2
2
  module Version
3
3
  MAJOR = 2
4
- MINOR = 2
5
- TINY = 3
4
+ MINOR = 3
5
+ TINY = 0
6
6
  end
7
7
  VERSION = "#{Version::MAJOR}.#{Version::MINOR}.#{Version::TINY}"
8
8
  end
data/spec/app/test_app.rb CHANGED
@@ -63,6 +63,15 @@ module Talktome
63
63
  end
64
64
  end
65
65
 
66
+ it 'detects invalid emails' do
67
+ post "/contact-us/", {
68
+ to: 'helloatvisitor.com',
69
+ message: 'Hello from visitor'
70
+ }.to_json, { "CONTENT_TYPE" => "application/json" }
71
+ expect(last_response.status).to eql(400)
72
+ expect(Mail::TestMailer.deliveries.length).to eql(0)
73
+ end
74
+
66
75
  it 'detects invalid emails' do
67
76
  post "/contact-us/", {
68
77
  reply_to: 'helloatvisitor.com',
@@ -22,7 +22,10 @@ module Talktome
22
22
  }
23
23
 
24
24
  let(:tpldata) {
25
- { who: "Test user" }
25
+ {
26
+ who: "Test user",
27
+ lang: "en",
28
+ }
26
29
  }
27
30
 
28
31
  before(:each) {
@@ -51,7 +54,7 @@ module Talktome
51
54
  it 'sends email when requested' do
52
55
  client.talktome("welcome", user, tpldata, [:email])
53
56
  expect(strategy.last.message).not_to be_nil
54
- 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")
57
+ expect(strategy.last.message.to_html).to eql("<html lang='en'><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")
55
58
  end
56
59
 
57
60
  it 'yields the callback with the email' do
@@ -72,7 +75,7 @@ module Talktome
72
75
 
73
76
  it 'sends email when requested' do
74
77
  client.talktome("welcome", user, tpldata, [:email])
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")
78
+ expect(strategy.last.message.to_html).to eql("<html lang='en'><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
79
  end
77
80
 
78
81
  end
@@ -1 +1 @@
1
- <html><title>{{metadata.subject}}</title><body>{{{yield}}}</body></html>
1
+ <html lang='{{lang}}'><title>{{metadata.subject}}</title><body>{{{yield}}}</body></html>
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: 2.2.3
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernard Lambeau
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-26 00:00:00.000000000 Z
11
+ date: 2024-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -42,16 +42,22 @@ dependencies:
42
42
  name: rack-test
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 0.6.3
47
+ version: '2.1'
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: '3.0'
48
51
  type: :development
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
52
- - - '='
55
+ - - ">="
53
56
  - !ruby/object:Gem::Version
54
- version: 0.6.3
57
+ version: '2.1'
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: '3.0'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: path
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -120,7 +126,7 @@ dependencies:
120
126
  requirements:
121
127
  - - ">="
122
128
  - !ruby/object:Gem::Version
123
- version: '2.1'
129
+ version: '3.2'
124
130
  - - "<"
125
131
  - !ruby/object:Gem::Version
126
132
  version: '4.0'
@@ -130,7 +136,7 @@ dependencies:
130
136
  requirements:
131
137
  - - ">="
132
138
  - !ruby/object:Gem::Version
133
- version: '2.1'
139
+ version: '3.2'
134
140
  - - "<"
135
141
  - !ruby/object:Gem::Version
136
142
  version: '4.0'
@@ -223,7 +229,7 @@ homepage: http://github.com/enspirit/talktome
223
229
  licenses:
224
230
  - MIT
225
231
  metadata: {}
226
- post_install_message:
232
+ post_install_message:
227
233
  rdoc_options: []
228
234
  require_paths:
229
235
  - lib
@@ -238,8 +244,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
238
244
  - !ruby/object:Gem::Version
239
245
  version: '0'
240
246
  requirements: []
241
- rubygems_version: 3.4.10
242
- signing_key:
247
+ rubygems_version: 3.5.9
248
+ signing_key:
243
249
  specification_version: 4
244
250
  summary: Talktome helps you talk to users by email, messaging, sms, etc.
245
251
  test_files: []