telesms 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/lib/telesms/incoming.rb +3 -0
- data/lib/telesms/version.rb +1 -1
- data/spec/incoming_spec.rb +19 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 444d8a5a3d0d438def9c8511a32b30e2b9ca8a85
|
4
|
+
data.tar.gz: 0f73a20afe82bb615b84a805580f25b5e951e0e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc8e9d3c77882b98b64d60b473ddc6075fe4eac6c484183401d26a681fd0765f932e14c9fbd0759ea771a05e1d4ac73ff142c482db5eb92eb9922e87dcec8d7d
|
7
|
+
data.tar.gz: 63aa0098e2a301e2a188042c7470c8c1ff7ef4709a6f465a53b7f917f74b5a88889b5629b84eba52aa4bdfd3f96a883bfe32122a2099cec0da486d6b31a09a18
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -68,4 +68,4 @@ If you want to contribute, please:
|
|
68
68
|
|
69
69
|
## LICENSE:
|
70
70
|
|
71
|
-
TeleSMS is Copyright © 2014
|
71
|
+
TeleSMS is Copyright © 2014 Code Garden, LLC. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
|
data/lib/telesms/incoming.rb
CHANGED
@@ -89,6 +89,9 @@ module Telesms
|
|
89
89
|
def clean_body!
|
90
90
|
body = @mail.parts.last.body.decoded if @mail.multipart?
|
91
91
|
body ||= @mail.body.to_s
|
92
|
+
body = body.gsub(/<[^>]*>/, '')
|
93
|
+
body = body.gsub("_____________________________________________________________\n\n", '')
|
94
|
+
body = body.gsub(/\n/, '').gsub(/\s+/, ' ')
|
92
95
|
body = body[0, body.index(original_message_regex) || body.length].to_s
|
93
96
|
body = body.split(/\n\s*\n/m, 2)[1] || body if body.match(/\n/)
|
94
97
|
@mail.body = body.to_s.gsub(/\n/, '').strip
|
data/lib/telesms/version.rb
CHANGED
data/spec/incoming_spec.rb
CHANGED
@@ -108,14 +108,27 @@ describe Telesms::Incoming do
|
|
108
108
|
it { should eq 'Test' }
|
109
109
|
end
|
110
110
|
|
111
|
-
context "with multiple lines" do
|
112
|
-
before { params[:body] = "Test\n \n message" }
|
113
|
-
it { should eq 'message' }
|
114
|
-
end
|
115
|
-
|
116
111
|
context "with a newline" do
|
117
112
|
before { params[:body] = "Test \n message" }
|
118
|
-
it { should eq 'Test
|
113
|
+
it { should eq 'Test message' }
|
114
|
+
end
|
115
|
+
|
116
|
+
context "with HTML tags" do
|
117
|
+
before { params[:body] = "<PRE>Testing</PRE><HTML></HTML>" }
|
118
|
+
|
119
|
+
it { should eq 'Testing'}
|
120
|
+
end
|
121
|
+
|
122
|
+
context "with a signature horizontal line" do
|
123
|
+
before { params[:body] = "_____________________________________________________________\n\n Test" }
|
124
|
+
|
125
|
+
it { should eq 'Test'}
|
126
|
+
end
|
127
|
+
|
128
|
+
context "with multiple spaces" do
|
129
|
+
before { params[:body] = "Testing message" }
|
130
|
+
|
131
|
+
it { should eq 'Testing message' }
|
119
132
|
end
|
120
133
|
end
|
121
134
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: telesms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Artem Kalinchuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|