geoloqi 0.9.16 → 0.9.17
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +10 -0
- data/geoloqi.gemspec +4 -2
- data/lib/geoloqi.rb +2 -1
- data/lib/geoloqi/session.rb +2 -2
- data/lib/geoloqi/version.rb +1 -1
- data/spec/geoloqi_spec.rb +158 -120
- metadata +34 -11
data/Rakefile
ADDED
data/geoloqi.gemspec
CHANGED
@@ -15,9 +15,11 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.required_rubygems_version = '>= 1.3.4'
|
16
16
|
|
17
17
|
s.add_dependency 'json'
|
18
|
-
s.add_dependency 'faraday',
|
18
|
+
s.add_dependency 'faraday', '>= 0.6.1'
|
19
|
+
s.add_dependency 'addressable', '>= 0'
|
19
20
|
|
20
|
-
s.add_development_dependency '
|
21
|
+
s.add_development_dependency 'rake', '>= 0'
|
22
|
+
s.add_development_dependency 'wrong', '= 0.5.0'
|
21
23
|
s.add_development_dependency 'minitest', '= 2.2.2'
|
22
24
|
s.add_development_dependency 'webmock', '= 1.6.4'
|
23
25
|
s.add_development_dependency 'hashie', '= 1.0.0'
|
data/lib/geoloqi.rb
CHANGED
@@ -3,6 +3,7 @@ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
|
3
3
|
require 'json'
|
4
4
|
require 'faraday'
|
5
5
|
require 'logger'
|
6
|
+
require 'addressable/uri'
|
6
7
|
require 'geoloqi/config'
|
7
8
|
require 'geoloqi/error'
|
8
9
|
require 'geoloqi/response'
|
@@ -28,4 +29,4 @@ module Geoloqi
|
|
28
29
|
url += "&#{Rack::Utils.build_query opts}" unless opts.empty?
|
29
30
|
url
|
30
31
|
end
|
31
|
-
end
|
32
|
+
end
|
data/lib/geoloqi/session.rb
CHANGED
@@ -27,8 +27,8 @@ module Geoloqi
|
|
27
27
|
!access_token.nil?
|
28
28
|
end
|
29
29
|
|
30
|
-
def authorize_url(redirect_uri=@config.redirect_uri)
|
31
|
-
Geoloqi.authorize_url @config.client_id, redirect_uri
|
30
|
+
def authorize_url(redirect_uri=@config.redirect_uri, opts={})
|
31
|
+
Geoloqi.authorize_url @config.client_id, redirect_uri, opts
|
32
32
|
end
|
33
33
|
|
34
34
|
def get(path, query=nil)
|
data/lib/geoloqi/version.rb
CHANGED
data/spec/geoloqi_spec.rb
CHANGED
@@ -1,13 +1,28 @@
|
|
1
|
-
raise ArgumentError, 'usage: be ruby spec/geoloqi_spec.rb "client_id" "client_secret" "access_token"' unless ARGV.length == 3
|
2
1
|
# Bundler.setup
|
3
2
|
require 'rubygems'
|
4
3
|
require './lib/geoloqi.rb'
|
5
4
|
require 'minitest/autorun'
|
6
5
|
require 'wrong'
|
7
6
|
require 'wrong/adapters/minitest'
|
7
|
+
require 'em-http-request' if RUBY_VERSION[0..2].to_f >= 1.9 # Preload for WebMock
|
8
8
|
require 'webmock'
|
9
|
+
require 'webmock/http_lib_adapters/em_http_request'
|
10
|
+
|
11
|
+
CLIENT_ID = 'client_id1234'
|
12
|
+
CLIENT_SECRET = 'client_secret1234'
|
13
|
+
ACCESS_TOKEN = 'access_token1234'
|
14
|
+
|
15
|
+
def auth_headers(access_token='access_token1234')
|
16
|
+
{'Content-Type' => 'application/json',
|
17
|
+
'User-Agent' => "geoloqi-ruby #{Geoloqi.version}",
|
18
|
+
'Accept' => 'application/json',
|
19
|
+
'Authorization' => "OAuth #{access_token}"}
|
20
|
+
end
|
21
|
+
|
22
|
+
def api_url(path); "#{Geoloqi::API_URL}/#{Geoloqi::API_VERSION}/#{path}" end
|
9
23
|
|
10
24
|
Wrong.config.alias_assert :expect
|
25
|
+
include WebMock::API
|
11
26
|
|
12
27
|
describe Geoloqi do
|
13
28
|
it 'reads geoloqi config' do
|
@@ -17,21 +32,23 @@ describe Geoloqi do
|
|
17
32
|
expect { Geoloqi.config.client_secret == 'client_secret' }
|
18
33
|
end
|
19
34
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
+
describe 'authorize_url' do
|
36
|
+
it 'is valid' do
|
37
|
+
authorize_url = Geoloqi.authorize_url 'test', 'http://blah.blah/test'
|
38
|
+
expect { authorize_url == "#{Geoloqi::OAUTH_URL}?"+
|
39
|
+
'response_type=code&'+
|
40
|
+
"client_id=#{Rack::Utils.escape 'test'}&"+
|
41
|
+
"redirect_uri=#{Rack::Utils.escape 'http://blah.blah/test'}" }
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'is valid with scope' do
|
45
|
+
authorize_url = Geoloqi.authorize_url 'test', 'http://blah.blah/test', :scope => 'can_party_hard'
|
46
|
+
expect { authorize_url == "#{Geoloqi::OAUTH_URL}?"+
|
47
|
+
'response_type=code&'+
|
48
|
+
"client_id=#{Rack::Utils.escape 'test'}&"+
|
49
|
+
"redirect_uri=#{Rack::Utils.escape 'http://blah.blah/test'}&"+
|
50
|
+
"scope=can_party_hard" }
|
51
|
+
end
|
35
52
|
end
|
36
53
|
end
|
37
54
|
|
@@ -48,7 +65,7 @@ end
|
|
48
65
|
describe Geoloqi::Config do
|
49
66
|
describe 'with redirect_uri' do
|
50
67
|
it 'returns authorize url' do
|
51
|
-
Geoloqi.config :client_id =>
|
68
|
+
Geoloqi.config :client_id => CLIENT_ID, :client_secret => CLIENT_SECRET, :redirect_uri => 'http://blah.blah/test'
|
52
69
|
authorize_url = Geoloqi.authorize_url 'test'
|
53
70
|
expect { authorize_url == "#{Geoloqi::OAUTH_URL}?"+
|
54
71
|
'response_type=code&'+
|
@@ -71,10 +88,6 @@ describe Geoloqi::Config do
|
|
71
88
|
end
|
72
89
|
|
73
90
|
describe Geoloqi::Session do
|
74
|
-
before do
|
75
|
-
WebMock.allow_net_connect!
|
76
|
-
end
|
77
|
-
|
78
91
|
describe 'with nothing passed' do
|
79
92
|
before do
|
80
93
|
@session = Geoloqi::Session.new
|
@@ -87,6 +100,10 @@ describe Geoloqi::Session do
|
|
87
100
|
|
88
101
|
describe 'with access token and throw exceptions not set' do
|
89
102
|
it 'should throw api error exception' do
|
103
|
+
stub_request(:get, api_url('badmethodcall')).
|
104
|
+
with(:headers => auth_headers).
|
105
|
+
to_return(:status => 404, :body => {'error' => 'not_found'}.to_json)
|
106
|
+
|
90
107
|
expect { rescuing {Geoloqi::Session.new(:access_token => 'access_token1234').get('badmethodcall')}.class == Geoloqi::ApiError }
|
91
108
|
end
|
92
109
|
end
|
@@ -95,7 +112,12 @@ describe Geoloqi::Session do
|
|
95
112
|
before do
|
96
113
|
@session = Geoloqi::Session.new :access_token => 'access_token1234', :config => {:throw_exceptions => false}
|
97
114
|
end
|
115
|
+
|
98
116
|
it 'should not throw api error exception' do
|
117
|
+
stub_request(:get, api_url('badmethodcall')).
|
118
|
+
with(:headers => auth_headers).
|
119
|
+
to_return(:status => 404, :body => {'error' => 'not_found'}.to_json)
|
120
|
+
|
99
121
|
response = @session.get 'badmethodcall'
|
100
122
|
expect {response['error'] == 'not_found'}
|
101
123
|
end
|
@@ -107,6 +129,10 @@ describe Geoloqi::Session do
|
|
107
129
|
end
|
108
130
|
|
109
131
|
it 'should respond to method calls in addition to hash' do
|
132
|
+
stub_request(:get, api_url('account/username')).
|
133
|
+
with(:headers => {'Authorization'=>'OAuth access_token1234'}).
|
134
|
+
to_return(:body => {'username' => 'bulbasaurrulzok'}.to_json)
|
135
|
+
|
110
136
|
response = @session.get 'account/username'
|
111
137
|
expect { response['username'] == 'bulbasaurrulzok' }
|
112
138
|
expect { response.username == 'bulbasaurrulzok' }
|
@@ -116,22 +142,46 @@ describe Geoloqi::Session do
|
|
116
142
|
|
117
143
|
describe 'with access token and no config' do
|
118
144
|
before do
|
119
|
-
@session = Geoloqi::Session.new :access_token =>
|
145
|
+
@session = Geoloqi::Session.new :access_token => ACCESS_TOKEN
|
120
146
|
end
|
121
147
|
|
122
148
|
it 'successfully makes mock call with array' do
|
149
|
+
stub_request(:post, api_url('play_record_at_geoloqi_hq')).
|
150
|
+
with(:headers => auth_headers, :body => [{:artist => 'Television'}].to_json).
|
151
|
+
to_return(:body => {'result' => 'ok'}.to_json)
|
152
|
+
|
123
153
|
expect { @session.post('play_record_at_geoloqi_hq', [{:artist => 'Television'}])['result'] == 'ok' }
|
124
154
|
end
|
125
155
|
|
126
156
|
it 'successfully makes call to api with forward slash' do
|
157
|
+
stub_request(:get, api_url('layer/info/Gx')).
|
158
|
+
with(:headers => auth_headers).
|
159
|
+
to_return(:status => 200, :body => {'layer_id' => 'Gx'}.to_json)
|
160
|
+
|
127
161
|
expect { @session.get('/layer/info/Gx')['layer_id'] == 'Gx' }
|
128
162
|
end
|
129
163
|
|
130
164
|
it 'successfully makes call to api without forward slash' do
|
165
|
+
stub_request(:get, api_url('layer/info/Gx')).
|
166
|
+
with(:headers => auth_headers).
|
167
|
+
to_return(:status => 200, :body => {'layer_id' => 'Gx'}.to_json)
|
168
|
+
|
131
169
|
expect { @session.get('layer/info/Gx')['layer_id'] == 'Gx' }
|
132
170
|
end
|
133
171
|
|
134
172
|
it 'creates a layer, reads its info, and then deletes the layer' do
|
173
|
+
stub_request(:post, api_url('layer/create')).
|
174
|
+
with(:headers => auth_headers, :body => {:name => 'Test Layer'}.to_json).
|
175
|
+
to_return(:status => 200, :body => {:layer_id => 'layer_id1234'}.to_json)
|
176
|
+
|
177
|
+
stub_request(:get, api_url('layer/info/layer_id1234')).
|
178
|
+
with(:headers => auth_headers).
|
179
|
+
to_return(:status => 200, :body => {:name => 'Test Layer'}.to_json)
|
180
|
+
|
181
|
+
stub_request(:post, api_url('layer/delete/layer_id1234')).
|
182
|
+
with(:headers => {'Accept'=>'application/json', 'Authorization'=>'OAuth access_token1234', 'Content-Length'=>'0', 'Content-Type'=>'application/json', 'User-Agent'=>'geoloqi-ruby 0.9.16'}).
|
183
|
+
to_return(:status => 200, :body => {'result' => 'ok'}.to_json)
|
184
|
+
|
135
185
|
layer_id = @session.post('/layer/create', :name => 'Test Layer')['layer_id']
|
136
186
|
layer_info = @session.get "/layer/info/#{layer_id}"
|
137
187
|
layer_delete = @session.post "/layer/delete/#{layer_id}"
|
@@ -142,25 +192,34 @@ describe Geoloqi::Session do
|
|
142
192
|
expect { layer_delete['result'] == 'ok' }
|
143
193
|
end
|
144
194
|
|
145
|
-
|
146
|
-
|
147
|
-
|
195
|
+
describe 'location/history' do
|
196
|
+
before do
|
197
|
+
stub_request(:get, api_url('location/history?count=2')).
|
198
|
+
with(:headers => auth_headers).
|
199
|
+
to_return(:status => 200, :body => {:points => [1,2]}.to_json)
|
200
|
+
end
|
148
201
|
|
149
|
-
|
150
|
-
|
151
|
-
|
202
|
+
it 'makes a location/history call with get and hash params' do
|
203
|
+
expect { @session.get('location/history', :count => 2)['points'].count == 2 }
|
204
|
+
end
|
205
|
+
|
206
|
+
it 'makes a location/history call with get and query string directly in path' do
|
207
|
+
expect { @session.get('location/history?count=2')['points'].count == 2 }
|
208
|
+
end
|
152
209
|
|
153
|
-
|
154
|
-
|
210
|
+
it 'makes a location/history call with get and query string params' do
|
211
|
+
expect { @session.get('location/history', 'count=2')['points'].count == 2 }
|
212
|
+
end
|
155
213
|
end
|
156
214
|
end
|
157
215
|
|
158
216
|
describe 'with oauth id, secret, and access token via Geoloqi::Config' do
|
159
217
|
it 'should load config' do
|
160
|
-
@session = Geoloqi::Session.new :access_token =>
|
161
|
-
|
162
|
-
|
163
|
-
expect { @session.config.
|
218
|
+
@session = Geoloqi::Session.new :access_token => ACCESS_TOKEN,
|
219
|
+
:config => Geoloqi::Config.new(:client_id => CLIENT_ID,
|
220
|
+
:client_secret => CLIENT_SECRET)
|
221
|
+
expect { @session.config.client_id == CLIENT_ID }
|
222
|
+
expect { @session.config.client_secret == CLIENT_SECRET }
|
164
223
|
end
|
165
224
|
end
|
166
225
|
|
@@ -173,7 +232,7 @@ describe Geoloqi::Session do
|
|
173
232
|
end
|
174
233
|
describe 'with em synchrony adapter and access token' do
|
175
234
|
it 'makes call to api' do
|
176
|
-
session = Geoloqi::Session.new :access_token =>
|
235
|
+
session = Geoloqi::Session.new :access_token => ACCESS_TOKEN, :config => {:adapter => :em_synchrony}
|
177
236
|
response = session.get 'layer/info/Gx'
|
178
237
|
expect { response['layer_id'] == 'Gx' }
|
179
238
|
end
|
@@ -182,11 +241,13 @@ describe Geoloqi::Session do
|
|
182
241
|
|
183
242
|
describe 'with client id, client secret, and access token via direct hash' do
|
184
243
|
before do
|
185
|
-
@session = Geoloqi::Session.new :access_token =>
|
244
|
+
@session = Geoloqi::Session.new :access_token => ACCESS_TOKEN,
|
245
|
+
:config => {:client_id => CLIENT_ID,
|
246
|
+
:client_secret => CLIENT_SECRET}
|
186
247
|
end
|
187
248
|
|
188
249
|
it 'should return access token' do
|
189
|
-
expect { @session.access_token ==
|
250
|
+
expect { @session.access_token == ACCESS_TOKEN }
|
190
251
|
end
|
191
252
|
|
192
253
|
it 'should recognize access token exists' do
|
@@ -194,12 +255,21 @@ describe Geoloqi::Session do
|
|
194
255
|
end
|
195
256
|
|
196
257
|
it 'gets authorize url' do
|
197
|
-
authorize_url = @session.authorize_url
|
258
|
+
authorize_url = @session.authorize_url 'http://blah.blah/test'
|
198
259
|
expect { authorize_url == "#{Geoloqi::OAUTH_URL}?"+
|
199
260
|
"response_type=code&"+
|
200
|
-
"client_id=#{Rack::Utils.escape
|
261
|
+
"client_id=#{Rack::Utils.escape CLIENT_ID}&"+
|
201
262
|
"redirect_uri=#{Rack::Utils.escape 'http://blah.blah/test'}" }
|
202
263
|
end
|
264
|
+
|
265
|
+
it 'gets authorize url with scope' do
|
266
|
+
authorize_url = @session.authorize_url 'http://blah.blah/test', :scope => 'party_hard'
|
267
|
+
expect { authorize_url == "#{Geoloqi::OAUTH_URL}?"+
|
268
|
+
"response_type=code&"+
|
269
|
+
"client_id=#{Rack::Utils.escape CLIENT_ID}&"+
|
270
|
+
"redirect_uri=#{Rack::Utils.escape 'http://blah.blah/test'}&"+
|
271
|
+
"scope=party_hard" }
|
272
|
+
end
|
203
273
|
end
|
204
274
|
|
205
275
|
describe 'with bunk access token' do
|
@@ -208,8 +278,12 @@ describe Geoloqi::Session do
|
|
208
278
|
end
|
209
279
|
|
210
280
|
it 'fails with an exception' do
|
281
|
+
stub_request(:post, api_url('message/send')).
|
282
|
+
with(:headers => auth_headers('hey brah whats up let me in its cool 8)')).
|
283
|
+
to_return(:status => 401, :body => {'error' => 'invalid_token'}.to_json)
|
284
|
+
|
211
285
|
begin
|
212
|
-
@session.
|
286
|
+
@session.post 'message/send'
|
213
287
|
rescue Exception => e
|
214
288
|
expect { e.class == Geoloqi::ApiError }
|
215
289
|
expect { e.status == 401 }
|
@@ -221,16 +295,22 @@ describe Geoloqi::Session do
|
|
221
295
|
|
222
296
|
describe 'with config' do
|
223
297
|
before do
|
224
|
-
@session = Geoloqi::Session.new :config => {:client_id =>
|
298
|
+
@session = Geoloqi::Session.new :config => {:client_id => CLIENT_ID, :client_secret => CLIENT_SECRET}
|
225
299
|
end
|
226
300
|
|
227
301
|
it 'retrieves auth with mock' do
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
302
|
+
stub_request(:post, api_url('oauth/token')).
|
303
|
+
with(:body => {:client_id => CLIENT_ID,
|
304
|
+
:client_secret => CLIENT_SECRET,
|
305
|
+
:grant_type => "authorization_code",
|
306
|
+
:code => "1234",
|
307
|
+
:redirect_uri => "http://example.com"}.to_json).
|
308
|
+
to_return(:body => {:access_token => 'access_token1234',
|
309
|
+
:scope => nil,
|
310
|
+
:expires_in => '86400',
|
311
|
+
:refresh_token => 'refresh_token1234'}.to_json)
|
312
|
+
|
313
|
+
response = @session.get_auth '1234', 'http://example.com'
|
234
314
|
|
235
315
|
{:access_token => 'access_token1234',
|
236
316
|
:scope => nil,
|
@@ -243,22 +323,24 @@ describe Geoloqi::Session do
|
|
243
323
|
end
|
244
324
|
|
245
325
|
it 'does not refresh when never expires' do
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
326
|
+
stub_request(:post, api_url('oauth/token')).
|
327
|
+
with(:body => {:client_id => CLIENT_ID,
|
328
|
+
:client_secret => CLIENT_SECRET,
|
329
|
+
:grant_type => "authorization_code",
|
330
|
+
:code => "1234",
|
331
|
+
:redirect_uri => "http://neverexpires.example.com/"}.to_json).
|
332
|
+
to_return(:body => {:access_token => 'access_token1234',
|
333
|
+
:scope => nil,
|
334
|
+
:expires_in => '0',
|
335
|
+
:refresh_token => 'never_expires'}.to_json)
|
336
|
+
|
337
|
+
response = @session.get_auth '1234', 'http://neverexpires.example.com/'
|
252
338
|
|
253
339
|
expect { @session.auth[:expires_in] == '0' }
|
254
340
|
expect { @session.auth[:expires_at].nil? }
|
255
341
|
|
256
|
-
|
257
|
-
|
258
|
-
response = @session.get 'account/username'
|
259
|
-
ensure
|
260
|
-
WebMock.allow_net_connect!
|
261
|
-
end
|
342
|
+
response = @session.get 'account/username'
|
343
|
+
|
262
344
|
expect { @session.auth[:access_token] == 'access_token1234' }
|
263
345
|
expect { response['username'] == 'bulbasaurrulzok' }
|
264
346
|
end
|
@@ -266,7 +348,7 @@ describe Geoloqi::Session do
|
|
266
348
|
|
267
349
|
describe 'with config and expired auth' do
|
268
350
|
before do
|
269
|
-
@session = Geoloqi::Session.new :config => {:client_id =>
|
351
|
+
@session = Geoloqi::Session.new :config => {:client_id => CLIENT_ID, :client_secret => CLIENT_SECRET},
|
270
352
|
:auth => { :access_token => 'access_token1234',
|
271
353
|
:scope => nil,
|
272
354
|
:expires_in => '86400',
|
@@ -275,66 +357,22 @@ describe Geoloqi::Session do
|
|
275
357
|
end
|
276
358
|
|
277
359
|
it 'retrieves new access token and retries query if expired' do
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
360
|
+
stub_request(:post, api_url('oauth/token')).
|
361
|
+
with(:body => {:client_id => CLIENT_ID,
|
362
|
+
:client_secret => CLIENT_SECRET,
|
363
|
+
:grant_type => "refresh_token",
|
364
|
+
:refresh_token => "refresh_token1234"}.to_json).
|
365
|
+
to_return(:body => {:access_token => 'access_token4567',
|
366
|
+
:scope => nil,
|
367
|
+
:expires_in => '5000',
|
368
|
+
:refresh_token => 'refresh_token4567'}.to_json)
|
369
|
+
|
370
|
+
stub_request(:get, api_url('account/username')).
|
371
|
+
with(:headers => {'Authorization'=>'OAuth access_token4567'}).
|
372
|
+
to_return(:body => {'username' => 'pikachu4lyfe'}.to_json)
|
373
|
+
|
374
|
+
@session.get 'account/username'
|
284
375
|
expect { @session.auth[:access_token] == 'access_token4567' }
|
285
376
|
end
|
286
377
|
end
|
287
|
-
end
|
288
|
-
|
289
|
-
include WebMock::API
|
290
|
-
|
291
|
-
stub_request(:post, "https://api.geoloqi.com/1/oauth/token").
|
292
|
-
with(:body => {:client_id => ARGV[0],
|
293
|
-
:client_secret => ARGV[1],
|
294
|
-
:grant_type => "authorization_code",
|
295
|
-
:code => "1234",
|
296
|
-
:redirect_uri => "http://neverexpires.example.com/"}.to_json).
|
297
|
-
to_return(:status => 200,
|
298
|
-
:body => {:access_token => 'access_token1234',
|
299
|
-
:scope => nil,
|
300
|
-
:expires_in => '0',
|
301
|
-
:refresh_token => 'never_expires'}.to_json)
|
302
|
-
|
303
|
-
stub_request(:post, "https://api.geoloqi.com/1/oauth/token").
|
304
|
-
with(:body => {:client_id => ARGV[0],
|
305
|
-
:client_secret => ARGV[1],
|
306
|
-
:grant_type => "authorization_code",
|
307
|
-
:code => "1234",
|
308
|
-
:redirect_uri => "http://test.site/"}.to_json).
|
309
|
-
to_return(:status => 200,
|
310
|
-
:body => {:access_token => 'access_token1234',
|
311
|
-
:scope => nil,
|
312
|
-
:expires_in => '86400',
|
313
|
-
:refresh_token => 'refresh_token1234'}.to_json)
|
314
|
-
|
315
|
-
stub_request(:post, "https://api.geoloqi.com/1/oauth/token").
|
316
|
-
with(:body => {:client_id => ARGV[0],
|
317
|
-
:client_secret => ARGV[1],
|
318
|
-
:grant_type => "refresh_token",
|
319
|
-
:refresh_token => "refresh_token1234"}.to_json).
|
320
|
-
to_return(:status => 200,
|
321
|
-
:body => {:access_token => 'access_token4567',
|
322
|
-
:scope => nil,
|
323
|
-
:expires_in => '5000',
|
324
|
-
:refresh_token => 'refresh_token4567'}.to_json)
|
325
|
-
|
326
|
-
stub_request(:get, "https://api.geoloqi.com/1/account/username").
|
327
|
-
with(:headers => {'Authorization'=>'OAuth access_token1234'}).
|
328
|
-
to_return(:status => 200,
|
329
|
-
:body => {'username' => 'bulbasaurrulzok'}.to_json)
|
330
|
-
|
331
|
-
stub_request(:get, "https://api.geoloqi.com/1/account/username").
|
332
|
-
with(:headers => {'Authorization'=>'OAuth access_token4567'}).
|
333
|
-
to_return(:status => 200,
|
334
|
-
:body => {'username' => 'pikachu4lyfe'}.to_json)
|
335
|
-
|
336
|
-
# This is not a real API call, we're using it to test that arrays are JSON encoded.
|
337
|
-
stub_request(:post, "https://api.geoloqi.com/1/play_record_at_geoloqi_hq").
|
338
|
-
with(:body => [{:artist => 'Television'}].to_json).
|
339
|
-
to_return(:status => 200,
|
340
|
-
:body => {'result' => 'ok'}.to_json)
|
378
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: geoloqi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.9.
|
5
|
+
version: 0.9.17
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Kyle Drake
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-07-
|
14
|
+
date: 2011-07-26 00:00:00 -07:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -37,49 +37,71 @@ dependencies:
|
|
37
37
|
type: :runtime
|
38
38
|
version_requirements: *id002
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
|
-
name:
|
40
|
+
name: addressable
|
41
41
|
prerelease: false
|
42
42
|
requirement: &id003 !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: "0"
|
48
|
+
type: :runtime
|
49
|
+
version_requirements: *id003
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: rake
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: "0"
|
59
|
+
type: :development
|
60
|
+
version_requirements: *id004
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: wrong
|
63
|
+
prerelease: false
|
64
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
43
65
|
none: false
|
44
66
|
requirements:
|
45
67
|
- - "="
|
46
68
|
- !ruby/object:Gem::Version
|
47
69
|
version: 0.5.0
|
48
70
|
type: :development
|
49
|
-
version_requirements: *
|
71
|
+
version_requirements: *id005
|
50
72
|
- !ruby/object:Gem::Dependency
|
51
73
|
name: minitest
|
52
74
|
prerelease: false
|
53
|
-
requirement: &
|
75
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
54
76
|
none: false
|
55
77
|
requirements:
|
56
78
|
- - "="
|
57
79
|
- !ruby/object:Gem::Version
|
58
80
|
version: 2.2.2
|
59
81
|
type: :development
|
60
|
-
version_requirements: *
|
82
|
+
version_requirements: *id006
|
61
83
|
- !ruby/object:Gem::Dependency
|
62
84
|
name: webmock
|
63
85
|
prerelease: false
|
64
|
-
requirement: &
|
86
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
65
87
|
none: false
|
66
88
|
requirements:
|
67
89
|
- - "="
|
68
90
|
- !ruby/object:Gem::Version
|
69
91
|
version: 1.6.4
|
70
92
|
type: :development
|
71
|
-
version_requirements: *
|
93
|
+
version_requirements: *id007
|
72
94
|
- !ruby/object:Gem::Dependency
|
73
95
|
name: hashie
|
74
96
|
prerelease: false
|
75
|
-
requirement: &
|
97
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
76
98
|
none: false
|
77
99
|
requirements:
|
78
100
|
- - "="
|
79
101
|
- !ruby/object:Gem::Version
|
80
102
|
version: 1.0.0
|
81
103
|
type: :development
|
82
|
-
version_requirements: *
|
104
|
+
version_requirements: *id008
|
83
105
|
description: Powerful, flexible, lightweight interface to the awesome Geoloqi platform API! Uses Faraday, and can be used with Ruby 1.9 and EM-Synchrony for really fast, highly concurrent development.
|
84
106
|
email:
|
85
107
|
- kyledrake@gmail.com
|
@@ -94,6 +116,7 @@ files:
|
|
94
116
|
- .gitignore
|
95
117
|
- Gemfile
|
96
118
|
- README.markdown
|
119
|
+
- Rakefile
|
97
120
|
- examples/simple.rb
|
98
121
|
- examples/sinatra.rb
|
99
122
|
- examples/sinatra_synchrony.rb
|
@@ -130,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
153
|
requirements: []
|
131
154
|
|
132
155
|
rubyforge_project: geoloqi
|
133
|
-
rubygems_version: 1.
|
156
|
+
rubygems_version: 1.6.2
|
134
157
|
signing_key:
|
135
158
|
specification_version: 3
|
136
159
|
summary: Powerful, flexible, lightweight interface to the awesome Geoloqi platform API
|