smesser 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/smesser.rb +2 -1
- data/lib/smesser/provider.rb +4 -0
- data/lib/smesser/version.rb +1 -1
- data/test/provider.rb +4 -0
- data/test/test_smesser.rb +17 -0
- metadata +10 -8
data/lib/smesser.rb
CHANGED
@@ -44,7 +44,8 @@ module Smesser
|
|
44
44
|
provider = providers[args[:provider]].new(args[:username], args[:password])
|
45
45
|
log.debug("Provider: #{provider.inspect}")
|
46
46
|
|
47
|
-
recipients =
|
47
|
+
recipients = args[:recipients].is_a?(String) ? [args[:recipients]] : args[:recipients]
|
48
|
+
recipients = lookup_contacts(recipients)
|
48
49
|
log.debug("Recipients: #{recipients.inspect}")
|
49
50
|
|
50
51
|
unless provider.logged_in?
|
data/lib/smesser/provider.rb
CHANGED
data/lib/smesser/version.rb
CHANGED
data/test/provider.rb
ADDED
data/test/test_smesser.rb
CHANGED
@@ -1,7 +1,18 @@
|
|
1
1
|
require 'test/unit'
|
2
2
|
require 'smesser'
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'provider'))
|
3
4
|
|
4
5
|
class TestSmesser < Test::Unit::TestCase
|
6
|
+
def setup
|
7
|
+
@options = {
|
8
|
+
:provider => "dummy",
|
9
|
+
:username => "test",
|
10
|
+
:password => "secret",
|
11
|
+
:recipients => ["1234567890", "0987654321"],
|
12
|
+
:message => "Hello, world!"
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
5
16
|
def test_provider_paths
|
6
17
|
assert Smesser::Provider.paths.include?(File.expand_path(File.join(File.dirname(__FILE__), '..', 'providers')))
|
7
18
|
end
|
@@ -12,5 +23,11 @@ class TestSmesser < Test::Unit::TestCase
|
|
12
23
|
assert Smesser.config_files.include?("~/.smesserrc")
|
13
24
|
end
|
14
25
|
|
26
|
+
def test_multiple_recipients
|
27
|
+
assert_nothing_raised do
|
28
|
+
Smesser.send_message(@options.merge(:recipients => "1234567890"))
|
29
|
+
Smesser.send_message(@options.merge(:recipients => ["1234567890"]))
|
30
|
+
end
|
31
|
+
end
|
15
32
|
# TODO - loads more tests!
|
16
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smesser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-16 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &73563530 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *73563530
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: mechanize
|
27
|
-
requirement: &
|
27
|
+
requirement: &73558980 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '2.3'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *73558980
|
36
36
|
description: Send free text messages!
|
37
37
|
email:
|
38
38
|
- jj@bjjb.org
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- providers/o2_ie.rb
|
54
54
|
- providers/vodafone_ie.rb
|
55
55
|
- smesser.gemspec
|
56
|
+
- test/provider.rb
|
56
57
|
- test/test_smesser.rb
|
57
58
|
homepage: http://jjbuckley.github.com/smesser
|
58
59
|
licenses: []
|
@@ -68,7 +69,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
69
|
version: '0'
|
69
70
|
segments:
|
70
71
|
- 0
|
71
|
-
hash:
|
72
|
+
hash: 892040527
|
72
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
74
|
none: false
|
74
75
|
requirements:
|
@@ -77,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
78
|
version: '0'
|
78
79
|
segments:
|
79
80
|
- 0
|
80
|
-
hash:
|
81
|
+
hash: 892040527
|
81
82
|
requirements: []
|
82
83
|
rubyforge_project:
|
83
84
|
rubygems_version: 1.8.10
|
@@ -87,4 +88,5 @@ summary: SMeSser helps you send SMSs using various mobile provider's websites. T
|
|
87
88
|
gem comes with a binary, which helps you set up the details for your own provider,
|
88
89
|
and with a library which you can integrate into nicer front-ends.
|
89
90
|
test_files:
|
91
|
+
- test/provider.rb
|
90
92
|
- test/test_smesser.rb
|