koala 1.3.0 → 1.4.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Koala
2
- VERSION = "1.3.0"
2
+ VERSION = "1.4.0.rc1"
3
3
  end
data/readme.md CHANGED
@@ -32,7 +32,7 @@ The Graph API is the simple, slick new interface to Facebook's data. Using it w
32
32
  @graph.put_object("me", "feed", :message => "I am writing on my wall!")
33
33
 
34
34
  # three-part queries are easy too!
35
- @graph.get_connection("me", "mutualfriends/#{friend_id}")
35
+ @graph.get_connections("me", "mutualfriends/#{friend_id}")
36
36
 
37
37
  # you can even use the new Timeline API
38
38
  # see https://developers.facebook.com/docs/beta/opengraph/tutorial/
@@ -372,11 +372,11 @@ describe "Koala::Facebook::GraphAPI in batch mode" do
372
372
  end
373
373
  result[0].should == {"Content-Type" => "text/javascript; charset=UTF-8"}
374
374
  end
375
-
375
+
376
376
  describe "if it errors" do
377
377
  it "raises an APIError if the response is not 200" do
378
378
  Koala.stub(:make_request).and_return(Koala::HTTPService::Response.new(500, "[]", {}))
379
- expect {
379
+ expect {
380
380
  Koala::Facebook::API.new("foo").batch {|batch_api| batch_api.get_object('me') }
381
381
  }.to raise_exception(Koala::Facebook::APIError)
382
382
  end
@@ -385,21 +385,21 @@ describe "Koala::Facebook::GraphAPI in batch mode" do
385
385
  before :each do
386
386
  Koala.stub(:make_request).and_return(Koala::HTTPService::Response.new(200, '{"error":190,"error_description":"Error validating access token."}', {}))
387
387
  end
388
-
388
+
389
389
  it "throws an error if the response is an old Batch API-style error" do
390
- expect {
390
+ expect {
391
391
  Koala::Facebook::API.new("foo").batch {|batch_api| batch_api.get_object('me') }
392
392
  }.to raise_exception(Koala::Facebook::APIError)
393
- end
394
-
393
+ end
394
+
395
395
  it "provides a type for the error if the response is an old Batch API-style error" do
396
396
  begin
397
397
  Koala::Facebook::API.new("foo").batch {|batch_api| batch_api.get_object('me') }
398
398
  rescue Koala::Facebook::APIError => err
399
399
  end
400
400
  err.fb_error_type.should
401
- end
402
-
401
+ end
402
+
403
403
  it "passes all the error details if an old Batch API-style error is raised" do
404
404
  begin
405
405
  Koala::Facebook::API.new("foo").batch {|batch_api| batch_api.get_object('me') }
@@ -408,18 +408,18 @@ describe "Koala::Facebook::GraphAPI in batch mode" do
408
408
  err.raw_response["error"].should == 190
409
409
  end
410
410
  end
411
-
412
- context "with the new style" do
411
+
412
+ context "with the new style" do
413
413
  before :each do
414
414
  Koala.stub(:make_request).and_return(Koala::HTTPService::Response.new(200, '{"error":{"message":"Request 0 cannot depend on an unresolved request with name f. Requests can only depend on preceding requests","type":"GraphBatchException"}}', {}))
415
415
  end
416
416
 
417
417
  it "throws an error if the response is a new Graph API-style error" do
418
- expect {
418
+ expect {
419
419
  Koala::Facebook::API.new("foo").batch {|batch_api| batch_api.get_object('me') }
420
420
  }.to raise_exception(Koala::Facebook::APIError)
421
421
  end
422
-
422
+
423
423
  it "passes all the error details if an old Batch API-style error is raised" do
424
424
  begin
425
425
  Koala::Facebook::API.new("foo").batch {|batch_api| batch_api.get_object('me') }
@@ -488,7 +488,7 @@ describe "Koala::Facebook::GraphAPI in batch mode" do
488
488
  end
489
489
  friends.should be_a(Koala::Facebook::GraphCollection)
490
490
  end
491
-
491
+
492
492
  it 'turns pageable results into GraphCollections' do
493
493
  me, friends = @api.batch do |batch_api|
494
494
  batch_api.get_object('me')
@@ -515,11 +515,11 @@ describe "Koala::Facebook::GraphAPI in batch mode" do
515
515
  end
516
516
 
517
517
  it "inserts errors in the appropriate place, without breaking other results" do
518
- failed_insights, koppel = @api.batch do |batch_api|
519
- batch_api.get_connections(@app_id, 'insights')
518
+ failed_call, koppel = @api.batch do |batch_api|
519
+ batch_api.get_connection("2", "invalidconnection")
520
520
  batch_api.get_object(KoalaTest.user1, {}, {"access_token" => @app_api.access_token})
521
521
  end
522
- failed_insights.should be_a(Koala::Facebook::APIError)
522
+ failed_call.should be_a(Koala::Facebook::APIError)
523
523
  koppel["id"].should_not be_nil
524
524
  end
525
525
 
@@ -602,12 +602,12 @@ describe "Koala::Facebook::GraphAPI in batch mode" do
602
602
  end
603
603
 
604
604
  it "properly handles dependencies that fail" do
605
- data, koppel = @api.batch do |batch_api|
606
- batch_api.get_connections(@app_id, 'insights', {}, :batch_args => {:name => "getdata"})
605
+ failed_call, koppel = @api.batch do |batch_api|
606
+ batch_api.get_connections("2", "invalidconnection", {}, :batch_args => {:name => "getdata"})
607
607
  batch_api.get_object(KoalaTest.user1, {}, :batch_args => {:depends_on => "getdata"})
608
608
  end
609
609
 
610
- data.should be_a(Koala::Facebook::APIError)
610
+ failed_call.should be_a(Koala::Facebook::APIError)
611
611
  koppel.should be_nil
612
612
  end
613
613
 
@@ -123,6 +123,13 @@ describe "Koala::HTTPService" do
123
123
  val.should == CGI.escape(args[key])
124
124
  end
125
125
  end
126
+
127
+ it "encodes parameters in alphabetical order" do
128
+ args = {:b => '2', 'a' => '1'}
129
+
130
+ result = Koala::HTTPService.encode_params(args)
131
+ result.split('&').map{|key_val| key_val.split('=')[0]}.should == ['a', 'b']
132
+ end
126
133
 
127
134
  it "converts all keys to Strings" do
128
135
  args = Hash[*(1..4).map {|i| [i, "val#{i}"]}.flatten]
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe KoalaTest do
4
+ pending "should have tests, because the test suite depends on it"
5
+ end
@@ -7,6 +7,7 @@ describe "Koala::Facebook::OAuth" do
7
7
  @secret = KoalaTest.secret
8
8
  @code = KoalaTest.code
9
9
  @callback_url = KoalaTest.oauth_test_data["callback_url"]
10
+ @access_token = KoalaTest.oauth_test_data["access_token"]
10
11
  @raw_token_string = KoalaTest.oauth_test_data["raw_token_string"]
11
12
  @raw_offline_access_token_string = KoalaTest.oauth_test_data["raw_offline_access_token_string"]
12
13
 
@@ -61,7 +62,7 @@ describe "Koala::Facebook::OAuth" do
61
62
  @token = "my token"
62
63
  @oauth.stub(:get_access_token_info).and_return("access_token" => @token)
63
64
  end
64
-
65
+
65
66
  it "parses valid cookies" do
66
67
  result = @oauth.get_user_info_from_cookies(@cookie)
67
68
  result.should be_a(Hash)
@@ -71,9 +72,9 @@ describe "Koala::Facebook::OAuth" do
71
72
  result = @oauth.get_user_info_from_cookies(@cookie)
72
73
  @oauth.parse_signed_request(@cookie.values.first).each_pair do |k, v|
73
74
  result[k].should == v
74
- end
75
+ end
75
76
  end
76
-
77
+
77
78
  it "makes a request to Facebook to redeem the code if present" do
78
79
  code = "foo"
79
80
  @oauth.stub(:parse_signed_request).and_return({"code" => code})
@@ -98,12 +99,12 @@ describe "Koala::Facebook::OAuth" do
98
99
  @oauth.get_user_info_from_cookies(@cookie).should be_nil
99
100
  end
100
101
  end
101
-
102
+
102
103
  context "if the code is present" do
103
104
  it "adds the access_token into the hash" do
104
105
  @oauth.get_user_info_from_cookies(@cookie)["access_token"].should == @token
105
106
  end
106
-
107
+
107
108
  it "returns nil if the call to FB returns no data" do
108
109
  @oauth.stub(:get_access_token_info).and_return(nil)
109
110
  @oauth.get_user_info_from_cookies(@cookie).should be_nil
@@ -125,7 +126,7 @@ describe "Koala::Facebook::OAuth" do
125
126
  expect { @oauth.get_user_info_from_cookies(@cookie) }.to raise_exception(Koala::Facebook::APIError)
126
127
  end
127
128
  end
128
-
129
+
129
130
  it "doesn't parse invalid cookies" do
130
131
  # make an invalid string by replacing some values
131
132
  bad_cookie_hash = @cookie.inject({}) { |hash, value| hash[value[0]] = value[1].gsub(/[0-9]/, "3") }
@@ -133,7 +134,7 @@ describe "Koala::Facebook::OAuth" do
133
134
  result.should be_nil
134
135
  end
135
136
  end
136
-
137
+
137
138
  context "for unsigned cookies" do
138
139
  it "properly parses valid cookies" do
139
140
  result = @oauth.get_user_info_from_cookies(KoalaTest.oauth_test_data["valid_cookies"])
@@ -161,7 +162,7 @@ describe "Koala::Facebook::OAuth" do
161
162
 
162
163
  it "doesn't parse expired cookies" do
163
164
  new_time = @time.to_i * 2
164
- @time.stub(:to_i).and_return(new_time)
165
+ @time.stub(:to_i).and_return(new_time)
165
166
  @oauth.get_user_info_from_cookies(KoalaTest.oauth_test_data["valid_cookies"]).should be_nil
166
167
  end
167
168
 
@@ -179,7 +180,7 @@ describe "Koala::Facebook::OAuth" do
179
180
  before :each do
180
181
  # we don't actually want to make requests to Facebook to redeem the code
181
182
  @cookie = KoalaTest.oauth_test_data["valid_signed_cookies"]
182
- @oauth.stub(:get_access_token_info).and_return("access_token" => "my token")
183
+ @oauth.stub(:get_access_token_info).and_return("access_token" => "my token")
183
184
  end
184
185
 
185
186
  it "does not uses get_user_info_from_cookies to parse the cookies" do
@@ -199,7 +200,7 @@ describe "Koala::Facebook::OAuth" do
199
200
  result.should be_nil
200
201
  end
201
202
  end
202
-
203
+
203
204
  describe "for unsigned cookies" do
204
205
  before :each do
205
206
  # we don't actually want to make requests to Facebook to redeem the code
@@ -267,14 +268,14 @@ describe "Koala::Facebook::OAuth" do
267
268
  oauth2 = Koala::Facebook::OAuth.new(@app_id, @secret)
268
269
  lambda { oauth2.url_for_oauth_code }.should raise_error(ArgumentError)
269
270
  end
270
-
271
+
271
272
  it "includes any additional options as URL parameters, appropriately escaped" do
272
273
  params = {
273
274
  :url => "http://foo.bar?c=2",
274
275
  :email => "cdc@b.com"
275
276
  }
276
277
  url = @oauth.url_for_oauth_code(params)
277
- params.each_pair do |key, value|
278
+ params.each_pair do |key, value|
278
279
  url.should =~ /[\&\?]#{key}=#{CGI.escape value}/
279
280
  end
280
281
  end
@@ -285,7 +286,7 @@ describe "Koala::Facebook::OAuth" do
285
286
  # since we're just composing a URL here, we don't need to have a real code
286
287
  @code ||= "test_code"
287
288
  end
288
-
289
+
289
290
  it "generates a properly formatted OAuth token URL when provided a code" do
290
291
  url = @oauth.url_for_access_token(@code)
291
292
  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
@@ -303,18 +304,18 @@ describe "Koala::Facebook::OAuth" do
303
304
  :email => "cdc@b.com"
304
305
  }
305
306
  url = @oauth.url_for_access_token(@code, params)
306
- params.each_pair do |key, value|
307
+ params.each_pair do |key, value|
307
308
  url.should =~ /[\&\?]#{key}=#{CGI.escape value}/
308
309
  end
309
310
  end
310
311
  end
311
-
312
+
312
313
  describe "#url_for_dialog" do
313
314
  it "builds the base properly" do
314
315
  dialog_type = "my_dialog_type"
315
316
  @oauth.url_for_dialog(dialog_type).should =~ /^http:\/\/#{Koala::Facebook::DIALOG_HOST}\/dialog\/#{dialog_type}/
316
317
  end
317
-
318
+
318
319
  it "adds the app_id/client_id to the url" do
319
320
  automatic_params = {:app_id => @app_id, :client_id => @client_id}
320
321
  url = @oauth.url_for_dialog("foo", automatic_params)
@@ -323,19 +324,19 @@ describe "Koala::Facebook::OAuth" do
323
324
  url.should =~ /[\&\?]#{key}=#{CGI.escape value.to_s}/
324
325
  end
325
326
  end
326
-
327
+
327
328
  it "includes any additional options as URL parameters, appropriately escaped" do
328
329
  params = {
329
330
  :url => "http://foo.bar?c=2",
330
331
  :email => "cdc@b.com"
331
332
  }
332
333
  url = @oauth.url_for_dialog("friends", params)
333
- params.each_pair do |key, value|
334
+ params.each_pair do |key, value|
334
335
  # we're slightly simplifying how encode_params works, but strings/ints, it's okay
335
336
  url.should =~ /[\&\?]#{key}=#{CGI.escape value.to_s}/
336
337
  end
337
338
  end
338
-
339
+
339
340
  describe "real examples from FB documentation" do
340
341
  # see http://developers.facebook.com/docs/reference/dialogs/
341
342
  # slightly brittle (e.g. if parameter order changes), but still useful
@@ -343,17 +344,17 @@ describe "Koala::Facebook::OAuth" do
343
344
  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")
344
345
  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}")
345
346
  end
346
-
347
+
347
348
  it "can generate a feed dialog" do
348
349
  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")
349
350
  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}")
350
351
  end
351
-
352
+
352
353
  it "can generate a oauth dialog" do
353
354
  url = @oauth.url_for_dialog("oauth", :scope => "email", :response_type => "token")
354
355
  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")
355
356
  end
356
-
357
+
357
358
  it "can generate a pay dialog" do
358
359
  url = @oauth.url_for_dialog("pay", :order_id => "foo", :credits_purchase => false)
359
360
  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}")
@@ -369,15 +370,15 @@ describe "Koala::Facebook::OAuth" do
369
370
  Koala.should_receive(:make_request).with(anything, hash_including(:redirect_uri => uri), anything, anything).and_return(Koala::HTTPService::Response.new(200, "", {}))
370
371
  @oauth.get_access_token_info(@code, :redirect_uri => uri)
371
372
  end
372
-
373
+
373
374
  it "uses the redirect_uri used to create the @oauth if no :redirect_uri option is provided" do
374
375
  Koala.should_receive(:make_request).with(anything, hash_including(:redirect_uri => @callback_url), anything, anything).and_return(Koala::HTTPService::Response.new(200, "", {}))
375
- @oauth.get_access_token_info(@code)
376
+ @oauth.get_access_token_info(@code)
376
377
  end
377
-
378
+
378
379
  it "makes a GET request" do
379
380
  Koala.should_receive(:make_request).with(anything, anything, "get", anything).and_return(Koala::HTTPService::Response.new(200, "", {}))
380
- @oauth.get_access_token_info(@code)
381
+ @oauth.get_access_token_info(@code)
381
382
  end
382
383
 
383
384
  if KoalaTest.code
@@ -390,13 +391,13 @@ describe "Koala::Facebook::OAuth" do
390
391
  result = @oauth.get_access_token_info(@code)
391
392
  result["access_token"].should
392
393
  end
393
-
394
+
394
395
  it "raises an error when get_access_token is called with a bad code" do
395
396
  lambda { @oauth.get_access_token_info("foo") }.should raise_error(Koala::Facebook::APIError)
396
397
  end
397
398
  end
398
399
  end
399
-
400
+
400
401
  describe "#get_access_token" do
401
402
  # TODO refactor these to be proper tests with stubs and tests against real data
402
403
  it "passes on any options provided to make_request" do
@@ -422,7 +423,7 @@ describe "Koala::Facebook::OAuth" do
422
423
  end
423
424
  end
424
425
  end
425
-
426
+
426
427
  unless KoalaTest.code
427
428
  it "Some OAuth code tests will not be run since the code field in facebook_data.yml is blank."
428
429
  end
@@ -445,7 +446,7 @@ describe "Koala::Facebook::OAuth" do
445
446
  end
446
447
  end
447
448
 
448
- describe "get_app_acess_token" do
449
+ describe "get_app_access_token" do
449
450
  it "uses get_access_token_info to get and parse an access token token results" do
450
451
  result = @oauth.get_app_access_token
451
452
  result.should be_a(String)
@@ -464,8 +465,47 @@ describe "Koala::Facebook::OAuth" do
464
465
  end
465
466
  end
466
467
 
467
- describe "protected methods" do
468
+ describe "exchange_access_token_info" do
469
+ if KoalaTest.mock_interface? || KoalaTest.oauth_token
470
+ it "properly gets and parses an app's access token as a hash" do
471
+ result = @oauth.exchange_access_token_info(KoalaTest.oauth_token)
472
+ result.should be_a(Hash)
473
+ end
468
474
 
475
+ it "includes the access token" do
476
+ result = @oauth.exchange_access_token_info(KoalaTest.oauth_token)
477
+ result["access_token"].should
478
+ end
479
+ else
480
+ pending "Some OAuth token exchange tests will not be run since the access token field in facebook_data.yml is blank."
481
+ end
482
+
483
+ it "passes on any options provided to make_request" do
484
+ options = {:a => 2}
485
+ Koala.should_receive(:make_request).with(anything, anything, anything, hash_including(options)).and_return(Koala::HTTPService::Response.new(200, "", {}))
486
+ @oauth.exchange_access_token_info(KoalaTest.oauth_token, options)
487
+ end
488
+
489
+ it "raises an error when exchange_access_token_info is called with a bad code" do
490
+ lambda { @oauth.exchange_access_token_info("foo") }.should raise_error(Koala::Facebook::APIError)
491
+ end
492
+ end
493
+
494
+ describe "exchange_access_token" do
495
+ it "uses get_access_token_info to get and parse an access token token results" do
496
+ hash = {"access_token" => Time.now.to_i * rand}
497
+ @oauth.stub(:exchange_access_token_info).and_return(hash)
498
+ @oauth.exchange_access_token(KoalaTest.oauth_token).should == hash["access_token"]
499
+ end
500
+
501
+ it "passes on any options provided to make_request" do
502
+ options = {:a => 2}
503
+ Koala.should_receive(:make_request).with(anything, anything, anything, hash_including(options)).and_return(Koala::HTTPService::Response.new(200, "", {}))
504
+ @oauth.exchange_access_token(KoalaTest.oauth_token, options)
505
+ end
506
+ end
507
+
508
+ describe "protected methods" do
469
509
  # protected methods
470
510
  # since these are pretty fundamental and pretty testable, we want to test them
471
511
 
@@ -623,7 +663,7 @@ describe "Koala::Facebook::OAuth" do
623
663
  OpenSSL::HMAC.stub!(:hexdigest).and_return("i'm an invalid signature")
624
664
  lambda { @oauth.parse_signed_request(@signed_request) }.should raise_error
625
665
  end
626
-
666
+
627
667
  it "throws an error if the signature string is empty" do
628
668
  # this occasionally happens due to Facebook error
629
669
  lambda { @oauth.parse_signed_request("") }.should raise_error
@@ -33,7 +33,7 @@ oauth_test_data:
33
33
  offline_access_cookies:
34
34
  # note: I've revoked the offline access for security reasons, so you can't make calls against this :)
35
35
  fbs_119908831367602: '"access_token=119908831367602|08170230801eb225068e7a70-2905623|Q3LDCYYF8CX9cstxnZLsxiR0nwg.&expires=0&secret=78abaee300b392e275072a9f2727d436&session_key=08170230801eb225068e7a70-2905623&sig=423b8aa4b6fa1f9a571955f8e929d567&uid=2905623"'
36
- valid_signed_cookies:
36
+ valid_signed_cookies:
37
37
  "fbsr_119908831367602": "f1--LHwjHVCxfs97hRHL-4cF-0jNxZRc6MGzo1qHLb0.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImNvZGUiOiIyLkFRQm90a0pBWlhVY1l3RkMuMzYwMC4xMzE0ODEzNjAwLjEtMjkwNTYyM3x4V2xya0d0UmJIZlpIclRnVWwxQmxJcVhRbjQiLCJpc3N1ZWRfYXQiOjEzMTQ4MDY2NTUsInVzZXJfaWQiOiIyOTA1NjIzIn0"
38
38
 
39
39
 
@@ -80,7 +80,7 @@ graph_api:
80
80
  batch=<%= MultiJson.encode([{"method"=>"get", "relative_url"=>"me"}, {"method"=>"get", "relative_url"=>"#{OAUTH_DATA["app_id"]}/insights?access_token=#{CGI.escape APP_ACCESS_TOKEN}"}]) %>:
81
81
  post:
82
82
  with_token: '[{"body":"{\"id\":\"123\"}"}, {"body":"{\"data\":[],\"paging\":{}}"}]'
83
- batch=<%= MultiJson.encode([{"method"=>"get", "relative_url"=>"#{OAUTH_DATA["app_id"]}/insights"}, {"method"=>"get", "relative_url"=>"koppel?access_token=#{CGI.escape APP_ACCESS_TOKEN}"}]) %>:
83
+ batch=<%= MultiJson.encode([{"method"=>"get", "relative_url"=>"2/invalidconnection"}, {"method"=>"get", "relative_url"=>"koppel?access_token=#{CGI.escape APP_ACCESS_TOKEN}"}]) %>:
84
84
  post:
85
85
  with_token: '[{"body": "{\"error\":{\"type\":\"AnError\", \"message\":\"An error occurred!.\"}}"},{"body":"{\"id\":\"123\"}"}]'
86
86
  batch=<%= MultiJson.encode([{"method"=>"post", "relative_url"=>"FEED_ITEM_BATCH/likes"}, {"method"=>"delete", "relative_url"=> "FEED_ITEM_BATCH"}]) %>:
@@ -94,7 +94,7 @@ graph_api:
94
94
  batch=<%= MultiJson.encode([{"method"=>"get", "relative_url"=>"me", "name" => "getme"}, {"method"=>"get", "relative_url"=>"koppel", "depends_on" => "getme"}]) %>:
95
95
  post:
96
96
  with_token: '[null,{"body":"{\"id\":\"123\"}"}]'
97
- batch=<%= MultiJson.encode([{"method"=>"get", "relative_url"=>"#{OAUTH_DATA["app_id"]}/insights", "name" => "getdata"}, {"method"=>"get", "relative_url"=>"koppel", "depends_on" => "getdata"}]) %>:
97
+ batch=<%= MultiJson.encode([{"method"=>"get", "relative_url"=>"2/invalidconnection", "name" => "getdata"}, {"method"=>"get", "relative_url"=>"koppel", "depends_on" => "getdata"}]) %>:
98
98
  post:
99
99
  with_token: '[{"body": "{\"error\":{\"type\":\"AnError\", \"message\":\"An error occurred!.\"}}"},null]'
100
100
  batch=<%= MultiJson.encode([{"method" => "get", "relative_url" => "me/friends?limit=5", "name" => "get-friends"}, {"method" => "get", "relative_url" => "?ids=#{CGI.escape "{result=get-friends:$.data.*.id}"}"}]) %>:
@@ -149,6 +149,9 @@ graph_api:
149
149
  message=Hello, world, from the test suite delete method!:
150
150
  post:
151
151
  with_token: '{"id": "FEED_ITEM_DELETE"}'
152
+ message=Hello, world, from the test suite delete like method!:
153
+ post:
154
+ with_token: '{"id": "FEED_ITEM_DELETE"}'
152
155
  message=Hello, world, from the test suite batch API!:
153
156
  post:
154
157
  with_token: '{"id": "FEED_ITEM_BATCH"}'
@@ -157,7 +160,7 @@ graph_api:
157
160
  with_token: '{"id": "FEED_ITEM_CONTEXT"}'
158
161
  link=http://oauth.twoalex.com/&message=body&name=It's a big question&picture=http://oauth.twoalex.com//images/logo.png&properties=<%= {"name"=>"Link1'", "text"=>"Left", "href"=>"http://oauth.twoalex.com/"}.to_s %>=<%= {"name"=>"other", "text"=>"Straight ahead"}.to_s %>&type=link:
159
162
  post:
160
- with_token: '{"id": "FEED_ITEM_CONTEXT"}'
163
+ with_token: '{"id": "FEED_ITEM_CONTEXT"}'
161
164
 
162
165
  /me/photos:
163
166
  source=[FILE]:
@@ -308,6 +311,12 @@ graph_api:
308
311
  client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&type=client_cred:
309
312
  post:
310
313
  no_token: access_token=<%= APP_ACCESS_TOKEN %>
314
+ client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&fb_exchange_token=<%= ACCESS_TOKEN %>&grant_type=fb_exchange_token:
315
+ post:
316
+ no_token: access_token=<%= ACCESS_TOKEN %>&expires=5184000
317
+ client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&fb_exchange_token=foo&grant_type=fb_exchange_token:
318
+ post:
319
+ <<: *oauth_error
311
320
  /oauth/exchange_sessions:
312
321
  client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=<%= OAUTH_DATA["session_key"] %>&type=client_cred:
313
322
  post: