reddavis-clickatell 0.0.0 → 0.0.1
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.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/clickatell.rb +1 -1
- data/lib/clickatell/text.rb +1 -1
- data/reddavis-clickatell.gemspec +5 -5
- data/spec/clickatell_spec.rb +23 -31
- metadata +4 -4
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ begin
|
|
11
11
|
gem.homepage = "http://github.com/reddavis/clickatell"
|
12
12
|
gem.authors = ["reddavis"]
|
13
13
|
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
-
gem.add_dependency('
|
14
|
+
gem.add_dependency('rest-client', ">= 1.0.3")
|
15
15
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
16
|
end
|
17
17
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.1
|
data/lib/clickatell.rb
CHANGED
data/lib/clickatell/text.rb
CHANGED
data/reddavis-clickatell.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{reddavis-clickatell}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["reddavis"]
|
12
|
-
s.date = %q{2009-11
|
12
|
+
s.date = %q{2009-12-11}
|
13
13
|
s.description = %q{Wrapper for clickatell.com}
|
14
14
|
s.email = %q{reddavis@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -47,14 +47,14 @@ Gem::Specification.new do |s|
|
|
47
47
|
|
48
48
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
49
49
|
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
50
|
-
s.add_runtime_dependency(%q<
|
50
|
+
s.add_runtime_dependency(%q<rest-client>, [">= 1.0.3"])
|
51
51
|
else
|
52
52
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
53
|
-
s.add_dependency(%q<
|
53
|
+
s.add_dependency(%q<rest-client>, [">= 1.0.3"])
|
54
54
|
end
|
55
55
|
else
|
56
56
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
57
|
-
s.add_dependency(%q<
|
57
|
+
s.add_dependency(%q<rest-client>, [">= 1.0.3"])
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
data/spec/clickatell_spec.rb
CHANGED
@@ -4,13 +4,12 @@ describe "Clickatell" do
|
|
4
4
|
|
5
5
|
describe "Sending Texts" do
|
6
6
|
before do
|
7
|
-
|
8
|
-
Typhoeus::Request.stub!(:get).and_return(response)
|
7
|
+
stub_rest_client(200)
|
9
8
|
@a = start_clickatell
|
10
9
|
end
|
11
10
|
|
12
11
|
it "should send text" do
|
13
|
-
|
12
|
+
RestClient.should_receive(:get)
|
14
13
|
@a.send(444, 'sometext')
|
15
14
|
end
|
16
15
|
|
@@ -21,10 +20,9 @@ describe "Clickatell" do
|
|
21
20
|
|
22
21
|
describe "Error Handling" do
|
23
22
|
|
24
|
-
|
23
|
+
describe "Authentication Fail" do
|
25
24
|
before do
|
26
|
-
|
27
|
-
Typhoeus::Request.stub!(:get).and_return(response)
|
25
|
+
stub_rest_client(001)
|
28
26
|
@a = start_clickatell
|
29
27
|
end
|
30
28
|
|
@@ -37,8 +35,7 @@ describe "Clickatell" do
|
|
37
35
|
|
38
36
|
describe "Unknown Username or Password" do
|
39
37
|
before do
|
40
|
-
|
41
|
-
Typhoeus::Request.stub!(:get).and_return(response)
|
38
|
+
stub_rest_client(002)
|
42
39
|
@a = start_clickatell
|
43
40
|
end
|
44
41
|
|
@@ -51,8 +48,7 @@ describe "Clickatell" do
|
|
51
48
|
|
52
49
|
describe "Account Frozen" do
|
53
50
|
before do
|
54
|
-
|
55
|
-
Typhoeus::Request.stub!(:get).and_return(response)
|
51
|
+
stub_rest_client(004)
|
56
52
|
@a = start_clickatell
|
57
53
|
end
|
58
54
|
|
@@ -65,8 +61,7 @@ describe "Clickatell" do
|
|
65
61
|
|
66
62
|
describe "IP Lockdown Violation" do
|
67
63
|
before do
|
68
|
-
|
69
|
-
Typhoeus::Request.stub!(:get).and_return(response)
|
64
|
+
stub_rest_client(007)
|
70
65
|
@a = start_clickatell
|
71
66
|
end
|
72
67
|
|
@@ -79,8 +74,7 @@ describe "Clickatell" do
|
|
79
74
|
|
80
75
|
describe "Invalid Number" do
|
81
76
|
before do
|
82
|
-
|
83
|
-
Typhoeus::Request.stub!(:get).and_return(response)
|
77
|
+
stub_rest_client(106)
|
84
78
|
@a = start_clickatell
|
85
79
|
end
|
86
80
|
|
@@ -93,8 +87,7 @@ describe "Clickatell" do
|
|
93
87
|
|
94
88
|
describe "Empty Message" do
|
95
89
|
before do
|
96
|
-
|
97
|
-
Typhoeus::Request.stub!(:get).and_return(response)
|
90
|
+
stub_rest_client(107)
|
98
91
|
@a = start_clickatell
|
99
92
|
end
|
100
93
|
|
@@ -107,8 +100,7 @@ describe "Clickatell" do
|
|
107
100
|
|
108
101
|
describe "Invalid Or Missing API ID" do
|
109
102
|
before do
|
110
|
-
|
111
|
-
Typhoeus::Request.stub!(:get).and_return(response)
|
103
|
+
stub_rest_client(108)
|
112
104
|
@a = start_clickatell
|
113
105
|
end
|
114
106
|
|
@@ -121,8 +113,7 @@ describe "Clickatell" do
|
|
121
113
|
|
122
114
|
describe "Message Too Long" do
|
123
115
|
before do
|
124
|
-
|
125
|
-
Typhoeus::Request.stub!(:get).and_return(response)
|
116
|
+
stub_rest_client(113)
|
126
117
|
@a = start_clickatell
|
127
118
|
end
|
128
119
|
|
@@ -135,8 +126,7 @@ describe "Clickatell" do
|
|
135
126
|
|
136
127
|
describe "Number Blocked" do
|
137
128
|
before do
|
138
|
-
|
139
|
-
Typhoeus::Request.stub!(:get).and_return(response)
|
129
|
+
stub_rest_client(121)
|
140
130
|
@a = start_clickatell
|
141
131
|
end
|
142
132
|
|
@@ -149,8 +139,7 @@ describe "Clickatell" do
|
|
149
139
|
|
150
140
|
describe "Number Delisted" do
|
151
141
|
before do
|
152
|
-
|
153
|
-
Typhoeus::Request.stub!(:get).and_return(response)
|
142
|
+
stub_rest_client(128)
|
154
143
|
@a = start_clickatell
|
155
144
|
end
|
156
145
|
|
@@ -163,8 +152,7 @@ describe "Clickatell" do
|
|
163
152
|
|
164
153
|
describe "No Credit Left" do
|
165
154
|
before do
|
166
|
-
|
167
|
-
Typhoeus::Request.stub!(:get).and_return(response)
|
155
|
+
stub_rest_client(301)
|
168
156
|
@a = start_clickatell
|
169
157
|
end
|
170
158
|
|
@@ -177,8 +165,7 @@ describe "Clickatell" do
|
|
177
165
|
|
178
166
|
describe "Max Allowed Credit" do
|
179
167
|
before do
|
180
|
-
|
181
|
-
Typhoeus::Request.stub!(:get).and_return(response)
|
168
|
+
stub_rest_client(302)
|
182
169
|
@a = start_clickatell
|
183
170
|
end
|
184
171
|
|
@@ -191,8 +178,7 @@ describe "Clickatell" do
|
|
191
178
|
|
192
179
|
describe "Unknown Error" do
|
193
180
|
before do
|
194
|
-
|
195
|
-
Typhoeus::Request.stub!(:get).and_return(response)
|
181
|
+
stub_rest_client(999)
|
196
182
|
@a = start_clickatell
|
197
183
|
end
|
198
184
|
|
@@ -211,8 +197,14 @@ describe "Clickatell" do
|
|
211
197
|
Clickatell::Text.new('username', 'password', 'api_id')
|
212
198
|
end
|
213
199
|
|
200
|
+
def stub_rest_client(code)
|
201
|
+
response = build_response(code)
|
202
|
+
RestClient.stub!(:get).and_return(response)
|
203
|
+
end
|
204
|
+
|
214
205
|
def build_response(code)
|
215
|
-
|
206
|
+
response = Struct.new(:code, :body)
|
207
|
+
response.new(code, 'body')
|
216
208
|
end
|
217
209
|
|
218
210
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reddavis-clickatell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- reddavis
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11
|
12
|
+
date: 2009-12-11 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -23,14 +23,14 @@ dependencies:
|
|
23
23
|
version: 1.2.9
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
26
|
+
name: rest-client
|
27
27
|
type: :runtime
|
28
28
|
version_requirement:
|
29
29
|
version_requirements: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.0.3
|
34
34
|
version:
|
35
35
|
description: Wrapper for clickatell.com
|
36
36
|
email: reddavis@gmail.com
|