tropo_rest 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -3
- data/lib/tropo_rest/client/session.rb +3 -1
- data/lib/tropo_rest/version.rb +1 -1
- data/spec/tropo_rest/client/session_spec.rb +34 -2
- data/tropo_rest.gemspec +0 -1
- metadata +21 -97
data/README.md
CHANGED
@@ -98,10 +98,11 @@ Thanks to [Tropo](https://www.tropo.com/) for creating such an awesome service.
|
|
98
98
|
Thanks to the creators of the [twitter](https://github.com/jnunemaker/twitter/) gem, whose lovely code I shamelessly ripped off :)
|
99
99
|
|
100
100
|
|
101
|
-
|
102
|
-
|
101
|
+
Contributors
|
102
|
+
------------
|
103
103
|
|
104
|
-
* Christopher Durtschi
|
104
|
+
* [Christopher Durtschi](https://github.com/chrisdurtschi)
|
105
|
+
* [David Verhasselt](https://github.com/relix)
|
105
106
|
|
106
107
|
|
107
108
|
Copyright
|
@@ -13,7 +13,9 @@ module TropoRest
|
|
13
13
|
def create_session(token, params={})
|
14
14
|
params.merge!('token' => token)
|
15
15
|
params.merge!(params) { |k,v| v.to_s } # custom parameters must be strings
|
16
|
-
post(PLURAL_PATH, params)
|
16
|
+
response = post(PLURAL_PATH, params)
|
17
|
+
response.id = response.id.strip if response.id
|
18
|
+
response
|
17
19
|
end
|
18
20
|
|
19
21
|
end
|
data/lib/tropo_rest/version.rb
CHANGED
@@ -32,7 +32,16 @@ describe TropoRest::Client do
|
|
32
32
|
args = {'phone_number' => '+19995551234', 'name' => 'Billy Gnosis'}
|
33
33
|
params = args.merge('token' => 'TOKEN')
|
34
34
|
stub_session_post("sessions").
|
35
|
-
with(:body => params)
|
35
|
+
with(:body => params).
|
36
|
+
to_return(:body => <<-JSON
|
37
|
+
{
|
38
|
+
"success": true,
|
39
|
+
"token": "TOKEN",
|
40
|
+
"id": "ID"
|
41
|
+
}
|
42
|
+
JSON
|
43
|
+
)
|
44
|
+
|
36
45
|
@client.create_session("TOKEN", args)
|
37
46
|
a_session_post("sessions").
|
38
47
|
with(:body => params).should have_been_made
|
@@ -42,7 +51,16 @@ describe TropoRest::Client do
|
|
42
51
|
args = {'dollars' => 123.45, 'count' => 1}
|
43
52
|
params = {'dollars' => '123.45', 'count' => '1', 'token' => 'TOKEN'}
|
44
53
|
stub_session_post("sessions").
|
45
|
-
with(:body => params)
|
54
|
+
with(:body => params).
|
55
|
+
to_return(:body => <<-JSON
|
56
|
+
{
|
57
|
+
"success": true,
|
58
|
+
"token": "TOKEN",
|
59
|
+
"id": "ID"
|
60
|
+
}
|
61
|
+
JSON
|
62
|
+
)
|
63
|
+
|
46
64
|
@client.create_session("TOKEN", args)
|
47
65
|
a_session_post("sessions").
|
48
66
|
with(:body => params).should have_been_made
|
@@ -53,6 +71,20 @@ describe TropoRest::Client do
|
|
53
71
|
res.should == {'success' => true, 'token' => 'TOKEN', 'id' => 'ID'}
|
54
72
|
end
|
55
73
|
|
74
|
+
it "should strip the ID of whitespace" do
|
75
|
+
stub_session_post("sessions").
|
76
|
+
to_return(:body => <<-JSON
|
77
|
+
{
|
78
|
+
"success": true,
|
79
|
+
"token": "TOKEN",
|
80
|
+
"id": "ID\\r\\n"
|
81
|
+
}
|
82
|
+
JSON
|
83
|
+
)
|
84
|
+
res = @client.create_session("TOKEN")
|
85
|
+
res.should == {'success' => true, 'token' => 'TOKEN', 'id' => 'ID'}
|
86
|
+
end
|
87
|
+
|
56
88
|
end
|
57
89
|
|
58
90
|
end
|
data/tropo_rest.gemspec
CHANGED
@@ -20,7 +20,6 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_development_dependency "webmock", "~> 1.6.1"
|
21
21
|
s.add_development_dependency "autotest", "~> 4.3.2"
|
22
22
|
s.add_development_dependency "json", "~> 1.4"
|
23
|
-
s.add_development_dependency "nokogiri", "~> 1.4.4"
|
24
23
|
s.add_development_dependency "yard", "~> 0.6.4"
|
25
24
|
|
26
25
|
case RUBY_PLATFORM
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tropo_rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 4
|
9
|
-
version: 0.0.4
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.5
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Christopher Durtschi
|
@@ -14,7 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date: 2011-
|
13
|
+
date: 2011-03-12 23:00:00 -07:00
|
18
14
|
default_executable:
|
19
15
|
dependencies:
|
20
16
|
- !ruby/object:Gem::Dependency
|
@@ -24,10 +20,6 @@ dependencies:
|
|
24
20
|
requirements:
|
25
21
|
- - ">="
|
26
22
|
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 1
|
29
|
-
- 0
|
30
|
-
- 0
|
31
23
|
version: 1.0.0
|
32
24
|
type: :development
|
33
25
|
prerelease: false
|
@@ -39,10 +31,6 @@ dependencies:
|
|
39
31
|
requirements:
|
40
32
|
- - ~>
|
41
33
|
- !ruby/object:Gem::Version
|
42
|
-
segments:
|
43
|
-
- 0
|
44
|
-
- 8
|
45
|
-
- 7
|
46
34
|
version: 0.8.7
|
47
35
|
type: :development
|
48
36
|
prerelease: false
|
@@ -54,10 +42,6 @@ dependencies:
|
|
54
42
|
requirements:
|
55
43
|
- - ~>
|
56
44
|
- !ruby/object:Gem::Version
|
57
|
-
segments:
|
58
|
-
- 2
|
59
|
-
- 3
|
60
|
-
- 0
|
61
45
|
version: 2.3.0
|
62
46
|
type: :development
|
63
47
|
prerelease: false
|
@@ -69,10 +53,6 @@ dependencies:
|
|
69
53
|
requirements:
|
70
54
|
- - ~>
|
71
55
|
- !ruby/object:Gem::Version
|
72
|
-
segments:
|
73
|
-
- 1
|
74
|
-
- 6
|
75
|
-
- 1
|
76
56
|
version: 1.6.1
|
77
57
|
type: :development
|
78
58
|
prerelease: false
|
@@ -84,10 +64,6 @@ dependencies:
|
|
84
64
|
requirements:
|
85
65
|
- - ~>
|
86
66
|
- !ruby/object:Gem::Version
|
87
|
-
segments:
|
88
|
-
- 4
|
89
|
-
- 3
|
90
|
-
- 2
|
91
67
|
version: 4.3.2
|
92
68
|
type: :development
|
93
69
|
prerelease: false
|
@@ -99,146 +75,98 @@ dependencies:
|
|
99
75
|
requirements:
|
100
76
|
- - ~>
|
101
77
|
- !ruby/object:Gem::Version
|
102
|
-
segments:
|
103
|
-
- 1
|
104
|
-
- 4
|
105
78
|
version: "1.4"
|
106
79
|
type: :development
|
107
80
|
prerelease: false
|
108
81
|
version_requirements: *id006
|
109
|
-
- !ruby/object:Gem::Dependency
|
110
|
-
name: nokogiri
|
111
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
112
|
-
none: false
|
113
|
-
requirements:
|
114
|
-
- - ~>
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
segments:
|
117
|
-
- 1
|
118
|
-
- 4
|
119
|
-
- 4
|
120
|
-
version: 1.4.4
|
121
|
-
type: :development
|
122
|
-
prerelease: false
|
123
|
-
version_requirements: *id007
|
124
82
|
- !ruby/object:Gem::Dependency
|
125
83
|
name: yard
|
126
|
-
requirement: &
|
84
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
127
85
|
none: false
|
128
86
|
requirements:
|
129
87
|
- - ~>
|
130
88
|
- !ruby/object:Gem::Version
|
131
|
-
segments:
|
132
|
-
- 0
|
133
|
-
- 6
|
134
|
-
- 4
|
135
89
|
version: 0.6.4
|
136
90
|
type: :development
|
137
91
|
prerelease: false
|
138
|
-
version_requirements: *
|
92
|
+
version_requirements: *id007
|
139
93
|
- !ruby/object:Gem::Dependency
|
140
94
|
name: autotest-fsevent
|
141
|
-
requirement: &
|
95
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
142
96
|
none: false
|
143
97
|
requirements:
|
144
98
|
- - ~>
|
145
99
|
- !ruby/object:Gem::Version
|
146
|
-
segments:
|
147
|
-
- 0
|
148
|
-
- 2
|
149
|
-
- 4
|
150
100
|
version: 0.2.4
|
151
101
|
type: :development
|
152
102
|
prerelease: false
|
153
|
-
version_requirements: *
|
103
|
+
version_requirements: *id008
|
154
104
|
- !ruby/object:Gem::Dependency
|
155
105
|
name: autotest-growl
|
156
|
-
requirement: &
|
106
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
157
107
|
none: false
|
158
108
|
requirements:
|
159
109
|
- - ~>
|
160
110
|
- !ruby/object:Gem::Version
|
161
|
-
segments:
|
162
|
-
- 0
|
163
|
-
- 2
|
164
|
-
- 9
|
165
111
|
version: 0.2.9
|
166
112
|
type: :development
|
167
113
|
prerelease: false
|
168
|
-
version_requirements: *
|
114
|
+
version_requirements: *id009
|
169
115
|
- !ruby/object:Gem::Dependency
|
170
116
|
name: ruby-debug19
|
171
|
-
requirement: &
|
117
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
172
118
|
none: false
|
173
119
|
requirements:
|
174
120
|
- - ">="
|
175
121
|
- !ruby/object:Gem::Version
|
176
|
-
segments:
|
177
|
-
- 0
|
178
122
|
version: "0"
|
179
123
|
type: :development
|
180
124
|
prerelease: false
|
181
|
-
version_requirements: *
|
125
|
+
version_requirements: *id010
|
182
126
|
- !ruby/object:Gem::Dependency
|
183
127
|
name: faraday
|
184
|
-
requirement: &
|
128
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
185
129
|
none: false
|
186
130
|
requirements:
|
187
131
|
- - ~>
|
188
132
|
- !ruby/object:Gem::Version
|
189
|
-
segments:
|
190
|
-
- 0
|
191
|
-
- 5
|
192
|
-
- 3
|
193
133
|
version: 0.5.3
|
194
134
|
type: :runtime
|
195
135
|
prerelease: false
|
196
|
-
version_requirements: *
|
136
|
+
version_requirements: *id011
|
197
137
|
- !ruby/object:Gem::Dependency
|
198
138
|
name: faraday_middleware
|
199
|
-
requirement: &
|
139
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
200
140
|
none: false
|
201
141
|
requirements:
|
202
142
|
- - ~>
|
203
143
|
- !ruby/object:Gem::Version
|
204
|
-
segments:
|
205
|
-
- 0
|
206
|
-
- 3
|
207
|
-
- 1
|
208
144
|
version: 0.3.1
|
209
145
|
type: :runtime
|
210
146
|
prerelease: false
|
211
|
-
version_requirements: *
|
147
|
+
version_requirements: *id012
|
212
148
|
- !ruby/object:Gem::Dependency
|
213
149
|
name: multi_json
|
214
|
-
requirement: &
|
150
|
+
requirement: &id013 !ruby/object:Gem::Requirement
|
215
151
|
none: false
|
216
152
|
requirements:
|
217
153
|
- - ~>
|
218
154
|
- !ruby/object:Gem::Version
|
219
|
-
segments:
|
220
|
-
- 0
|
221
|
-
- 0
|
222
|
-
- 5
|
223
155
|
version: 0.0.5
|
224
156
|
type: :runtime
|
225
157
|
prerelease: false
|
226
|
-
version_requirements: *
|
158
|
+
version_requirements: *id013
|
227
159
|
- !ruby/object:Gem::Dependency
|
228
160
|
name: hashie
|
229
|
-
requirement: &
|
161
|
+
requirement: &id014 !ruby/object:Gem::Requirement
|
230
162
|
none: false
|
231
163
|
requirements:
|
232
164
|
- - ~>
|
233
165
|
- !ruby/object:Gem::Version
|
234
|
-
segments:
|
235
|
-
- 0
|
236
|
-
- 4
|
237
|
-
- 0
|
238
166
|
version: 0.4.0
|
239
167
|
type: :runtime
|
240
168
|
prerelease: false
|
241
|
-
version_requirements: *
|
169
|
+
version_requirements: *id014
|
242
170
|
description: A simple wrapper for the Tropo REST API to manipulate applications, addresses, exchanges, sessions.
|
243
171
|
email:
|
244
172
|
- christopher.durtschi@gmail.com
|
@@ -303,7 +231,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
303
231
|
requirements:
|
304
232
|
- - ">="
|
305
233
|
- !ruby/object:Gem::Version
|
306
|
-
hash:
|
234
|
+
hash: 1958669569557374112
|
307
235
|
segments:
|
308
236
|
- 0
|
309
237
|
version: "0"
|
@@ -312,15 +240,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
312
240
|
requirements:
|
313
241
|
- - ">="
|
314
242
|
- !ruby/object:Gem::Version
|
315
|
-
segments:
|
316
|
-
- 1
|
317
|
-
- 3
|
318
|
-
- 6
|
319
243
|
version: 1.3.6
|
320
244
|
requirements: []
|
321
245
|
|
322
246
|
rubyforge_project: tropo_rest
|
323
|
-
rubygems_version: 1.
|
247
|
+
rubygems_version: 1.6.1
|
324
248
|
signing_key:
|
325
249
|
specification_version: 3
|
326
250
|
summary: Library to interact with Tropo's REST API
|