koala 1.2.1 → 1.3.0rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/CHANGELOG +18 -0
- data/koala.gemspec +3 -3
- data/lib/koala.rb +2 -1
- data/lib/koala/graph_api.rb +21 -2
- data/lib/koala/graph_batch_api.rb +2 -1
- data/lib/koala/graph_collection.rb +5 -1
- data/lib/koala/http_service.rb +1 -2
- data/lib/koala/oauth.rb +33 -13
- data/lib/koala/rest_api.rb +1 -12
- data/lib/koala/utils.rb +7 -4
- data/lib/koala/version.rb +1 -1
- data/readme.md +9 -9
- data/spec/cases/error_spec.rb +10 -0
- data/spec/cases/graph_api_batch_spec.rb +63 -21
- data/spec/cases/graph_collection_spec.rb +23 -7
- data/spec/cases/http_service_spec.rb +4 -4
- data/spec/cases/koala_spec.rb +22 -4
- data/spec/cases/multipart_request_spec.rb +2 -2
- data/spec/cases/oauth_spec.rb +105 -35
- data/spec/cases/test_users_spec.rb +4 -4
- data/spec/cases/uploadable_io_spec.rb +1 -1
- data/spec/cases/utils_spec.rb +29 -5
- data/spec/fixtures/mock_facebook_responses.yml +36 -29
- data/spec/spec_helper.rb +3 -0
- data/spec/support/custom_matchers.rb +28 -0
- data/spec/support/graph_api_shared_examples.rb +184 -11
- data/spec/support/koala_test.rb +9 -0
- data/spec/support/rest_api_shared_examples.rb +4 -164
- metadata +26 -28
@@ -90,7 +90,7 @@ describe "Koala::HTTPService" do
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
-
describe "
|
93
|
+
describe ".encode_params" do
|
94
94
|
it "returns an empty string if param_hash evaluates to false" do
|
95
95
|
Koala::HTTPService.encode_params(nil).should == ''
|
96
96
|
end
|
@@ -135,7 +135,7 @@ describe "Koala::HTTPService" do
|
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
|
-
describe "
|
138
|
+
describe ".make_request" do
|
139
139
|
before :each do
|
140
140
|
# Setup stubs for make_request to execute without exceptions
|
141
141
|
@mock_body = stub('Typhoeus response body')
|
@@ -273,7 +273,7 @@ describe "Koala::HTTPService" do
|
|
273
273
|
:always_use_ssl => :use_ssl,
|
274
274
|
:proxy => :proxy
|
275
275
|
}.each_pair do |deprecated_method, parameter|
|
276
|
-
describe "
|
276
|
+
describe ".#{deprecated_method}" do
|
277
277
|
context "read" do
|
278
278
|
it "reads http_options[:#{parameter}]" do
|
279
279
|
value = "foo"
|
@@ -305,7 +305,7 @@ describe "Koala::HTTPService" do
|
|
305
305
|
|
306
306
|
# ssl options
|
307
307
|
[:ca_path, :ca_file, :verify_mode].each do |deprecated_method|
|
308
|
-
describe "
|
308
|
+
describe ".#{deprecated_method}" do
|
309
309
|
context "read" do
|
310
310
|
it "reads http_options[:ssl][:#{deprecated_method}] if http_options[:ssl]" do
|
311
311
|
value = "foo"
|
data/spec/cases/koala_spec.rb
CHANGED
@@ -1,15 +1,33 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
4
|
-
|
5
|
-
Koala.const_defined?("VERSION").should be_true
|
6
|
-
end
|
3
|
+
describe Koala do
|
4
|
+
|
7
5
|
|
8
6
|
it "has an http_service accessor" do
|
9
7
|
Koala.should respond_to(:http_service)
|
10
8
|
Koala.should respond_to(:http_service=)
|
11
9
|
end
|
12
10
|
|
11
|
+
describe "constants" do
|
12
|
+
it "has a version" do
|
13
|
+
Koala.const_defined?("VERSION").should be_true
|
14
|
+
end
|
15
|
+
|
16
|
+
describe Koala::Facebook do
|
17
|
+
it "defines GRAPH_SERVER" do
|
18
|
+
Koala::Facebook::GRAPH_SERVER.should == "graph.facebook.com"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "defines REST_SERVER" do
|
22
|
+
Koala::Facebook::REST_SERVER.should == "api.facebook.com"
|
23
|
+
end
|
24
|
+
|
25
|
+
it "defines DIALOG_HOST" do
|
26
|
+
Koala::Facebook::DIALOG_HOST.should == "www.facebook.com"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
13
31
|
context "for deprecated services" do
|
14
32
|
before :each do
|
15
33
|
@service = Koala.http_service
|
@@ -9,7 +9,7 @@ describe Koala::MultipartRequest do
|
|
9
9
|
Koala::MultipartRequest.mime_type.should == 'multipart/form-data'
|
10
10
|
end
|
11
11
|
|
12
|
-
describe "
|
12
|
+
describe "#process_request?" do
|
13
13
|
before :each do
|
14
14
|
@env = {}
|
15
15
|
@multipart = Koala::MultipartRequest.new
|
@@ -43,7 +43,7 @@ describe Koala::MultipartRequest do
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
describe "
|
46
|
+
describe "#process_params" do
|
47
47
|
before :each do
|
48
48
|
@parent = Faraday::Request::Multipart.new
|
49
49
|
@multipart = Koala::MultipartRequest.new
|
data/spec/cases/oauth_spec.rb
CHANGED
@@ -29,26 +29,27 @@ describe "Koala::Facebook::OAuth" do
|
|
29
29
|
@time.stub!(:to_i).and_return(1273363199)
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
describe ".new" do
|
33
|
+
it "properly initializes" do
|
34
|
+
@oauth.should
|
35
|
+
end
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
it "properly sets attributes" do
|
38
|
+
(@oauth.app_id == @app_id &&
|
39
|
+
@oauth.app_secret == @secret &&
|
40
|
+
@oauth.oauth_callback_url == @callback_url).should be_true
|
41
|
+
end
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
it "properly initializes without a callback_url" do
|
44
|
+
@oauth = Koala::Facebook::OAuth.new(@app_id, @secret)
|
45
|
+
end
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
47
|
+
it "properly sets attributes without a callback URL" do
|
48
|
+
@oauth = Koala::Facebook::OAuth.new(@app_id, @secret)
|
49
|
+
(@oauth.app_id == @app_id &&
|
50
|
+
@oauth.app_secret == @secret &&
|
51
|
+
@oauth.oauth_callback_url == nil).should be_true
|
52
|
+
end
|
52
53
|
end
|
53
54
|
|
54
55
|
describe "for cookie parsing" do
|
@@ -209,75 +210,144 @@ describe "Koala::Facebook::OAuth" do
|
|
209
210
|
end
|
210
211
|
end
|
211
212
|
|
212
|
-
# OAuth URLs
|
213
|
-
|
214
213
|
describe "for URL generation" do
|
215
|
-
|
216
|
-
describe "for OAuth codes" do
|
217
|
-
# url_for_oauth_code
|
214
|
+
describe "#url_for_oauth_code" do
|
218
215
|
it "generates a properly formatted OAuth code URL with the default values" do
|
219
216
|
url = @oauth.url_for_oauth_code
|
220
|
-
url.should
|
217
|
+
url.should match_url("https://#{Koala::Facebook::GRAPH_SERVER}/oauth/authorize?client_id=#{@app_id}&redirect_uri=#{CGI.escape @callback_url}")
|
221
218
|
end
|
222
219
|
|
223
220
|
it "generates a properly formatted OAuth code URL when a callback is given" do
|
224
221
|
callback = "foo.com"
|
225
222
|
url = @oauth.url_for_oauth_code(:callback => callback)
|
226
|
-
url.should
|
223
|
+
url.should match_url("https://#{Koala::Facebook::GRAPH_SERVER}/oauth/authorize?client_id=#{@app_id}&redirect_uri=#{callback}")
|
227
224
|
end
|
228
225
|
|
229
226
|
it "generates a properly formatted OAuth code URL when permissions are requested as a string" do
|
230
227
|
permissions = "publish_stream,read_stream"
|
231
228
|
url = @oauth.url_for_oauth_code(:permissions => permissions)
|
232
|
-
url.should
|
229
|
+
url.should match_url("https://#{Koala::Facebook::GRAPH_SERVER}/oauth/authorize?client_id=#{@app_id}&scope=#{CGI.escape permissions}&redirect_uri=#{CGI.escape @callback_url}")
|
233
230
|
end
|
234
231
|
|
235
232
|
it "generates a properly formatted OAuth code URL when permissions are requested as a string" do
|
236
233
|
permissions = ["publish_stream", "read_stream"]
|
237
234
|
url = @oauth.url_for_oauth_code(:permissions => permissions)
|
238
|
-
url.should
|
235
|
+
url.should match_url("https://#{Koala::Facebook::GRAPH_SERVER}/oauth/authorize?client_id=#{@app_id}&scope=#{CGI.escape permissions.join(",")}&redirect_uri=#{CGI.escape @callback_url}")
|
239
236
|
end
|
240
237
|
|
241
238
|
it "generates a properly formatted OAuth code URL when both permissions and callback are provided" do
|
242
239
|
permissions = "publish_stream,read_stream"
|
243
240
|
callback = "foo.com"
|
244
241
|
url = @oauth.url_for_oauth_code(:callback => callback, :permissions => permissions)
|
245
|
-
url.should
|
242
|
+
url.should match_url("https://#{Koala::Facebook::GRAPH_SERVER}/oauth/authorize?client_id=#{@app_id}&scope=#{CGI.escape permissions}&redirect_uri=#{CGI.escape callback}")
|
246
243
|
end
|
247
244
|
|
248
245
|
it "generates a properly formatted OAuth code URL when a display is given as a string" do
|
249
246
|
url = @oauth.url_for_oauth_code(:display => "page")
|
250
|
-
url.should
|
247
|
+
url.should match_url("https://#{Koala::Facebook::GRAPH_SERVER}/oauth/authorize?client_id=#{@app_id}&display=page&redirect_uri=#{CGI.escape @callback_url}")
|
251
248
|
end
|
252
249
|
|
253
250
|
it "raises an exception if no callback is given in initialization or the call" do
|
254
251
|
oauth2 = Koala::Facebook::OAuth.new(@app_id, @secret)
|
255
252
|
lambda { oauth2.url_for_oauth_code }.should raise_error(ArgumentError)
|
256
253
|
end
|
254
|
+
|
255
|
+
it "includes any additional options as URL parameters, appropriately escaped" do
|
256
|
+
params = {
|
257
|
+
:url => "http://foo.bar?c=2",
|
258
|
+
:email => "cdc@b.com"
|
259
|
+
}
|
260
|
+
url = @oauth.url_for_oauth_code(params)
|
261
|
+
params.each_pair do |key, value|
|
262
|
+
url.should =~ /[\&\?]#{key}=#{CGI.escape value}/
|
263
|
+
end
|
264
|
+
end
|
257
265
|
end
|
258
266
|
|
259
|
-
describe "
|
267
|
+
describe "#url_for_access_token" do
|
260
268
|
before :each do
|
261
269
|
# since we're just composing a URL here, we don't need to have a real code
|
262
270
|
@code ||= "test_code"
|
263
271
|
end
|
264
|
-
|
265
|
-
# url_for_access_token
|
272
|
+
|
266
273
|
it "generates a properly formatted OAuth token URL when provided a code" do
|
267
274
|
url = @oauth.url_for_access_token(@code)
|
268
|
-
url.should
|
275
|
+
url.should match_url("https://#{Koala::Facebook::GRAPH_SERVER}/oauth/access_token?client_id=#{@app_id}&code=#{@code}&client_secret=#{@secret}&redirect_uri=#{CGI.escape @callback_url}").should be_true
|
269
276
|
end
|
270
277
|
|
271
278
|
it "generates a properly formatted OAuth token URL when provided a callback" do
|
272
279
|
callback = "foo.com"
|
273
280
|
url = @oauth.url_for_access_token(@code, :callback => callback)
|
274
|
-
url.should
|
281
|
+
url.should match_url("https://#{Koala::Facebook::GRAPH_SERVER}/oauth/access_token?client_id=#{@app_id}&code=#{@code}&client_secret=#{@secret}&redirect_uri=#{CGI.escape callback}").should be_true
|
282
|
+
end
|
283
|
+
|
284
|
+
it "includes any additional options as URL parameters, appropriately escaped" do
|
285
|
+
params = {
|
286
|
+
:url => "http://foo.bar?c=2",
|
287
|
+
:email => "cdc@b.com"
|
288
|
+
}
|
289
|
+
url = @oauth.url_for_access_token(@code, params)
|
290
|
+
params.each_pair do |key, value|
|
291
|
+
url.should =~ /[\&\?]#{key}=#{CGI.escape value}/
|
292
|
+
end
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
describe "#url_for_dialog" do
|
297
|
+
it "builds the base properly" do
|
298
|
+
dialog_type = "my_dialog_type"
|
299
|
+
@oauth.url_for_dialog(dialog_type).should =~ /^http:\/\/#{Koala::Facebook::DIALOG_HOST}\/dialog\/#{dialog_type}/
|
300
|
+
end
|
301
|
+
|
302
|
+
it "adds the app_id/client_id to the url" do
|
303
|
+
automatic_params = {:app_id => @app_id, :client_id => @client_id}
|
304
|
+
url = @oauth.url_for_dialog("foo", automatic_params)
|
305
|
+
automatic_params.each_pair do |key, value|
|
306
|
+
# we're slightly simplifying how encode_params works, but for strings/ints, it's okay
|
307
|
+
url.should =~ /[\&\?]#{key}=#{CGI.escape value.to_s}/
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
it "includes any additional options as URL parameters, appropriately escaped" do
|
312
|
+
params = {
|
313
|
+
:url => "http://foo.bar?c=2",
|
314
|
+
:email => "cdc@b.com"
|
315
|
+
}
|
316
|
+
url = @oauth.url_for_dialog("friends", params)
|
317
|
+
params.each_pair do |key, value|
|
318
|
+
# we're slightly simplifying how encode_params works, but strings/ints, it's okay
|
319
|
+
url.should =~ /[\&\?]#{key}=#{CGI.escape value.to_s}/
|
320
|
+
end
|
321
|
+
end
|
322
|
+
|
323
|
+
describe "real examples from FB documentation" do
|
324
|
+
# see http://developers.facebook.com/docs/reference/dialogs/
|
325
|
+
# slightly brittle (e.g. if parameter order changes), but still useful
|
326
|
+
it "can generate a send dialog" do
|
327
|
+
url = @oauth.url_for_dialog("send", :name => "People Argue Just to Win", :link => "http://www.nytimes.com/2011/06/15/arts/people-argue-just-to-win-scholars-assert.html")
|
328
|
+
url.should match_url("http://www.facebook.com/dialog/send?app_id=#{@app_id}&client_id=#{@app_id}&link=http%3A%2F%2Fwww.nytimes.com%2F2011%2F06%2F15%2Farts%2Fpeople-argue-just-to-win-scholars-assert.html&name=People+Argue+Just+to+Win&redirect_uri=#{CGI.escape @callback_url}")
|
329
|
+
end
|
330
|
+
|
331
|
+
it "can generate a feed dialog" do
|
332
|
+
url = @oauth.url_for_dialog("feed", :name => "People Argue Just to Win", :link => "http://www.nytimes.com/2011/06/15/arts/people-argue-just-to-win-scholars-assert.html")
|
333
|
+
url.should match_url("http://www.facebook.com/dialog/feed?app_id=#{@app_id}&client_id=#{@app_id}&link=http%3A%2F%2Fwww.nytimes.com%2F2011%2F06%2F15%2Farts%2Fpeople-argue-just-to-win-scholars-assert.html&name=People+Argue+Just+to+Win&redirect_uri=#{CGI.escape @callback_url}")
|
334
|
+
end
|
335
|
+
|
336
|
+
it "can generate a oauth dialog" do
|
337
|
+
url = @oauth.url_for_dialog("oauth", :scope => "email", :response_type => "token")
|
338
|
+
url.should match_url("http://www.facebook.com/dialog/oauth?app_id=#{@app_id}&client_id=#{@app_id}&redirect_uri=#{CGI.escape @callback_url}&response_type=token&scope=email")
|
339
|
+
end
|
340
|
+
|
341
|
+
it "can generate a pay dialog" do
|
342
|
+
url = @oauth.url_for_dialog("pay", :order_id => "foo", :credits_purchase => false)
|
343
|
+
url.should match_url("http://www.facebook.com/dialog/pay?app_id=#{@app_id}&client_id=#{@app_id}&order_id=foo&credits_purchase=false&redirect_uri=#{CGI.escape @callback_url}")
|
344
|
+
end
|
275
345
|
end
|
276
346
|
end
|
277
347
|
end
|
278
348
|
|
279
349
|
describe "for fetching access tokens" do
|
280
|
-
describe "
|
350
|
+
describe "#get_access_token_info" do
|
281
351
|
it "uses options[:redirect_uri] if provided" do
|
282
352
|
uri = "foo"
|
283
353
|
Koala.should_receive(:make_request).with(anything, hash_including(:redirect_uri => uri), anything, anything).and_return(Koala::Response.new(200, "", {}))
|
@@ -311,7 +381,7 @@ describe "Koala::Facebook::OAuth" do
|
|
311
381
|
end
|
312
382
|
end
|
313
383
|
|
314
|
-
describe "
|
384
|
+
describe "#get_access_token" do
|
315
385
|
# TODO refactor these to be proper tests with stubs and tests against real data
|
316
386
|
it "passes on any options provided to make_request" do
|
317
387
|
options = {:a => 2}
|
@@ -87,7 +87,7 @@ describe "Koala::Facebook::TestUsers" do
|
|
87
87
|
|
88
88
|
# TEST USER MANAGEMENT
|
89
89
|
|
90
|
-
describe "
|
90
|
+
describe "#create" do
|
91
91
|
it "should create a test user when not given installed" do
|
92
92
|
result = @test_users.create(false)
|
93
93
|
@user1 = result["id"]
|
@@ -132,7 +132,7 @@ describe "Koala::Facebook::TestUsers" do
|
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
|
-
describe "
|
135
|
+
describe "#delete" do
|
136
136
|
before :each do
|
137
137
|
@user1 = @test_users.create(true, "read_stream")
|
138
138
|
@user2 = @test_users.create(true, "read_stream,user_interests")
|
@@ -153,7 +153,7 @@ describe "Koala::Facebook::TestUsers" do
|
|
153
153
|
end
|
154
154
|
end
|
155
155
|
|
156
|
-
describe "
|
156
|
+
describe "#delete_all" do
|
157
157
|
it "should delete all users found by the list commnand" do
|
158
158
|
array = [1, 2, 3]
|
159
159
|
@test_users.should_receive(:list).and_return(array)
|
@@ -162,7 +162,7 @@ describe "Koala::Facebook::TestUsers" do
|
|
162
162
|
end
|
163
163
|
end
|
164
164
|
|
165
|
-
describe "
|
165
|
+
describe "#update" do
|
166
166
|
before :each do
|
167
167
|
@updates = {:name => "Foo Baz"}
|
168
168
|
# we stub out :graph_call, but still need to be able to delete the users
|
@@ -212,7 +212,7 @@ describe "Koala::UploadableIO" do
|
|
212
212
|
end
|
213
213
|
end
|
214
214
|
|
215
|
-
describe "
|
215
|
+
describe ".binary_content?" do
|
216
216
|
it "returns true for Rails 3 file uploads" do
|
217
217
|
Koala::UploadableIO.binary_content?(rails_3_mocks.last).should be_true
|
218
218
|
end
|
data/spec/cases/utils_spec.rb
CHANGED
@@ -1,10 +1,34 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Koala::Utils do
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
describe ".deprecate" do
|
5
|
+
before :each do
|
6
|
+
# unstub deprecate so we can test it
|
7
|
+
Koala::Utils.unstub(:deprecate)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "has a deprecation prefix that includes the words Koala and deprecation" do
|
11
|
+
Koala::Utils::DEPRECATION_PREFIX.should =~ /koala/i
|
12
|
+
Koala::Utils::DEPRECATION_PREFIX.should =~ /deprecation/i
|
13
|
+
end
|
14
|
+
|
15
|
+
it "prints a warning with Kernel.warn" do
|
16
|
+
message = Time.now.to_s + rand.to_s
|
17
|
+
Kernel.should_receive(:warn)
|
18
|
+
Koala::Utils.deprecate(message)
|
19
|
+
end
|
7
20
|
|
8
|
-
|
9
|
-
|
21
|
+
it "prints the deprecation prefix and the warning" do
|
22
|
+
message = Time.now.to_s + rand.to_s
|
23
|
+
Kernel.should_receive(:warn).with(Koala::Utils::DEPRECATION_PREFIX + message)
|
24
|
+
Koala::Utils.deprecate(message)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "only prints each unique message once" do
|
28
|
+
message = Time.now.to_s + rand.to_s
|
29
|
+
Kernel.should_receive(:warn).once
|
30
|
+
Koala::Utils.deprecate(message)
|
31
|
+
Koala::Utils.deprecate(message)
|
32
|
+
end
|
33
|
+
end
|
10
34
|
end
|
@@ -14,30 +14,15 @@
|
|
14
14
|
rest_api:
|
15
15
|
|
16
16
|
# -- Stubbed Responses --
|
17
|
-
/method/fql.query:
|
18
|
-
query=select first_name from user where uid = 2901279:
|
19
|
-
get:
|
20
|
-
no_token: '[{"first_name":"Luke"}]'
|
21
|
-
with_token: '[{"first_name":"Luke"}]'
|
22
|
-
query=select read_stream from permissions where uid = 2901279:
|
23
|
-
get:
|
24
|
-
with_token: '[{"read_stream":1}]'
|
25
|
-
no_token: '{"error_code":104,"error_msg":"Requires valid signature","request_args":[{"key":"method","value":"fql.query"},{"key":"format","value":"json"},{"key":"query","value":"select read_stream from permissions where uid = 2901279"}]}'
|
26
|
-
|
27
|
-
/method/fql.multiquery:
|
28
|
-
'queries=<%= MultiJson.encode({"query1" => "select post_id from stream where source_id = me()", "query2" => "select fromid from comment where post_id in (select post_id from #query1)", "query3" => "select uid, name from user where uid in (select fromid from #query2)"}) %>':
|
29
|
-
get:
|
30
|
-
with_token: '[{"name":"query1", "fql_result_set":[]},{"name":"query2", "fql_result_set":[]},{"name":"query3", "fql_result_set":[]}]'
|
31
|
-
no_token: '{"error_code":104,"error_msg":"Requires valid signature","request_args":[{"key":"method","value":"fql.query"},{"key":"format","value":"json"},{"key":"query","value":"select read_stream from permissions where uid = 2901279"}]}'
|
32
|
-
'queries=<%= MultiJson.encode({"query1" => "select first_name from user where uid = 2901279", "query2" => "select first_name from user where uid = 2905623"}) %>':
|
33
|
-
get:
|
34
|
-
with_token: '[{"name":"query1", "fql_result_set":[{"first_name":"Luke"}]},{"name":"query2", "fql_result_set":[{"first_name":"Alex"}]}]'
|
35
|
-
no_token: '[{"name":"query1", "fql_result_set":[{"first_name":"Luke"}]},{"name":"query2", "fql_result_set":[{"first_name":"Alex"}]}]'
|
36
17
|
/method/admin.setAppProperties:
|
37
18
|
'properties={"desktop":0}':
|
38
19
|
post:
|
39
20
|
with_token: 'true'
|
40
|
-
|
21
|
+
/method/fql.query: # for testing the beta tier
|
22
|
+
query=select first_name from user where uid = 2901279:
|
23
|
+
get:
|
24
|
+
no_token: '[{"first_name":"Luke"}]'
|
25
|
+
with_token: '[{"first_name":"Luke"}]'
|
41
26
|
|
42
27
|
|
43
28
|
|
@@ -227,29 +212,26 @@ graph_api:
|
|
227
212
|
with_token: '{"data": [{}], "paging": {}}'
|
228
213
|
|
229
214
|
/lukeshepard/picture:
|
230
|
-
|
215
|
+
no_args:
|
231
216
|
get:
|
232
217
|
no_token:
|
233
218
|
code: 302
|
234
219
|
headers:
|
235
|
-
Location:
|
220
|
+
Location: http://facebook.com/
|
236
221
|
with_token:
|
237
222
|
code: 302
|
238
223
|
headers:
|
239
|
-
Location:
|
240
|
-
|
241
|
-
|
242
|
-
/chris.baclig/picture:
|
243
|
-
no_args:
|
224
|
+
Location: http://facebook.com/
|
225
|
+
type=large:
|
244
226
|
get:
|
245
227
|
no_token:
|
246
228
|
code: 302
|
247
229
|
headers:
|
248
|
-
Location:
|
230
|
+
Location: https://facebook.com/large
|
249
231
|
with_token:
|
250
232
|
code: 302
|
251
233
|
headers:
|
252
|
-
Location:
|
234
|
+
Location: https://facebook.com/large
|
253
235
|
|
254
236
|
/comments:
|
255
237
|
ids=http://developers.facebook.com/blog/post/472:
|
@@ -279,6 +261,25 @@ graph_api:
|
|
279
261
|
with_token: '{"data": [{"id": "507731521_100412693339488"}], "paging": {"previous": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000", "next": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000"}}'
|
280
262
|
no_token: '{"data": [{"id": "507731521_100412693339488"}], "paging": {"previous": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000", "next": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000"}}'
|
281
263
|
|
264
|
+
/fql:
|
265
|
+
q=select first_name from user where uid = 2901279:
|
266
|
+
get:
|
267
|
+
no_token: '[{"first_name":"Luke"}]'
|
268
|
+
with_token: '[{"first_name":"Luke"}]'
|
269
|
+
q=select read_stream from permissions where uid = 2901279:
|
270
|
+
get:
|
271
|
+
<<: *token_required
|
272
|
+
with_token: '[{"read_stream":1}]'
|
273
|
+
'q=<%= MultiJson.encode({"query1" => "select post_id from stream where source_id = me()", "query2" => "select fromid from comment where post_id in (select post_id from #query1)", "query3" => "select uid, name from user where uid in (select fromid from #query2)"}) %>':
|
274
|
+
get:
|
275
|
+
<<: *token_required
|
276
|
+
with_token: '[{"name":"query1", "fql_result_set":[]},{"name":"query2", "fql_result_set":[]},{"name":"query3", "fql_result_set":[]}]'
|
277
|
+
'q=<%= MultiJson.encode({"query1" => "select first_name from user where uid = 2901279", "query2" => "select first_name from user where uid = 2905623"}) %>':
|
278
|
+
get:
|
279
|
+
with_token: '[{"name":"query1", "fql_result_set":[{"first_name":"Luke"}]},{"name":"query2", "fql_result_set":[{"first_name":"Alex"}]}]'
|
280
|
+
no_token: '[{"name":"query1", "fql_result_set":[{"first_name":"Luke"}]},{"name":"query2", "fql_result_set":[{"first_name":"Alex"}]}]'
|
281
|
+
|
282
|
+
|
282
283
|
'/115349521819193_113815981982767':
|
283
284
|
no_args:
|
284
285
|
delete:
|
@@ -290,6 +291,12 @@ graph_api:
|
|
290
291
|
<<: *token_required
|
291
292
|
with_token: '{"access_token": "<%= APP_ACCESS_TOKEN %>"}'
|
292
293
|
|
294
|
+
|
295
|
+
'/<%= APP_ID %>':
|
296
|
+
restrictions=<%= MultiJson.encode({"age_distr" => "13+"}) %>:
|
297
|
+
post:
|
298
|
+
with_token: "true"
|
299
|
+
|
293
300
|
# -- OAuth responses --
|
294
301
|
/oauth/access_token:
|
295
302
|
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&code=<%= OAUTH_CODE %>&redirect_uri=<%= OAUTH_DATA["callback_url"] %>:
|