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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: babf1c806e144613d66667e128f08f6516764f67
4
- data.tar.gz: b8e84e0029ae2853e62e4a415a5ae2e85e0f03ca
3
+ metadata.gz: 444d8a5a3d0d438def9c8511a32b30e2b9ca8a85
4
+ data.tar.gz: 0f73a20afe82bb615b84a805580f25b5e951e0e9
5
5
  SHA512:
6
- metadata.gz: f697540eea663f0e2eed24a0f36fc72df6d7f58a091b6c8f5647a8189a1cce1484bcd2a96276e59fae920b4402cda2d016dbd3da08681a91e4764132f67aaadb
7
- data.tar.gz: da67b2e6843559b06a4baa0f4dc011342be41ce58d2c2292b7fcc16329efe9e3fcaa962f203662d7b40d1fef59fe38813e874c6464e0cf744841a22b08a3b75d
6
+ metadata.gz: fc8e9d3c77882b98b64d60b473ddc6075fe4eac6c484183401d26a681fd0765f932e14c9fbd0759ea771a05e1d4ac73ff142c482db5eb92eb9922e87dcec8d7d
7
+ data.tar.gz: 63aa0098e2a301e2a188042c7470c8c1ff7ef4709a6f465a53b7f917f74b5a88889b5629b84eba52aa4bdfd3f96a883bfe32122a2099cec0da486d6b31a09a18
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # Version 0.1.4 - 18 July 2014
2
+
3
+ * Add more logic to clean body.
4
+
1
5
  # Version 0.1.3 - 15 July 2014
2
6
 
3
7
  * Add more gateways
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 Telefio. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
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.
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Telesms
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
@@ -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 message' }
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.3
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-15 00:00:00.000000000 Z
11
+ date: 2014-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails