telesms 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 31eff1455cbb782fdda385fbac4490209d9c7f70
4
+ data.tar.gz: b23557ae5e60469349d8879daee0d5fbb825a4a3
5
+ SHA512:
6
+ metadata.gz: 06a30fabf9c9c40092560ef5ab70290147ce7b6ccd8937fa5f5f717a5faf37082f90ab8cd06e689c6c38479d8837fe0db364914064ea2ead2b4203ea8c192959
7
+ data.tar.gz: db24939736b88ab9ab8adbd05e0538cd0cade89aaf69a7bef36b3e2a1a127aa6ad806414a9e610c5ce518f3112472f8b69ebd5bab633fb1918dc7c48541fe1a3
data/.autotest ADDED
@@ -0,0 +1,25 @@
1
+ # -*- ruby -*-
2
+
3
+ require "autotest/restart"
4
+
5
+ # Autotest.add_hook :initialize do |at|
6
+ # at.testlib = "minitest/unit"
7
+ #
8
+ # at.extra_files << "../some/external/dependency.rb"
9
+ #
10
+ # at.libs << ":../some/external"
11
+ #
12
+ # at.add_exception "vendor"
13
+ #
14
+ # at.add_mapping(/dependency.rb/) do |f, _|
15
+ # at.files_matching(/test_.*rb$/)
16
+ # end
17
+ #
18
+ # %w(TestA TestB).each do |klass|
19
+ # at.extra_class_map[klass] = "test/test_misc.rb"
20
+ # end
21
+ # end
22
+
23
+ # Autotest.add_hook :run_command do |at|
24
+ # system "rake build"
25
+ # end
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ doc/coverage
2
+ doc/coverage/*
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --require spec_helper
2
+ --color
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ # Version 0.1.0 - 7 April 2014
2
+
3
+ * Initial release
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in config_scripts.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,122 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ telesms (0.1.0)
5
+ mail (~> 2.5)
6
+ rails (> 3.0.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionmailer (4.0.4)
12
+ actionpack (= 4.0.4)
13
+ mail (~> 2.5.4)
14
+ actionpack (4.0.4)
15
+ activesupport (= 4.0.4)
16
+ builder (~> 3.1.0)
17
+ erubis (~> 2.7.0)
18
+ rack (~> 1.5.2)
19
+ rack-test (~> 0.6.2)
20
+ activemodel (4.0.4)
21
+ activesupport (= 4.0.4)
22
+ builder (~> 3.1.0)
23
+ activerecord (4.0.4)
24
+ activemodel (= 4.0.4)
25
+ activerecord-deprecated_finders (~> 1.0.2)
26
+ activesupport (= 4.0.4)
27
+ arel (~> 4.0.0)
28
+ activerecord-deprecated_finders (1.0.3)
29
+ activesupport (4.0.4)
30
+ i18n (~> 0.6, >= 0.6.9)
31
+ minitest (~> 4.2)
32
+ multi_json (~> 1.3)
33
+ thread_safe (~> 0.1)
34
+ tzinfo (~> 0.3.37)
35
+ arel (4.0.2)
36
+ builder (3.1.4)
37
+ diff-lcs (1.2.5)
38
+ docile (1.1.3)
39
+ erubis (2.7.0)
40
+ faker (1.3.0)
41
+ i18n (~> 0.5)
42
+ hike (1.2.3)
43
+ i18n (0.6.9)
44
+ mail (2.5.4)
45
+ mime-types (~> 1.16)
46
+ treetop (~> 1.4.8)
47
+ mime-types (1.25.1)
48
+ minitest (4.7.5)
49
+ multi_json (1.9.2)
50
+ polyglot (0.3.4)
51
+ rack (1.5.2)
52
+ rack-test (0.6.2)
53
+ rack (>= 1.0)
54
+ rails (4.0.4)
55
+ actionmailer (= 4.0.4)
56
+ actionpack (= 4.0.4)
57
+ activerecord (= 4.0.4)
58
+ activesupport (= 4.0.4)
59
+ bundler (>= 1.3.0, < 2.0)
60
+ railties (= 4.0.4)
61
+ sprockets-rails (~> 2.0.0)
62
+ railties (4.0.4)
63
+ actionpack (= 4.0.4)
64
+ activesupport (= 4.0.4)
65
+ rake (>= 0.8.7)
66
+ thor (>= 0.18.1, < 2.0)
67
+ rake (10.2.2)
68
+ rspec (2.14.1)
69
+ rspec-core (~> 2.14.0)
70
+ rspec-expectations (~> 2.14.0)
71
+ rspec-mocks (~> 2.14.0)
72
+ rspec-core (2.14.8)
73
+ rspec-expectations (2.14.5)
74
+ diff-lcs (>= 1.1.3, < 2.0)
75
+ rspec-mocks (2.14.6)
76
+ rspec-rails (2.14.2)
77
+ actionpack (>= 3.0)
78
+ activemodel (>= 3.0)
79
+ activesupport (>= 3.0)
80
+ railties (>= 3.0)
81
+ rspec-core (~> 2.14.0)
82
+ rspec-expectations (~> 2.14.0)
83
+ rspec-mocks (~> 2.14.0)
84
+ shoulda (3.5.0)
85
+ shoulda-context (~> 1.0, >= 1.0.1)
86
+ shoulda-matchers (>= 1.4.1, < 3.0)
87
+ shoulda-context (1.2.1)
88
+ shoulda-matchers (2.5.0)
89
+ activesupport (>= 3.0.0)
90
+ simplecov (0.8.2)
91
+ docile (~> 1.1.0)
92
+ multi_json
93
+ simplecov-html (~> 0.8.0)
94
+ simplecov-html (0.8.0)
95
+ sprockets (2.12.0)
96
+ hike (~> 1.2)
97
+ multi_json (~> 1.0)
98
+ rack (~> 1.0)
99
+ tilt (~> 1.1, != 1.3.0)
100
+ sprockets-rails (2.0.1)
101
+ actionpack (>= 3.0)
102
+ activesupport (>= 3.0)
103
+ sprockets (~> 2.8)
104
+ thor (0.19.1)
105
+ thread_safe (0.3.3)
106
+ tilt (1.4.1)
107
+ treetop (1.4.15)
108
+ polyglot
109
+ polyglot (>= 0.3.1)
110
+ tzinfo (0.3.39)
111
+
112
+ PLATFORMS
113
+ ruby
114
+
115
+ DEPENDENCIES
116
+ bundler (~> 1.3)
117
+ faker (~> 1.3)
118
+ rspec (~> 2.14)
119
+ rspec-rails (~> 2.14)
120
+ shoulda (~> 3.5)
121
+ simplecov (~> 0.8)
122
+ telesms!
data/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # TeleSMS
2
+
3
+ TeleSMS is a library for sending and receiving SMS messages with emails.
4
+ It uses carrier-provided email-to-sms gateways to send and receive messages.
5
+ To see a list of gateways, visit https://web.archive.org/web/20130906122931/http://en.wikipedia.org/wiki/List_of_SMS_gateways.
6
+
7
+ The purpose of this library is to encapsulate the code for sending and receiving
8
+ email-to-sms messages since there are many edge cases. The goal is to maintain
9
+ the configuration and parsers to reduce the number of failed messages.
10
+
11
+ http://www.telefio.com
12
+
13
+ ## Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ gem 'telesms'
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install telesms
26
+
27
+ ## Usage
28
+
29
+ To send a message:
30
+
31
+ # Order: FROM, TO, PROVIDER, BODY
32
+ Telesms::Outgoing.deliver('john@example.com', '555555555', 'Verizon', 'Message body')
33
+
34
+ To receive and parse a message:
35
+
36
+ Telesms::Incoming.receive(params[:mail])
37
+ # => { from: '555555555', to: 'john@example.com', body: 'Message body', provider: 'Verizon' }
38
+
39
+ To get a list of available gateways:
40
+
41
+ Telesms::Base.gateways
42
+ # => { 'AT&T' => { sms: 'att.com', mms: 'mmode.com'}, ... }
43
+
44
+ ## LICENSE:
45
+
46
+ (The MIT License)
47
+
48
+ Copyright (c) 2014 Telefio
49
+
50
+ Permission is hereby granted, free of charge, to any person obtaining
51
+ a copy of this software and associated documentation files (the
52
+ 'Software'), to deal in the Software without restriction, including
53
+ without limitation the rights to use, copy, modify, merge, publish,
54
+ distribute, sublicense, and/or sell copies of the Software, and to
55
+ permit persons to whom the Software is furnished to do so, subject to
56
+ the following conditions:
57
+
58
+ The above copyright notice and this permission notice shall be
59
+ included in all copies or substantial portions of the Software.
60
+
61
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
62
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
63
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
64
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
65
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
66
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
67
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,45 @@
1
+ 'Alltel':
2
+ :sms: message.alltel.com
3
+ 'Ameritech':
4
+ :sms: paging.acswireless.com
5
+ 'AT&T':
6
+ :sms: txt.att.net
7
+ :mms: mms.att.net
8
+ 'Bell Atlantic':
9
+ :sms: message.bam.com
10
+ 'Bellsouth Mobility':
11
+ :sms: blsdcs.net
12
+ 'BlueSkyFrog':
13
+ :sms: blueskyfrog.com
14
+ 'Boost Mobile':
15
+ :sms: myboostmobile.com
16
+ 'Cellular South':
17
+ :sms: csouth1.com
18
+ 'Cingular':
19
+ :sms: cingularme.com
20
+ 'Comcast PCS':
21
+ :sms: comcastpcs.textmsg.com
22
+ 'Cricket':
23
+ :sms: sms.mycricket.com
24
+ 'Kajeet':
25
+ :sms: mobile.kajeet.net
26
+ 'Metro PCS':
27
+ :sms: mymetropcs.com
28
+ 'Nextel':
29
+ :sms: messaging.nextel.com
30
+ 'Ntelos':
31
+ :sms: pcs.ntelos.com
32
+ 'Powertel':
33
+ :sms: ptel.net
34
+ 'Sprint':
35
+ :sms: messaging.sprintpcs.com
36
+ :mms: pm.sprint.com
37
+ 'T-Mobile':
38
+ :sms: tmomail.net
39
+ 'Verizon':
40
+ :sms: vtext.com
41
+ :mms: vzwpix.com
42
+ 'Virgin Mobile Canada':
43
+ :sms: vmobile.ca
44
+ 'Virgin Mobile USA':
45
+ :sms: vmobl.com
@@ -0,0 +1,11 @@
1
+ module Telesms
2
+ # This module contains shared resources.
3
+ module Base
4
+ # This method retrieves all the gateways from the config file.
5
+ #
6
+ # @return [Hash]
7
+ def self.gateways
8
+ YAML.load_file(File.join(File.dirname(__FILE__), '..', '..', 'config', 'gateways.yml'))
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,105 @@
1
+ module Telesms
2
+ # This class represents an incoming message.
3
+ class Incoming
4
+ extend Base
5
+
6
+ # @return [Mail::Message]
7
+ # The mail message created from the params.
8
+ attr_reader :mail
9
+
10
+ # This method receives a mail param and parses it.
11
+ #
12
+ # @param [Hash] params
13
+ # The params from the mail received.
14
+ #
15
+ # @return [Hash]
16
+ def self.receive(params)
17
+ self.new(params).parse
18
+ end
19
+
20
+ # This method creates a new incoming message and parses it.
21
+ #
22
+ # @param [Hash] params
23
+ # The params from the mail received.
24
+ #
25
+ # @return [Incoming]
26
+ def initialize(params)
27
+ @mail = Mail.new(params)
28
+ parse
29
+ end
30
+
31
+ # This method parses the received mail param.
32
+ #
33
+ # @return [Hash]
34
+ # * +from+: The number who is sending the message.
35
+ # * +to+: Who the message is for.
36
+ # * +body+: The clean body.
37
+ # * +provider+: Name of the provider.
38
+ def parse
39
+ clean_body!
40
+
41
+ {
42
+ from: from,
43
+ to: to,
44
+ body: body,
45
+ provider: provider
46
+ }
47
+ end
48
+
49
+ # This method gets the receiver of the message.
50
+ #
51
+ # @return [String]
52
+ def to
53
+ @mail.to.first
54
+ end
55
+
56
+ # This method gets the number that is sending the message.
57
+ #
58
+ # @return [String]
59
+ def from
60
+ @mail.from.first.to_s.match(/(.*)\@/)[1] rescue nil
61
+ end
62
+
63
+ # This method gets the body of the message.
64
+ #
65
+ # @return [String]
66
+ def body
67
+ @mail.body.to_s[0,160]
68
+ end
69
+
70
+ # This method gets the gateway host from the FROM field.
71
+ #
72
+ # @return [String]
73
+ def gateway_host
74
+ @mail.from.first.to_s.match(/\@(.*)/)[1] rescue nil
75
+ end
76
+
77
+ # This method gets the provider name from the FROM field.
78
+ #
79
+ # @return [String]
80
+ def provider
81
+ Base.gateways.select do |name,gateways|
82
+ [gateways[:sms], gateways[:mms]].include? gateway_host
83
+ end.keys.first
84
+ end
85
+
86
+ # This method cleans the body that was received.
87
+ #
88
+ # @return [Boolean]
89
+ def clean_body!
90
+ body = @mail.parts.last.body.decoded if @mail.multipart?
91
+ body ||= @mail.body.to_s
92
+ body = body[0, body.index(original_message_regex) || body.length].to_s
93
+ body = body.split(/\n\s*\n/m, 2)[1] || body if body.match(/\n/)
94
+ @mail.body = body.to_s.gsub(/\n/, '').strip
95
+ return true
96
+ end
97
+
98
+ # This method is the original message regex.
99
+ #
100
+ # @return [Regexp]
101
+ def original_message_regex
102
+ /(-----Original Message-----)/
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,84 @@
1
+ module Telesms
2
+ # This class represents an outgoing message.
3
+ class Outgoing
4
+ extend Base
5
+
6
+ # @return [String]
7
+ # The FROM address.
8
+ attr_accessor :from
9
+
10
+ # @return [String]
11
+ # The TO address (will be concatinated with a provider).
12
+ attr_accessor :to
13
+
14
+ # @return [String]
15
+ # The provider for the number.
16
+ attr_accessor :provider
17
+
18
+ # @return [String]
19
+ # The message body being sent.
20
+ attr_accessor :message
21
+
22
+ # This method creates a new outgoing message and sends it.
23
+ #
24
+ # @param [String] from
25
+ # The FROM address.
26
+ #
27
+ # @param [String] to
28
+ # The TO address.
29
+ #
30
+ # @param [String] provider
31
+ # The provider name.
32
+ #
33
+ # @param [String] message
34
+ # The message being sent.
35
+ #
36
+ # @return [Mail]
37
+ def self.deliver(from, to, provider, message)
38
+ self.new(from, to, provider, message).deliver
39
+ end
40
+
41
+ # This method creates a new outgoing message.
42
+ #
43
+ # @param [String] from
44
+ # The FROM address.
45
+ #
46
+ # @param [String] to
47
+ # The TO address.
48
+ #
49
+ # @param [String] provider
50
+ # The provider name.
51
+ #
52
+ # @param [String] message
53
+ # The message being sent.
54
+ #
55
+ # @return [Outgoing]
56
+ def initialize(from, to, provider, message)
57
+ @from = from
58
+ @to = to
59
+ @provider = provider
60
+ @message = message
61
+ end
62
+
63
+ # This method sends an email message disguised as an SMS message.
64
+ #
65
+ # @return [Mail]
66
+ def deliver
67
+ Mail.new(from: from, to: formatted_to, body: sanitized_message).deliver!
68
+ end
69
+
70
+ # This method formats the TO address to include the provider.
71
+ #
72
+ # @return [String]
73
+ def formatted_to
74
+ "#{to}@#{Base.gateways[@provider][:sms_gateway]}"
75
+ end
76
+
77
+ # This method sanitizes the message body.
78
+ #
79
+ # @return [String]
80
+ def sanitized_message
81
+ message.to_s[0,140]
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,3 @@
1
+ module Telesms
2
+ VERSION = '0.1.0'
3
+ end
data/lib/telesms.rb ADDED
@@ -0,0 +1,9 @@
1
+ # This module encapsulates all of the code for the telesms gem.
2
+ module Telesms
3
+ end
4
+
5
+ require 'mail'
6
+ require 'telesms/version'
7
+ require 'telesms/base'
8
+ require 'telesms/outgoing'
9
+ require 'telesms/incoming'
data/spec/base_spec.rb ADDED
@@ -0,0 +1,10 @@
1
+ describe Telesms::Base do
2
+ let(:klass) { Telesms::Base }
3
+
4
+ describe ".gateways" do
5
+ subject { klass.gateways }
6
+
7
+ it { should be_a Hash }
8
+ it { should include({ 'Verizon' => { sms: 'vtext.com', mms: 'vswpix.com' }}) }
9
+ end
10
+ end
@@ -0,0 +1,126 @@
1
+ describe Telesms::Incoming do
2
+ let(:klass) { Telesms::Incoming }
3
+ let(:params) {{
4
+ from: ['555555555@vtext.com'],
5
+ to: ['444444444@example.com'],
6
+ body: Faker::Lorem.sentence
7
+ }}
8
+ let(:incoming_message) { klass.new(params) }
9
+
10
+ describe "class methods" do
11
+ describe ".receive" do
12
+ subject { klass }
13
+
14
+ before do
15
+ klass.stub new: incoming_message
16
+ incoming_message.stub(:parse)
17
+ klass.receive(params)
18
+ end
19
+
20
+ it { should have_received(:new).with(params) }
21
+ it { expect(incoming_message).to have_received(:parse) }
22
+ end
23
+ end
24
+
25
+ describe "initialize" do
26
+ before do
27
+ Mail.stub(:new).and_call_original
28
+ incoming_message
29
+ end
30
+
31
+ it { expect(incoming_message.mail).to be_a Mail::Message }
32
+ it { expect(Mail).to have_received(:new).with(params) }
33
+ end
34
+
35
+ describe "parse" do
36
+ subject { incoming_message.parse }
37
+
38
+ before do
39
+ incoming_message.stub(:clean_body!).and_call_original
40
+ subject
41
+ end
42
+
43
+ it { expect(incoming_message).to have_received(:clean_body!) }
44
+ it { should include({ from: incoming_message.from }) }
45
+ it { should include({ to: incoming_message.to }) }
46
+ it { should include({ body: incoming_message.body }) }
47
+ it { should include({ provider: incoming_message.provider }) }
48
+ end
49
+
50
+ describe "to" do
51
+ subject { incoming_message.to }
52
+ it { should eq params[:to][0] }
53
+ end
54
+
55
+ describe "from" do
56
+ subject { incoming_message.from }
57
+ it { should eq '555555555' }
58
+ end
59
+
60
+ describe "body" do
61
+ subject { incoming_message.body }
62
+ it { should eq params[:body] }
63
+ end
64
+
65
+ describe "gateway_host" do
66
+ subject { incoming_message.gateway_host }
67
+
68
+ context "when email is valid" do
69
+ it { should eq 'vtext.com' }
70
+ end
71
+
72
+ context "when email is invalid" do
73
+ before { params[:from] = nil }
74
+ it { should be_nil }
75
+ end
76
+ end
77
+
78
+ describe "provider" do
79
+ subject { incoming_message.provider }
80
+
81
+ context "with a matching sms gateway" do
82
+ it { should eq 'Verizon' }
83
+ end
84
+
85
+ context "with a matching mms gateway" do
86
+ before { params[:from] = '555555555@mmode.com' }
87
+ it { should eq 'AT&T' }
88
+ end
89
+
90
+ context "with no matching gateways" do
91
+ before { params[:from] = 'fake@fake.com' }
92
+ it { should be_nil }
93
+ end
94
+ end
95
+
96
+ describe "clean_body!" do
97
+ subject do
98
+ incoming_message.clean_body!
99
+ incoming_message.body
100
+ end
101
+
102
+ context "with a clean body" do
103
+ it { should eq params[:body] }
104
+ end
105
+
106
+ context "with an original message" do
107
+ before { params[:body] = "Test -----Original Message----- message" }
108
+ it { should eq 'Test' }
109
+ end
110
+
111
+ context "with multiple lines" do
112
+ before { params[:body] = "Test\n \n message" }
113
+ it { should eq 'message' }
114
+ end
115
+
116
+ context "with a newline" do
117
+ before { params[:body] = "Test \n message" }
118
+ it { should eq 'Test message' }
119
+ end
120
+ end
121
+
122
+ describe "original_message_regex" do
123
+ subject { incoming_message.original_message_regex }
124
+ it { should eq /(-----Original Message-----)/ }
125
+ end
126
+ end
@@ -0,0 +1,49 @@
1
+ describe Telesms::Outgoing do
2
+ let(:klass) { Telesms::Outgoing }
3
+ let(:from) { Faker::Internet.email }
4
+ let(:to) { Faker::Base.numerify('##########') }
5
+ let(:provider) { 'AT&T' }
6
+ let(:message) { Faker::Lorem.sentence }
7
+ let(:outgoing_message) { klass.new(from, to, provider, message) }
8
+
9
+ describe "class methods" do
10
+ describe ".deliver" do
11
+ subject { klass }
12
+
13
+ before do
14
+ klass.stub new: outgoing_message
15
+ outgoing_message.stub(:deliver)
16
+ klass.deliver(from, to, provider, message)
17
+ end
18
+
19
+ it { should have_received(:new).with(from, to, provider, message) }
20
+ it { expect(outgoing_message).to have_received(:deliver) }
21
+ end
22
+ end
23
+
24
+ describe "initialize" do
25
+ subject { klass.new(from, to, provider, message) }
26
+ it { expect(subject.from).not_to be_blank }
27
+ it { expect(subject.to).not_to be_blank }
28
+ it { expect(subject.provider).not_to be_blank }
29
+ it { expect(subject.message).not_to be_blank }
30
+ end
31
+
32
+ describe "deliver" do
33
+ subject { outgoing_message.deliver }
34
+ it { should have_sent_email }
35
+ it { should have_sent_email.from(from) }
36
+ it { should have_sent_email.to(outgoing_message.formatted_to) }
37
+ it { should have_sent_email.with_body(message) }
38
+ end
39
+
40
+ describe "formatted_to" do
41
+ subject { outgoing_message.formatted_to }
42
+ it { should match /#{to}\@(.*)/ }
43
+ end
44
+
45
+ describe "sanitized_message" do
46
+ subject { outgoing_message.sanitized_message }
47
+ it { should eq outgoing_message.message }
48
+ end
49
+ end
@@ -0,0 +1,34 @@
1
+ require 'bundler/setup'
2
+ require 'simplecov'
3
+ require 'mail'
4
+
5
+ Bundler.setup
6
+
7
+ SimpleCov.start do
8
+ coverage_dir 'doc/coverage'
9
+ add_filter 'spec'
10
+ end
11
+
12
+ Mail.defaults do
13
+ delivery_method :test
14
+ end
15
+
16
+ ENV["RAILS_ENV"] ||= 'test'
17
+
18
+ require 'telesms'
19
+ require 'rspec'
20
+ require 'rspec/autorun'
21
+ require 'faker'
22
+
23
+ RSpec.configure do |config|
24
+ config.treat_symbols_as_metadata_keys_with_true_values = true
25
+ config.run_all_when_everything_filtered = true
26
+ config.filter_run :focus
27
+
28
+ # Run specs in random order to surface order dependencies. If you find an
29
+ # order dependency and want to debug it, you can fix the order by providing
30
+ # the seed, which is printed after each run.
31
+ # --seed 1234
32
+ config.order = 'random'
33
+ config.include Mail::Matchers
34
+ end
data/telesms.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'telesms/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "telesms"
7
+ spec.version = Telesms::VERSION
8
+ spec.authors = ["Artem Kalinchuk"]
9
+ spec.email = ["artem9@gmail.com"]
10
+ spec.description = "Library for sending and receiving SMS messages with emails."
11
+ spec.summary = "Send and received formatted SMS messages using email messages."
12
+ spec.license = "MIT"
13
+
14
+ spec.files = `git ls-files`.split($/)
15
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
+ spec.require_paths = ["lib"]
17
+
18
+ spec.add_dependency "rails", "> 3.0.0"
19
+ spec.add_dependency "mail", "~> 2.5"
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "simplecov", "~> 0.8"
23
+ spec.add_development_dependency "rspec", "~> 2.14"
24
+ spec.add_development_dependency "rspec-rails", "~> 2.14"
25
+ spec.add_development_dependency "shoulda", "~> 3.5"
26
+ spec.add_development_dependency "faker", "~> 1.3"
27
+ end
metadata ADDED
@@ -0,0 +1,179 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: telesms
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Artem Kalinchuk
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">"
18
+ - !ruby/object:Gem::Version
19
+ version: 3.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">"
25
+ - !ruby/object:Gem::Version
26
+ version: 3.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: mail
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.5'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: simplecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.8'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.8'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.14'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.14'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.14'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.14'
97
+ - !ruby/object:Gem::Dependency
98
+ name: shoulda
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.5'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.5'
111
+ - !ruby/object:Gem::Dependency
112
+ name: faker
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.3'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '1.3'
125
+ description: Library for sending and receiving SMS messages with emails.
126
+ email:
127
+ - artem9@gmail.com
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".autotest"
133
+ - ".gitignore"
134
+ - ".rspec"
135
+ - CHANGELOG.md
136
+ - Gemfile
137
+ - Gemfile.lock
138
+ - README.md
139
+ - config/gateways.yml
140
+ - lib/telesms.rb
141
+ - lib/telesms/base.rb
142
+ - lib/telesms/incoming.rb
143
+ - lib/telesms/outgoing.rb
144
+ - lib/telesms/version.rb
145
+ - spec/base_spec.rb
146
+ - spec/incoming_spec.rb
147
+ - spec/outgoing_spec.rb
148
+ - spec/spec_helper.rb
149
+ - telesms.gemspec
150
+ homepage:
151
+ licenses:
152
+ - MIT
153
+ metadata: {}
154
+ post_install_message:
155
+ rdoc_options: []
156
+ require_paths:
157
+ - lib
158
+ required_ruby_version: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ required_rubygems_version: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ requirements: []
169
+ rubyforge_project:
170
+ rubygems_version: 2.2.1
171
+ signing_key:
172
+ specification_version: 4
173
+ summary: Send and received formatted SMS messages using email messages.
174
+ test_files:
175
+ - spec/base_spec.rb
176
+ - spec/incoming_spec.rb
177
+ - spec/outgoing_spec.rb
178
+ - spec/spec_helper.rb
179
+ has_rdoc: