koala 3.0.0.beta1 → 3.0.0.beta2
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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/changelog.md +19 -3
- data/koala.gemspec +3 -0
- data/lib/koala/api.rb +47 -19
- data/lib/koala/api/{graph_api.rb → graph_api_methods.rb} +9 -59
- data/lib/koala/api/graph_batch_api.rb +107 -62
- data/lib/koala/http_service/request.rb +1 -5
- data/lib/koala/http_service/response.rb +6 -0
- data/lib/koala/test_users.rb +5 -4
- data/lib/koala/version.rb +1 -1
- data/spec/cases/api_spec.rb +79 -51
- data/spec/cases/graph_api_batch_spec.rb +22 -22
- data/spec/cases/graph_api_spec.rb +15 -10
- data/spec/cases/graph_collection_spec.rb +3 -3
- data/spec/cases/http_service/response_spec.rb +24 -0
- data/spec/cases/test_users_spec.rb +11 -0
- data/spec/fixtures/cat.m4v +0 -0
- data/spec/fixtures/facebook_data.yml +1 -1
- data/spec/fixtures/mock_facebook_responses.yml +25 -28
- data/spec/fixtures/vcr_cassettes/app_test_accounts.yml +97 -0
- data/spec/integration/graph_collection_spec.rb +8 -5
- data/spec/support/graph_api_shared_examples.rb +142 -199
- data/spec/support/koala_test.rb +2 -4
- data/spec/support/mock_http_service.rb +3 -3
- metadata +23 -5
@@ -0,0 +1,24 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Koala::HTTPService
|
4
|
+
RSpec.describe Response do
|
5
|
+
describe "#data" do
|
6
|
+
it "returns nothing if the body is empty" do
|
7
|
+
expect(Response.new(200, "", {}).data).to be_nil
|
8
|
+
end
|
9
|
+
|
10
|
+
it "parses the JSON if there's a body" do
|
11
|
+
result = {"foo" => "bar"}
|
12
|
+
expect(Response.new(200, result.to_json, {}).data).to eq(result)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "allows raw values" do
|
16
|
+
expect(Response.new(200, "true", {}).data).to be true
|
17
|
+
end
|
18
|
+
|
19
|
+
it "raises a ParserError if it's invalid JSON" do
|
20
|
+
expect { Response.new(200, "{", {}).data }.to raise_exception(JSON::ParserError)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -271,6 +271,17 @@ describe "Koala::Facebook::TestUsers" do
|
|
271
271
|
end
|
272
272
|
@test_users.befriend(@user1, @user2, options)
|
273
273
|
end
|
274
|
+
|
275
|
+
it "includes the secret, generating the appsecret_proof in both calls if provided" do
|
276
|
+
# should come twice, once for each user
|
277
|
+
@stubbed = true
|
278
|
+
test_users = Koala::Facebook::TestUsers.new({:secret => @secret, :app_id => @app_id})
|
279
|
+
expect(Koala.http_service).to receive(:make_request).twice do |request|
|
280
|
+
expect(request.post_args).to include("appsecret_proof")
|
281
|
+
Koala::HTTPService::Response.new(200, "{}", {})
|
282
|
+
end
|
283
|
+
test_users.befriend(@user1, @user2)
|
284
|
+
end
|
274
285
|
end
|
275
286
|
end # when used without network
|
276
287
|
|
data/spec/fixtures/cat.m4v
CHANGED
Binary file
|
@@ -54,7 +54,7 @@ oauth_test_data:
|
|
54
54
|
issued_at: 1301917299
|
55
55
|
|
56
56
|
subscription_test_data:
|
57
|
-
subscription_path:
|
57
|
+
subscription_path: https://oauth.twoalex.com/subscriptions
|
58
58
|
verify_token: "myverificationtoken|1f54545d5f722733e17faae15377928f"
|
59
59
|
challenge_data:
|
60
60
|
"hub.challenge": "1290024882"
|
@@ -24,7 +24,7 @@ graph_api:
|
|
24
24
|
# Common mock item responses
|
25
25
|
item_deleted: &item_deleted
|
26
26
|
delete:
|
27
|
-
with_token: 'true'
|
27
|
+
with_token: '{"success":true}'
|
28
28
|
|
29
29
|
# OAuth error response
|
30
30
|
oauth_error: &oauth_error
|
@@ -52,39 +52,39 @@ graph_api:
|
|
52
52
|
|
53
53
|
# -- Stubbed Responses --
|
54
54
|
root:
|
55
|
-
ids=facebook,
|
55
|
+
ids=facebook,barackobama:
|
56
56
|
get:
|
57
|
-
with_token: '{"facebook":"{}","
|
58
|
-
no_token: '{"facebook":"{}","
|
57
|
+
with_token: '{"facebook":"{}","barackobama":"{}"}'
|
58
|
+
no_token: '{"facebook":"{}","barackobama":"{}"}'
|
59
59
|
|
60
60
|
# Ruby 1.8.7 and 1.9.2 generate JSON with different key ordering, hence we have to dynamically generate it here
|
61
|
-
batch=<%= JSON.dump([{"method" => "get", "relative_url" => "me"},{"method" => "get", "relative_url" => "
|
61
|
+
batch=<%= JSON.dump([{"method" => "get", "relative_url" => "me"},{"method" => "get", "relative_url" => "barackobama"}]) %>:
|
62
62
|
post:
|
63
63
|
with_token: '[{"code": 200, "body":"{\"id\":\"123\"}"}, {"code": 200, "body":"{\"id\":\"456\"}"}]'
|
64
64
|
batch=<%= JSON.dump([{"method" => "get", "relative_url" => "me/picture"}]) %>:
|
65
65
|
post:
|
66
|
-
with_token: '[{"code": 302, "headers":[{"name":"Location","value":"
|
66
|
+
with_token: '[{"code": 302, "headers":[{"name":"Location","value":"https://google.com"}]}]'
|
67
67
|
batch=<%= JSON.dump([{"method" => "get", "relative_url" => "me/picture?redirect=false"}]) %>:
|
68
68
|
post:
|
69
|
-
with_token: '[{"code": 200, "body":"{\"data\":{\"is_silhouette\":false,\"url\":\"
|
69
|
+
with_token: '[{"code": 200, "body":"{\"data\":{\"is_silhouette\":false,\"url\":\"https:\/\/google.com\"}}"}]'
|
70
70
|
batch=<%= JSON.dump([{"method" => "get", "relative_url" => "me"},{"method" => "get", "relative_url" => "me/friends"}]) %>:
|
71
71
|
post:
|
72
|
-
with_token: '[{"code": 200, "body":"{\"id\":\"
|
73
|
-
batch=<%= JSON.dump([{"method"=>"get", "relative_url"=>"me"}, {"method"=>"get", "relative_url"=>"#{OAUTH_DATA["app_id"]}/
|
72
|
+
with_token: '[{"code": 200, "body":"{\"id\":\"barackobama\"}"}, {"code": 200, "body":"{\"data\":[{\"id\":\"koppel\"}],\"paging\":{}}"}]'
|
73
|
+
batch=<%= JSON.dump([{"method"=>"get", "relative_url"=>"me"}, {"method"=>"get", "relative_url"=>"#{OAUTH_DATA["app_id"]}/app_event_types?access_token=#{CGI.escape APP_ACCESS_TOKEN}"}]) %>:
|
74
74
|
post:
|
75
75
|
with_token: '[{"code": 200, "body":"{\"id\":\"123\"}"}, {"code": 200, "body":"{\"data\":[],\"paging\":{}}"}]'
|
76
|
-
batch=<%= JSON.dump([{"method"=>"get", "relative_url"=>"2/invalidconnection"}, {"method"=>"get", "relative_url"=>"
|
76
|
+
batch=<%= JSON.dump([{"method"=>"get", "relative_url"=>"2/invalidconnection"}, {"method"=>"get", "relative_url"=>"barackobama?access_token=#{CGI.escape APP_ACCESS_TOKEN}"}]) %>:
|
77
77
|
post:
|
78
78
|
with_token: '[{"code": 400, "body": "{\"error\":{\"type\":\"AnError\", \"message\":\"An error occurred!.\"}}"},{"code": 200, "body":"{\"id\":\"123\"}"}]'
|
79
79
|
batch=<%= JSON.dump([{"method"=>"post", "relative_url"=>"FEED_ITEM_BATCH/likes"}, {"method"=>"delete", "relative_url"=> "FEED_ITEM_BATCH"}]) %>:
|
80
80
|
post:
|
81
|
-
with_token: '[{"code": 200, "body": "{\"id\": \"MOCK_LIKE\"}"},{"code": 200, "body":true}]'
|
81
|
+
with_token: '[{"code": 200, "body": "{\"id\": \"MOCK_LIKE\"}"},{"code": 200, "body":"{\"success\":true}"}]'
|
82
82
|
|
83
83
|
# dependencies
|
84
|
-
batch=<%= JSON.dump([{"method"=>"get", "relative_url"=>"me", "name" => "getme"}, {"method"=>"get", "relative_url"=>"
|
84
|
+
batch=<%= JSON.dump([{"method"=>"get", "relative_url"=>"me", "name" => "getme"}, {"method"=>"get", "relative_url"=>"barackobama", "depends_on" => "getme"}]) %>:
|
85
85
|
post:
|
86
86
|
with_token: '[null,{"code": 200, "body":"{\"id\":\"123\"}"}]'
|
87
|
-
batch=<%= JSON.dump([{"method"=>"get", "relative_url"=>"2/invalidconnection", "name" => "getdata"}, {"method"=>"get", "relative_url"=>"
|
87
|
+
batch=<%= JSON.dump([{"method"=>"get", "relative_url"=>"2/invalidconnection", "name" => "getdata"}, {"method"=>"get", "relative_url"=>"barackobama", "depends_on" => "getdata"}]) %>:
|
88
88
|
post:
|
89
89
|
with_token: '[{"code": 400, "body": "{\"error\":{\"type\":\"AnError\", \"message\":\"An error occurred!.\"}}"},null]'
|
90
90
|
batch=<%= JSON.dump([{"method" => "get", "relative_url" => "me/friends?limit=5", "name" => "get-friends"}, {"method" => "get", "relative_url" => "?ids=#{CGI.escape "{result=get-friends:$.data.*.id}"}"}]) %>:
|
@@ -106,7 +106,7 @@ graph_api:
|
|
106
106
|
batch=<%= JSON.dump([{"method"=>"post", "relative_url"=>"me/photos", "attached_files" => "op1_file0"}]) %>&op1_file0=[FILE]:
|
107
107
|
post:
|
108
108
|
with_token: '[{"code": 200, "body":"{\"id\": \"MOCK_PHOTO\"}"}]'
|
109
|
-
batch=<%= JSON.dump([{"method"=>"post", "relative_url"=>"me/photos", "attached_files" => "op1_file0"}, {"method"=>"post", "relative_url"=>"
|
109
|
+
batch=<%= JSON.dump([{"method"=>"post", "relative_url"=>"me/photos", "attached_files" => "op1_file0"}, {"method"=>"post", "relative_url"=>"barackobama/photos", "attached_files" => "op2_file0"}]) %>&op1_file0=[FILE]&op2_file0=[FILE]:
|
110
110
|
post:
|
111
111
|
with_token: '[{"code": 200, "body":"{\"id\": \"MOCK_PHOTO\"}"}, {"code": 200, "body":"{\"id\": \"MOCK_PHOTO\"}"}]'
|
112
112
|
|
@@ -192,14 +192,14 @@ graph_api:
|
|
192
192
|
<<: *token_required
|
193
193
|
with_token: '{"id": "MOCK_PHOTO_FROM_URL"}'
|
194
194
|
|
195
|
-
/
|
195
|
+
/barackobama:
|
196
196
|
no_args:
|
197
197
|
get:
|
198
198
|
with_token: '{"id": 1, "name": 1, "updated_time": 1}'
|
199
199
|
no_token: '{"id": 1, "name": 1}'
|
200
200
|
metadata=1:
|
201
201
|
get:
|
202
|
-
with_token: '{"name": "
|
202
|
+
with_token: '{"name": "Barack Obama","metadata": {"fields": [{"name": "id"}],"type": "user","connections": {}},"id": "44"}'
|
203
203
|
|
204
204
|
/facebook:
|
205
205
|
no_args:
|
@@ -207,19 +207,19 @@ graph_api:
|
|
207
207
|
with_token: '{"id": 1, "name": 1}'
|
208
208
|
no_token: '{"id": 1, "name": 1}'
|
209
209
|
|
210
|
-
/facebook/
|
210
|
+
/facebook/events:
|
211
211
|
no_args:
|
212
212
|
get:
|
213
|
-
with_token: '{"data": [{}], "paging": {"previous": "https:\/\/graph.facebook.com\/7204941866\/
|
214
|
-
no_token: '{"data": [{}], "paging": {"previous": "https:\/\/graph.facebook.com\/7204941866\/
|
213
|
+
with_token: '{"data": [{}], "paging": {"previous": "https:\/\/graph.facebook.com\/7204941866\/events?limit=25&until=2008-09-15T18%3A30%3A25%2B0000", "next": "https:\/\/graph.facebook.com\/7204941866\/events?limit=25&until=2008-09-15T18%3A30%3A25%2B0000"}}'
|
214
|
+
no_token: '{"data": [{}], "paging": {"previous": "https:\/\/graph.facebook.com\/7204941866\/events?limit=25&until=2008-09-15T18%3A30%3A25%2B0000", "next": "https:\/\/graph.facebook.com\/7204941866\/events?limit=25&until=2008-09-15T18%3A30%3A25%2B0000"}}'
|
215
215
|
|
216
|
-
/
|
216
|
+
/koppel/likes:
|
217
217
|
no_args:
|
218
218
|
get:
|
219
219
|
<<: *token_required
|
220
220
|
with_token: '{"data": [{}], "paging": {}}'
|
221
221
|
|
222
|
-
/
|
222
|
+
/koppel/picture:
|
223
223
|
no_args:
|
224
224
|
get:
|
225
225
|
no_token:
|
@@ -268,15 +268,12 @@ graph_api:
|
|
268
268
|
body: '{"error": {"type": "Exception","message": "No node specified"}}'
|
269
269
|
|
270
270
|
/search:
|
271
|
-
q=facebook:
|
271
|
+
q=facebook&type=page:
|
272
272
|
get:
|
273
273
|
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"}}'
|
274
|
-
|
275
|
-
"limit=25&q=facebook&until=<%= TEST_DATA['search_time'] %>":
|
274
|
+
"limit=25&q=facebook&type=page&until=<%= TEST_DATA['search_time'] %>":
|
276
275
|
get:
|
277
276
|
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"}}'
|
278
|
-
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"}}'
|
279
|
-
|
280
277
|
|
281
278
|
'/115349521819193_113815981982767':
|
282
279
|
no_args:
|
@@ -370,12 +367,12 @@ graph_api:
|
|
370
367
|
with_token:
|
371
368
|
code: 200
|
372
369
|
get:
|
373
|
-
with_token: '{"data":[{"callback_url":"
|
370
|
+
with_token: '{"data":[{"callback_url":"https://oauth.twoalex.com/subscriptions", "fields":["name"], "object":"user", "active":true}]}'
|
374
371
|
|
375
372
|
|
376
373
|
callback_url=<%= SUBSCRIPTION_DATA["subscription_path"] %>:
|
377
374
|
get:
|
378
|
-
with_token: '{"data":[{"callback_url":"
|
375
|
+
with_token: '{"data":[{"callback_url":"https://oauth.twoalex.com/subscriptions", "fields":["name"], "object":"user", "active":true}]}'
|
379
376
|
|
380
377
|
# -- Mock Item Responses --
|
381
378
|
|
@@ -0,0 +1,97 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://graph.facebook.com/v2.8/119908831367602/accounts?access_token=**
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.1
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
Access-Control-Allow-Origin:
|
18
|
+
- "*"
|
19
|
+
Etag:
|
20
|
+
- '"eb18193fa5a61a0264d71c9e4f4168e943ca436a"'
|
21
|
+
Pragma:
|
22
|
+
- no-cache
|
23
|
+
Cache-Control:
|
24
|
+
- private, no-cache, no-store, must-revalidate
|
25
|
+
Facebook-Api-Version:
|
26
|
+
- v2.8
|
27
|
+
Expires:
|
28
|
+
- Sat, 01 Jan 2000 00:00:00 GMT
|
29
|
+
Content-Type:
|
30
|
+
- application/json; charset=UTF-8
|
31
|
+
X-Fb-Trace-Id:
|
32
|
+
- HtQflzsMQaU
|
33
|
+
X-Fb-Rev:
|
34
|
+
- '2842759'
|
35
|
+
Vary:
|
36
|
+
- Accept-Encoding
|
37
|
+
X-Fb-Debug:
|
38
|
+
- FY3EL2d5Fp6ASXztjr4tzWFb2SjyvwosNN7GwprLYy+aZhu/+7hkS/uUjBlKREJyNCHY8AwBghZs9bo5W41Svw==
|
39
|
+
Date:
|
40
|
+
- Sat, 18 Feb 2017 16:22:30 GMT
|
41
|
+
Transfer-Encoding:
|
42
|
+
- chunked
|
43
|
+
Connection:
|
44
|
+
- keep-alive
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: '{"data":[{"id":"131686830683789","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/131686830683789\/","access_token":"EAABtDnNMkbIBAGjJ4s9beYAsY1Tzc2uMF0aUlZAi1s1O19ZCGh4mpvWQNTcfjA2OkjYoD7pjZCKZAxPGjg0isXqegKZBltzztwYOZAml4Y7J007ufSFjpTV0Eb6ZAziyD7LTK88FJZA2rGsnTe76pYJkkwg0w8VHZCDXSMpX12L6ZAWFYwYXi8zSVE73Nwh2AULZAgZD"},{"id":"114995779022706","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/114995779022706\/","access_token":"EAABtDnNMkbIBAHk5PgPdB63JMI0XvJDJJvRnLEmBXzFi4qMYyrcy9c20CoZBVwVMXhI3wSqqY2f3lA8rqvfZA3uF5jC2IgdiqzAhlksDScMJm2hKeD900815V4M2Bv581d6mrizfKySKKYXVO7OmQSOUMYjzCTcz0jIGY0QuvMdXZCCqsYlM8gQG8jrf8oZD"},{"id":"108214206368977","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/108214206368977\/","access_token":"EAABtDnNMkbIBACak3hxf98Nw657TlDW3gDbmb7bKYJnGMa1UUheSdadQKkHcNvSasObinxEd9g17wcMqmlJ62a4ssOCz0ZBqTTIvARnSZBAunZAa27r9ZBJFQeXtCV2e1G3qNr3c1BRP54XdRLsfj9G0dZAD4wcGMyk184uE5aUYxhweVZBTf1wYeZB8ZCTbAogZD"},{"id":"131778770674391","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/131778770674391\/","access_token":"EAABtDnNMkbIBAD9nLMYPqNidDiGwy1ngv388NkupZAnZAAgjHkgeNTTPNQt3MXd0w166r0WPFMSRNG7kNRf8gfsZCZCwUxGbSsrQsDeqInmfFWWGiEbIGPmWKIW9FWPToNSgIQdartLxnFEqZA4aAu21NGbvh9R9x6WmY8Fn4bDdlTKqlQQmkPVlREbRG0sYZD"},{"id":"133747960477364","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/133747960477364\/","access_token":"EAABtDnNMkbIBAIvwOmNyT1m9kWKS9UOQNo9LuYXPziW7vqFfZAqW8wrkPtpGZAQ35QHZBRDDbrsVQ7lZCFZAko13MaYgkGm9kVXhdDk1i64jUVC0dK3jajsa6AsRKvzXnr5i0I3f63o1hEEFltXvkIof9kc6ymZAxpBfvlPZBA4bOy9DX3Wy3jWEh6NkkZCtCRoZD"},{"id":"104151963442966","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/104151963442966\/","access_token":"EAABtDnNMkbIBADvEXZC93DlZBZBMA1L0NdZBV9DMtemD2GSL2MvZCO3dpLMwotOFC4YXhMIfdZAHSyIbYeyLWmpua2trkCkdqLxeipZBJ4eavsQZBrQXOzZAl1tSZBfm2mrUfZBZCVgO2ZBBSy9qB39hLronZCtEykPeSG2ILpxGMVSeXRIlfDyhPpvodbuqKCac9lLiYZD"},{"id":"100424303817312","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/100424303817312\/","access_token":"EAABtDnNMkbIBAEQx0BD5zATwZBoux1YZCSLWwL0Py40qCSsBA4ITD3cu3KzKsQZC3V7E6u0TZBxZBAZCnF3WpKt2CcLxYpYS29Eu2xlzKmPgHuxWmgxgtVtKfOfakEbitz6kZCIeg9zvMwU0zW4KZCejnOlBVRpP4pZCXg7s9mUO3roMDc0Qbg7NrUHyKYTUFRO8ZD"},{"id":"131906273995120","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/131906273995120\/","access_token":"EAABtDnNMkbIBADbZC2CLp54uRPO3ZC36txPEeFCa6cFdZBKpEnx8WHRAQa44PNgJGcsWgJtB8YBa2OqcjLqEvhPMZBuuwU4ltNvs5TEdmqhAZBxvA2wQUasq5n9tn8jvhUtyXSYCSg6GpBTEjitnsyCiKPUJTwdrf8yCtoAraPI67CGrHD1VkD0LGeGW2OmkZD"},{"id":"109566936233385","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/109566936233385\/","access_token":"EAABtDnNMkbIBAKVpbyZAYTrPoH2H4tzrn0y1RYNywzQRUZAz3sK76ZBEDzwOlbfj88ZA3WdCs2a4bbXb17TOdY5IYtJzSdevq24P6J1AIJTxdxEFgV71hIiOCVpPlnRDZCgHJgX690d81dzxIqqTXyNAFMa16cZCKIUgKuqsu8ZC6ZCArZC0ueZBFbyJ68EBbXoVQZD"},{"id":"122862174901367","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/122862174901367\/","access_token":"EAABtDnNMkbIBAAnZByPQnVgwRrDCNcbY3HX6nLyjkjZBuKgcZCbMt0vDvAdOL0JMeHYXD2ftlZCpO1pOg2mtCDRPv3OjUMCmv2TxTS3KwaLnDWMC2ud0FGkfh4ZCOjZCvHqwSlwsUWsUcRi3lleLBoyZBUXizVZCHCSdtEvfyEdh3bK3pHZBUzXZB08OfANP6q76cZD"},{"id":"127147561138873","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/127147561138873\/","access_token":"EAABtDnNMkbIBAJfcR5yPNgsTeiIXYtDYfYgZA6hayjp3mnxxQM0E8cZCn3Bjfq9Ywsozvo8dr0dFZCAzyOP4ZAi1jnUQbVnKQv4DaXLOaZAarAs1B2IxUztUV0QZCKuBOpz8PmHyc45AYoDvdQeWDz1xCbeEab3vXijDdZAhUM8OMi6IrGNYDUUoLEvuZBX17MIZD"},{"id":"126836924502797","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/126836924502797\/","access_token":"EAABtDnNMkbIBAMBMZAavwZBNW5kzkYZCzQEeIzW2udjQQvTqKmYYiFqoaOK8l6ckGx7l49ZArGI0YF31PQ1oCSh4oFxO3syL90ZCbhpgfjleYMYhIGxne3DhZCfkZCBaLiZB1lKVWZA1mam9MnTUewKOMItVJPCcUZA3sUGWnDZCaFvbwZBcHeoPvW9HmcZAXGAe3oZBsZD"},{"id":"112078279315072","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/112078279315072\/","access_token":"EAABtDnNMkbIBAKf9pfJ8ke5KV42kfCZCALLK7mPSOyvpJkCIiVyZA0at9xYus3CZBDKSw2NZBuOOiaf6cn1ipzzbPrI39LPKh9ZAOpC0Lj5PKXuYvl4OBR4GB6N32L0D4TMCZAEH2iYZBX14LpXs7ZCwsl2PWIMayOuYOff6YSu02Wt9PfZBB7JoXZAcN2SMsHnooZD"},{"id":"108723689651308","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/108723689651308\/","access_token":"EAABtDnNMkbIBADZBAeZBaOvlz64XN4WAF2m1g1g6ZCyqjdwbmIQrASEpNNqy7H0NOpUzDUquHNJi97mIjv6IdidZBUZAU2lWwSSAHmlLLB0q84QXZAZAz6xJp4xsUMMUvsNa3APcN7QhKPF4zhKmuzuu2SdYfVdVjA7I1nTQEb8CpIyP2Htu5VnZAOAdobmCTYMZD"},{"id":"114488749073472","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/114488749073472\/","access_token":"EAABtDnNMkbIBAFhIIDjbIiVuN4Q6sOHpy0fvBs0QCRykWL0gdj1OSidjvZBzMH25QUoU1HZBFXVRJZA4qTBdnjCond4ypEZAINd7jAVBt03G01tHKIhpcVSRXWk5wn3HOHpgA8GzpV8NvUZC2ymLoWrk5RZC2ZCC5UvITGP1T8EB6kFY1oLo7jVQL0criBhZClIZD"},{"id":"118718808649710","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/118718808649710\/","access_token":"EAABtDnNMkbIBAG3dfELECNObuOxFqtZAZCZCC577mkaOcpuNK6aEVpYtv9ati95qHFIECJTX9nvJ8hSSuqzB6ON7C3Yl1uMFAVdN6oiMHsUkp3zIvzIDVuAJIEoxjXIGnENURHNZBf8ZBQ4SEYIvZBXomrWlmXWUaDf1p3DvIINvEFvt8yIH4YbS7mgUynVCgZD"},{"id":"131954293990150","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/131954293990150\/","access_token":"EAABtDnNMkbIBAAavOhdJTonQYyunLEh9LmEwGOizNUlZClpz8v7evZBm7gLeEm8sWjhVRVUYhZCwbgNHGyfQg6jnn3flULM8udv9jKTxtMHyxJUBJ2ZCXuDQu3epd4IypF0TbZCYzszZCQfSZAlbfNUZC2DuBOfSIbbWhDJ06NwJxky0o68MmACma5fofKtm5yUZD"},{"id":"132106613975105","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/132106613975105\/","access_token":"EAABtDnNMkbIBADqUSUnefbp6rUmS8Ls5nQ7VAZA3VklBU2QqhDKDbtEDb4ce4GfBjPElFzeSxyq6HKxbvUmZCFvhs0ZAcKaWpWBZBNPIRa16j8A8RYZBtJ6pXTonZBo7hep7hd4oNLdhu5IX7AwR9znAbip3xirqxl3U4qQd6ZBbKk1FJkBputywWthI44ttQUZD"},{"id":"100827877110010","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/100827877110010\/","access_token":"EAABtDnNMkbIBADcgZBRa2KP7pkyvt0D29agCKSCxMQ4KUrQZBuD9QukLrpwR1Pt7G4eZCTwYQ7tq1qxoaKHTMrwIZB5tqcjbKpn9Ndee4QcYc5qG9SqYamtZBqbSW2jl3jpo4uhM6QxuTdsq0nx6IS3V3waTUbPiN4pcZC7A2zvdTrFfgX6zsMtScTSxDYJHAZD"},{"id":"127572984429742","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/127572984429742\/","access_token":"EAABtDnNMkbIBAFTOQgzYZCpHsApz6vYr7kl9ZBeWZBRrpETE7L5gcBnRTtogo85HkPgLoaDk0DGVzv1ZAQQzQLENb4wKQB5KEFfQ38Kx0SnSlKGul5oJ85EkJLvE5YZBdKZBcUsgqFjXWW0PQC3y5Xvd9WDwX3WZCa9pSNIbqVGyRutevSSN4QAhl9dXqAOzi4ZD"},{"id":"120845621770035","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/120845621770035\/","access_token":"EAABtDnNMkbIBAPcNANL59pvimIzoXtfUa4aFuZAVEyibc13VdP5NyQ6iyyRB7QUHa1ok0Yi0gVm9xMJRPbEJG00pqOgpERVx9tTStIFjCgijivQ0PeSZA4hC8PyUePwENlcpKQaPMhbgkUIiPrzGCoOMDmMUE7uqP3oEROS4QQYQaK7iZCxmUhFKZAvSaygZD"},{"id":"100373623822380","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/100373623822380\/","access_token":"EAABtDnNMkbIBAKWQD1ukUGVIcy415IrBhsIqLxVX71oVZCZCmS2ZBggu64wIb84QHkMbyS2zslfQoUxvPSFb0lWURp399szgjy91ZAD8UdUITUvzfV3i0tkMOTZByu3q5grzTs8mcL3F2b4g15kJvhZCQnIYhNHZANuZAeR2HM6oxdlZC4cyVTLVefa1hpppwHvoZD"},{"id":"132646663920907","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/132646663920907\/","access_token":"EAABtDnNMkbIBAJwiX5O3YmWu80ybTUHHJCnDymlWe4Ywzl6FkfOrhrF7xOxeOTDZCudBakoLapV3ZB5vMkBZCXhC5h2iBmlZA1n0GEHADI7BECnTvz6I33jg3z1plPvmUneFEzYIZBcJUUZASyMadwdD2ZBiJ5xNF9WRjZAKBFhbmxQGDRMZCEONtuD6OtIN0zlwZD"},{"id":"112299049292999","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/112299049292999\/","access_token":"EAABtDnNMkbIBADt7tfFmFnbhnAiSuZC69Mf1xNqsZBhClnghYrkCdR8DeF00qP2uXRTRHDV2xaNLGHMOWrkP9GmMAvF4ZBgdg0Bbug7WNMaQ4zboReTsPtgwF6noeahv5g7Urs4PfoQnHHLxJDxrffOwSpsyx4ZCUtXgBVMZArgrZBTgATLwRVZC67KfQbrzGoZD"},{"id":"111993045990341","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/111993045990341\/"}],"paging":{"cursors":{"before":"MTMxNjg2ODMwNjgzNzg5","after":"MTExOTkzMDQ1OTkwMzQx"},"next":"https:\/\/graph.facebook.com\/v2.8\/119908831367602\/accounts?access_token=119908831367602\u00257Co3wswWQ88LYjEC9-ukR_gjRIOMw&limit=25&after=MTExOTkzMDQ1OTkwMzQx"}}'
|
48
|
+
http_version:
|
49
|
+
recorded_at: Sat, 18 Feb 2017 16:22:30 GMT
|
50
|
+
- request:
|
51
|
+
method: get
|
52
|
+
uri: https://graph.facebook.com/v2.8/119908831367602/accounts?access_token=119908831367602%7Co3wswWQ88LYjEC9-ukR_gjRIOMw&after=MTExOTkzMDQ1OTkwMzQx&limit=25
|
53
|
+
body:
|
54
|
+
encoding: US-ASCII
|
55
|
+
string: ''
|
56
|
+
headers:
|
57
|
+
User-Agent:
|
58
|
+
- Faraday v0.9.1
|
59
|
+
response:
|
60
|
+
status:
|
61
|
+
code: 200
|
62
|
+
message: OK
|
63
|
+
headers:
|
64
|
+
Access-Control-Allow-Origin:
|
65
|
+
- "*"
|
66
|
+
Etag:
|
67
|
+
- '"7e9c736950aee7b006b66ad3a460119f6b8f2722"'
|
68
|
+
Pragma:
|
69
|
+
- no-cache
|
70
|
+
Cache-Control:
|
71
|
+
- private, no-cache, no-store, must-revalidate
|
72
|
+
Facebook-Api-Version:
|
73
|
+
- v2.8
|
74
|
+
Expires:
|
75
|
+
- Sat, 01 Jan 2000 00:00:00 GMT
|
76
|
+
Content-Type:
|
77
|
+
- application/json; charset=UTF-8
|
78
|
+
X-Fb-Trace-Id:
|
79
|
+
- CBypqZtNaNN
|
80
|
+
X-Fb-Rev:
|
81
|
+
- '2842759'
|
82
|
+
Vary:
|
83
|
+
- Accept-Encoding
|
84
|
+
X-Fb-Debug:
|
85
|
+
- 0LPGSvsIukRzUsa2w+m8GYTQlSxvCZsIoQSFWQgN8cu5EVjPZoEiU32DinTRbL1MW6HSAFSMIohJPMbRvnEZpQ==
|
86
|
+
Date:
|
87
|
+
- Sat, 18 Feb 2017 16:22:30 GMT
|
88
|
+
Transfer-Encoding:
|
89
|
+
- chunked
|
90
|
+
Connection:
|
91
|
+
- keep-alive
|
92
|
+
body:
|
93
|
+
encoding: UTF-8
|
94
|
+
string: '{"data":[{"id":"125798281273437","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/125798281273437\/","access_token":"EAABtDnNMkbIBAHOwQxS8RqCdzTljGrYpNTiL7gpeeZB4bS4nBZB9hSe6GGdnyj61ZAz00mhZAWJcM484SZCd8zBzxuMl7AeZBj6wLZAZBLU0r3x45VhvZBN59VNAWNbKUJdNnlm1yZCPKrWVQtrkwOZBFIaV34LJptBnpeZBhxN9FCFSZB28rtqJwVYS9iBXNnOaPCSQZD"},{"id":"114443985744460","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/114443985744460\/","access_token":"EAABtDnNMkbIBAGWSUp8zyVoOHIcVLa9WdgV50C0w5XSpadlyVbVZBj9GEvlTL0uChdJuuZBzmB7X4YL6nLzTKvqVMa8MsHzyyWuGpKsPuZCd4pRgl9hRIzmiIvCGZACvF36qWwLrrD1hWdzqtOm0OWyDv3EpZCynM2fIv1IVs8L0GYNgdWQ7hkXroozsFXN8ZD"},{"id":"100212287171639","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/100212287171639\/","access_token":"EAABtDnNMkbIBADJZC9YPfjXUw0NRJazZA92mFZCHiuuGvNJrWjbGlDYDMryYCCvFDpSa8HyqQcwqrbYkxjZB0WWs82A79gjTBxX7ZCbEjq7kWcW6UMKM4g7bHv0fow9wt1bsSWYcDKDLY3juPPbQDjqDAaTb58ZBPX0iUqq1EubyGWMwwqeCq62oZAZAtKF9XbUZD"},{"id":"117981365390106","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/117981365390106\/","access_token":"EAABtDnNMkbIBAFQHCDUjysIw0Atj8o2sx5ZAmCLjItgvp5Rd066DL6u4EISVCZAd3AQrHXLoj2cGPdsYyBwWZAGMJSvcrmDH77cOWYLtKuClnLL3cgNJSMmZAMfNXYhLldvp1MyZCF83088ifGJ8Y4jNYF2GB7MQGGma0eJ2aSrrViTPofoX7HrIbXXtmv3EZD"},{"id":"118562311998585","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/118562311998585\/","access_token":"EAABtDnNMkbIBALApADZCoqMoFzMQnMbhJq0JAjNyOqcNHPjQEXcq34ltvVVtK8vFeOOn6ZA4xU0DN0FgzTvzpVFX40IsRvRPQ2G9kUEEYQsTkJt7af2kwREGcg02MIfsxw7FOVOZAofo0dUM7OSHa11SVbUt0RlPIgeJPsU8AFVol268Ydh6tZBSAFSRbh8ZD"},{"id":"112915182564309","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/112915182564309\/","access_token":"EAABtDnNMkbIBADBs6QL7wCZBHCsKI7GwqpG8BDZCDSuip7hX3UYSwMR7XX2IwmGv5YcOAGagfMlseMYILVad5aZCD3gjE6dfJGvOjo601gMTR2UhT8ZApzIxhQdo8HqWToOxzFyjN4GzHqyOwEYX4UI56KYyfJXuPqZAL7SQIABFwoWR3IdhaP1DQAFZBODlQZD"},{"id":"121283758392614","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/121283758392614\/","access_token":"EAABtDnNMkbIBAOJa8QsC9c1aWU1D8r4z8Kp09dBqSH4gtRTzWd38UHYQnPNxelxgpHvdw6MSgRAapK7pHoiooAGZAd9fxJqd7ZAFHYjf3rvAontxIHgHNZA0UOt3bqC0DHBPCnQrR0jGJqsKOBmbMDh7n754cZBYXTaMHmimEFpFP6ET2qAr2n7TzIdptAoZD"},{"id":"109762849546914","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/109762849546914\/","access_token":"EAABtDnNMkbIBAAZAZAmjRM8OpZCroUsSGZAs0M7NgkFyHvbfzrtyj2wZCIsUCg4OnbcfjksVbZCsrPNTtSuyAVCt8ccVshwLD1Ff9lT6RHXm1Pr4pTbI6ov1CdUbQ4OZCJ9xInvZB2D1g8TjdbrgAeB2MCXQqAAa8hzATror0kidHi2T3g2wkNcPnnZClTvkKBn8ZD"},{"id":"117739112080670","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/117739112080670\/","access_token":"EAABtDnNMkbIBAG0YyZCZAz6QpRiXHTmwBDfqZAHk4jyIpbQJAeGswJZCLtY6xzjBrzewsDDZCkswuMnqMR5QvHbZCg26HdGFcneWMEQo2Uxb2VTYkuinHsyxVap3AfiVAjQBMTIxpPlERFZCnkNPUjW0Pn1rpjjbRe3ZA5Q5pvHbGUWCmCN2OfQm9FtJlagEQWwZD"},{"id":"128682634317437","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/128682634317437\/","access_token":"EAABtDnNMkbIBAFjZBZCtwoUzi5fJR73CtnXG0EQuIPOJlHEc59fTI8VibvfkpAse6KwkvzvvQZB4JGEuR0jDJ3oEFIrZA9VHm8P4UkOLab2LRK6ZAcSLI443GP3YgBZCTj8iUTL30OMyvUqLVtXFfLs7H4iVZCCosPWPP7ZBF0LuKQbszLIO1cn3IxPpbh1ZBC2MZD"},{"id":"110473496142007","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/110473496142007\/","access_token":"EAABtDnNMkbIBAMNIZAozYoZCYlzFAWNcgQcLvr8ZCdNzkydf1CIL11MZC4lgpsJsxco7omdOTujeZCTtDyKZCO2UJtedPIZAVni8ikw5fOG3yce6GsZABsvI43SVntsEbcXPtxKYwPwLaEcy8hz2rbeodnFBPM00PJcIUSslGjJKZAZA0zleVbrSA3lXLyrETTVUgZD"},{"id":"122991804887942","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/122991804887942\/","access_token":"EAABtDnNMkbIBALMHhJ8JAwwvnTh9nqrisdcHGZBMQiQvFa0qOKf0Ld7AVlZAKkI8kQz0WUBXAmZAp1nm4ft2ejZBkOYGwAuoNNdU1ruCZCBROTdZA7xzmAPD4k93yduyUjC9pkyRiTRyWAxfy3N87G5NaE8dgq9igkdEcn4A3tWncKGZAGOQZAZAflJPKYdUSA64ZD"},{"id":"134271380424517","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/134271380424517\/","access_token":"EAABtDnNMkbIBAA7Na9BLonHUubJFEFSSyEGgZBlhDaEeqdoY4g6GVfdgmZBshC20TuoBoZAw3mhVAjrsWitu9ZBbWVgxjjdo1MmLvZCrQN2oVzpDCZCGV3vAppM6ONZBEWCBkc0TvN7kkRJUKgWeGFBGiFJd7d7qH0ZAKr0N2pLM9kDfHT644S2YvIk5PBTN66sZD"},{"id":"101885090336486","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/101885090336486\/","access_token":"EAABtDnNMkbIBAM4yyUAGZAMcSg6wGn5SPRWz6CnTe789IaDo8nn7LMA2sThVJjk2nxiPoonKCKDbwx4QV9UaZCZA3snxtKHDZAkFOMsINW52n4Rh8cGAGHlTngZBMWZAO2oTEx5eIsqsr1oYZBQqhiwAdsEiGxDk3py4y3lIHUnZCjrnyX38m0ZAaZAI3h3TjMIEAZD"},{"id":"108363739686592","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/108363739686592\/","access_token":"EAABtDnNMkbIBAMh2hOT4gXx6BKZCZCZABsrRWI0kM7vZA3YSktHrMHwW2heljqZCvRo8w6SvOlfSZBcQOmOtQKM4GUkBpAzugwwtzKhEh0BpnLsHuIsT0U1ENAZBVIHjLHzK7e4poVr2mrthvTGOCe2u30S76HajsnX9uemd08AZCZBKvEqabyhVg1pVleJkYA24ZD"},{"id":"103009976890118","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/103009976890118\/","access_token":"EAABtDnNMkbIBALwG9w1699JAmpNauB1pH57taercbOF1v7OEtxk66CqSOaU9JiZBTpDRUqY5BjeLSjxsLrJRSgVFXwZCkj2xhv07gc51atV8XZA5XhRy8TNhYpmAkImJrhblNnserqmEKZBh7ZCfVSKMZB1rHsxIFTNpeSA42VVR9dZBH0XCeXA0aMsyPhxi7sZD"},{"id":"106798253176843","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/106798253176843\/","access_token":"EAABtDnNMkbIBACNoWodogmtcR62Q7o2K3MiIiQtjBZAkfoSZBYCGEUsxhvSh97DpmMcV6wMLK2glnafkm3gEgOoxohMQXYEQlxzf5QkqaDPnIgT2ZAYuP0MMJEkyyuoQ7X8I3MxB1CdGZCaGxxmDQCZArKUnLEcGSfXtd0dGUZBrLpBJpnO261vzDtWgaqZAPwZD"},{"id":"126605231192422","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/126605231192422\/","access_token":"EAABtDnNMkbIBAEXaa69QZBophJkDN2D1LbjBps27zwek5KZCNdnuVdnuxYfz5ZCntOYhfET3oyQCxQC4aSbTeaTZA84TKO0YBtfIPQsmoV4WsX7rKdtqJHv1OFZBLSlAZC59cLIswjv71ImIzzUeEdSrJuATZBiIRBdFFttLGhglI8IscAZCFZA4ZBna6ljpBSRX0ZD"},{"id":"101330510391991","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/101330510391991\/","access_token":"EAABtDnNMkbIBAMcvlgvtdKEthgcWabktKPyFRAmedZCEGiJrhEql7feYCGGYzdHZBt2dyVz32vFRy2gUZCTNW4LtmCfWECQla7vtS0wxGooIQZBtSwGuZCPxZCKyITJnQ1y7OZBAJMBnXsR1asg4KbcFegcvhqyiwdwOeUqgVEUgNfJkByrqnzM81Ws5pe0VtIZD"},{"id":"105505479973088","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/105505479973088\/","access_token":"EAABtDnNMkbIBAHsVBuHJBnDvtMBgf1HO7mSfexb463fOarEdu2ZBkinKUJAFgDfvna129s0SWdS6CdrVlBGNLXZAwfucMqXfXrSe5WwYXY8Qt7PLLZCEByyjwBJCRyQFVO6pq3F1D5Y9WTebwrl0qHUZCz7ZCr6yzh8wO7VtVMTyKpPZAlCZCEo32X3lDrZCxXQZD"},{"id":"107216613134895","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/107216613134895\/","access_token":"EAABtDnNMkbIBALuLLgaK6JS0dCAuyQIcJVQRiZAzKDBdQIUXvmN9VTrEBqCErVrKVtaxxv7xw6nrZB52DP6JhzkUDZCQtouHZBc0XyIlcmJtRghnraudvcQQHzzzX1ZCaCAnjYnep4SxZCRcbmZBguLaUoQXNygYqnvjmh1ZAUEJP8DdTu6xSzBpp0ivLJ1nCuAZD"},{"id":"134002377117793","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/134002377117793\/","access_token":"EAABtDnNMkbIBABKtcAotDo6YWjUGy9kxyI6iMmM1i6UZANrgYtPOsTJUXZBa2gDM2YiAK7hmrCPLT3k00yre62pKCEZB7dP49yVGLRLhsZABHnHRQJBnTa2wpIqLKYtAZAdUdOaAB5hb20WsI5F3iYZBT7VQWpPY5EJRZCuLxd6pLzLTjXuk7Ertmlh5GsmdRAZD"},{"id":"102515120271368","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/102515120271368\/","access_token":"EAABtDnNMkbIBAJqy3QDoH0YaOFhPcb5r0xz8ByPD05ZAtEFQTRubbPfW6EUEGNrPirUuh7IEYNRQEoZACtrL1aCZAXeWGYAb99MpokxkGZBj0clOmfsKfwNUfXubVixtTVRUvLl9B5yaS645a9jSvR6LF8VYxb1WZC8SJDiZBhdxLaOVyW7tTOlyZC2IX0VaUcZD"},{"id":"114232912430044","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/114232912430044\/","access_token":"EAABtDnNMkbIBAI7TiBwT3IYknbZAz2Xt59AJwJXDT1DysXvCZB8vzQZA3UElRj2GadxWWUHd7ZA10eYJEsvuk5zbDbsgtdSpUJaSGlJKK2ZCJfsDUHWJN3ZAQL6IpH456ErDAocT95bjvhgbUerGSO1SXze1rUWHddMJWhLjdoa8juVwgHjCJ0MFuDLBbJ2X0ZD"},{"id":"100190163838009","login_url":"https:\/\/developers.facebook.com\/checkpoint\/test-user-login\/100190163838009\/","access_token":"EAABtDnNMkbIBAKEHD5z8s5ZAEu10xVQ7mJt21pnEapDLZC240fZBQJQqAnoZBW1CgwUxZBoKG8aoOHV6npvT58ZAWxUwy7zBsuztM7KhAqi0MPQ0BuMhOtyqrjTZC8WQlh325vP3t0WJr6odmMd7l36qRAQQU2aihSM2SZAnZALTVQfuvyQLrHQLaENLDZAJmhp1wZD"}],"paging":{"cursors":{"before":"MTI1Nzk4MjgxMjczNDM3","after":"MTAwMTkwMTYzODM4MDA5"},"next":"https:\/\/graph.facebook.com\/v2.8\/119908831367602\/accounts?access_token=119908831367602\u00257Co3wswWQ88LYjEC9-ukR_gjRIOMw&limit=25&after=MTAwMTkwMTYzODM4MDA5","previous":"https:\/\/graph.facebook.com\/v2.8\/119908831367602\/accounts?access_token=119908831367602\u00257Co3wswWQ88LYjEC9-ukR_gjRIOMw&limit=25&before=MTI1Nzk4MjgxMjczNDM3"}}'
|
95
|
+
http_version:
|
96
|
+
recorded_at: Sat, 18 Feb 2017 16:22:30 GMT
|
97
|
+
recorded_with: VCR 2.9.3
|
@@ -2,16 +2,19 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Koala
|
4
4
|
RSpec.describe "requests using GraphCollections" do
|
5
|
-
let(:api) { Facebook::API.new(KoalaTest.
|
5
|
+
let(:api) { Facebook::API.new(KoalaTest.app_access_token) }
|
6
6
|
|
7
7
|
before :each do
|
8
8
|
# use the right version of the API as of the writing of this test
|
9
|
-
Koala.config.api_version = "v2.
|
9
|
+
Koala.config.api_version = "v2.8"
|
10
10
|
end
|
11
11
|
|
12
|
-
it "can access the next page of a
|
13
|
-
|
14
|
-
|
12
|
+
it "can access the next page of a test accounts" do
|
13
|
+
# NOTE: if recording this cassette again, you'll need to swap in the real access token. It's
|
14
|
+
# been manually edited out of the cassette. (Once all tests are switched to VCR this will be
|
15
|
+
# resolved.)
|
16
|
+
KoalaTest.with_vcr_unless_live("app test accounts") do
|
17
|
+
result = api.get_connection(KoalaTest.app_id, "accounts")
|
15
18
|
expect(result).not_to be_empty
|
16
19
|
expect(result.next_page).not_to be_empty
|
17
20
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
shared_examples_for "Koala GraphAPI" do
|
2
2
|
# all Graph API instances should pass these tests, regardless of configuration
|
3
|
+
let(:dummy_response) { double("fake response", data: {}, status: 200, body: "", headers: {}) }
|
3
4
|
|
4
5
|
# API
|
5
6
|
it "never uses the rest api server" do
|
@@ -13,80 +14,7 @@ shared_examples_for "Koala GraphAPI" do
|
|
13
14
|
@api.api("anything")
|
14
15
|
end
|
15
16
|
|
16
|
-
# GRAPH CALL
|
17
|
-
describe "graph_call" do
|
18
|
-
it "passes all arguments to the api method" do
|
19
|
-
user = KoalaTest.user1
|
20
|
-
args = {}
|
21
|
-
verb = 'get'
|
22
|
-
opts = {:a => :b}
|
23
|
-
expect(@api).to receive(:api).with(user, args, verb, opts)
|
24
|
-
@api.graph_call(user, args, verb, opts)
|
25
|
-
end
|
26
|
-
|
27
|
-
it "throws an APIError if the result hash has an error key" do
|
28
|
-
allow(Koala).to receive(:make_request).and_return(Koala::HTTPService::Response.new(500, '{"error": "An error occurred!"}', {}))
|
29
|
-
expect { @api.graph_call(KoalaTest.user1, {}) }.to raise_exception(Koala::Facebook::APIError)
|
30
|
-
end
|
31
|
-
|
32
|
-
it "passes the results through GraphCollection.evaluate" do
|
33
|
-
result = {}
|
34
|
-
allow(@api).to receive(:api).and_return(result)
|
35
|
-
expect(Koala::Facebook::API::GraphCollection).to receive(:evaluate).with(result, @api)
|
36
|
-
@api.graph_call("/me")
|
37
|
-
end
|
38
|
-
|
39
|
-
it "returns the results of GraphCollection.evaluate" do
|
40
|
-
expected = {}
|
41
|
-
allow(@api).to receive(:api).and_return([])
|
42
|
-
expect(Koala::Facebook::API::GraphCollection).to receive(:evaluate).and_return(expected)
|
43
|
-
expect(@api.graph_call("/me")).to eq(expected)
|
44
|
-
end
|
45
|
-
|
46
|
-
it "returns the post_processing block's results if one is supplied" do
|
47
|
-
other_result = [:a, 2, :three]
|
48
|
-
block = Proc.new {|r| other_result}
|
49
|
-
allow(@api).to receive(:api).and_return({})
|
50
|
-
expect(@api.graph_call("/me", {}, "get", {}, &block)).to eq(other_result)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
# SEARCH
|
55
|
-
it "can search" do
|
56
|
-
result = @api.search("facebook")
|
57
|
-
expect(result.length).to be_an(Integer)
|
58
|
-
end
|
59
|
-
|
60
17
|
# DATA
|
61
|
-
# access public info
|
62
|
-
|
63
|
-
# get_object
|
64
|
-
it "gets public data about a user" do
|
65
|
-
result = @api.get_object(KoalaTest.user1)
|
66
|
-
# the results should have an ID and a name, among other things
|
67
|
-
expect(result["id"] && result["name"]).not_to be_nil
|
68
|
-
end
|
69
|
-
|
70
|
-
it "gets public data about a Page" do
|
71
|
-
result = @api.get_object(KoalaTest.page)
|
72
|
-
# the results should have an ID and a name, among other things
|
73
|
-
expect(result["id"] && result["name"]).to be_truthy
|
74
|
-
end
|
75
|
-
|
76
|
-
it "returns [] from get_objects if passed an empty array" do
|
77
|
-
results = @api.get_objects([])
|
78
|
-
expect(results).to eq([])
|
79
|
-
end
|
80
|
-
|
81
|
-
it "gets multiple objects" do
|
82
|
-
results = @api.get_objects([KoalaTest.page, KoalaTest.user1])
|
83
|
-
expect(results.size).to eq(2)
|
84
|
-
end
|
85
|
-
|
86
|
-
it "gets multiple objects if they're a string" do
|
87
|
-
results = @api.get_objects("facebook,#{KoalaTest.user1}")
|
88
|
-
expect(results.size).to eq(2)
|
89
|
-
end
|
90
18
|
|
91
19
|
describe "#get_picture" do
|
92
20
|
it "can access a user's picture" do
|
@@ -123,27 +51,6 @@ shared_examples_for "Koala GraphAPI" do
|
|
123
51
|
end
|
124
52
|
end
|
125
53
|
|
126
|
-
it "can access connections from public Pages" do
|
127
|
-
result = @api.get_connections(KoalaTest.page, "photos")
|
128
|
-
expect(result).to be_a(Array)
|
129
|
-
end
|
130
|
-
|
131
|
-
it "can access comments for a URL" do
|
132
|
-
result = @api.get_comments_for_urls(["http://developers.facebook.com/blog/post/472"])
|
133
|
-
expect(result["http://developers.facebook.com/blog/post/472"]).to be_truthy
|
134
|
-
end
|
135
|
-
|
136
|
-
it "can access comments for 2 URLs" do
|
137
|
-
result = @api.get_comments_for_urls(["http://developers.facebook.com/blog/post/490", "http://developers.facebook.com/blog/post/472"])
|
138
|
-
expect(result["http://developers.facebook.com/blog/post/490"] && result["http://developers.facebook.com/blog/post/472"]).to be_truthy
|
139
|
-
end
|
140
|
-
|
141
|
-
# SEARCH
|
142
|
-
it "can search" do
|
143
|
-
result = @api.search("facebook")
|
144
|
-
expect(result.length).to be_an(Integer)
|
145
|
-
end
|
146
|
-
|
147
54
|
# PAGING THROUGH COLLECTIONS
|
148
55
|
# see also graph_collection_tests
|
149
56
|
it "makes a request for a page when provided a specific set of page params" do
|
@@ -151,17 +58,44 @@ shared_examples_for "Koala GraphAPI" do
|
|
151
58
|
expect(@api).to receive(:graph_call).with(*query)
|
152
59
|
@api.get_page(query)
|
153
60
|
end
|
61
|
+
end
|
154
62
|
|
155
|
-
|
156
|
-
|
157
|
-
|
63
|
+
|
64
|
+
shared_examples_for "Koala GraphAPI with an access token" do
|
65
|
+
let(:dummy_response) { double("fake response", data: {}, status: 200, body: "", headers: {}) }
|
66
|
+
|
67
|
+
it "gets public data about a user" do
|
68
|
+
result = @api.get_object(KoalaTest.user1)
|
158
69
|
# the results should have an ID and a name, among other things
|
159
|
-
expect(result["id"] && result["name"]).
|
70
|
+
expect(result["id"] && result["name"]).not_to be_nil
|
160
71
|
end
|
161
|
-
end
|
162
72
|
|
73
|
+
it "gets public data about a Page" do
|
74
|
+
begin
|
75
|
+
Koala::Utils.level = 0
|
76
|
+
result = @api.get_object(KoalaTest.page)
|
77
|
+
# the results should have an ID and a name, among other things
|
78
|
+
expect(result["id"] && result["name"]).to be_truthy
|
79
|
+
ensure
|
80
|
+
Koala::Utils.level = Logger::ERROR
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
it "returns [] from get_objects if passed an empty array" do
|
85
|
+
results = @api.get_objects([])
|
86
|
+
expect(results).to eq([])
|
87
|
+
end
|
88
|
+
|
89
|
+
it "gets multiple objects" do
|
90
|
+
results = @api.get_objects([KoalaTest.page, KoalaTest.user1])
|
91
|
+
expect(results.size).to eq(2)
|
92
|
+
end
|
93
|
+
|
94
|
+
it "gets multiple objects if they're a string" do
|
95
|
+
results = @api.get_objects("facebook,#{KoalaTest.user1}")
|
96
|
+
expect(results.size).to eq(2)
|
97
|
+
end
|
163
98
|
|
164
|
-
shared_examples_for "Koala GraphAPI with an access token" do
|
165
99
|
it "gets private data about a user" do
|
166
100
|
result = @api.get_object(KoalaTest.user1)
|
167
101
|
# updated_time should be a pretty fixed test case
|
@@ -174,8 +108,18 @@ shared_examples_for "Koala GraphAPI with an access token" do
|
|
174
108
|
end
|
175
109
|
|
176
110
|
it "gets multiple objects" do
|
177
|
-
|
178
|
-
|
111
|
+
begin
|
112
|
+
Koala::Utils.level = 0
|
113
|
+
result = @api.get_objects([KoalaTest.page, KoalaTest.user1])
|
114
|
+
expect(result.length).to eq(2)
|
115
|
+
ensure
|
116
|
+
Koala::Utils.level = Logger::ERROR
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
it "can access connections from public Pages" do
|
121
|
+
result = @api.get_connections(KoalaTest.page, "events")
|
122
|
+
expect(result).to be_a(Array)
|
179
123
|
end
|
180
124
|
|
181
125
|
describe "#get_object_metadata" do
|
@@ -186,10 +130,16 @@ shared_examples_for "Koala GraphAPI with an access token" do
|
|
186
130
|
end
|
187
131
|
|
188
132
|
it "can access connections from users" do
|
189
|
-
result = @api.get_connections(KoalaTest.user2, "
|
133
|
+
result = @api.get_connections(KoalaTest.user2, "likes")
|
190
134
|
expect(result.length).to be > 0
|
191
135
|
end
|
192
136
|
|
137
|
+
# SEARCH
|
138
|
+
it "can search" do
|
139
|
+
result = @api.search("facebook", type: "page")
|
140
|
+
expect(result.length).to be_an(Integer)
|
141
|
+
end
|
142
|
+
|
193
143
|
# PUT
|
194
144
|
it "can write an object to the graph" do
|
195
145
|
result = @api.put_wall_post("Hello, world, from the test suite!")
|
@@ -202,7 +152,7 @@ shared_examples_for "Koala GraphAPI with an access token" do
|
|
202
152
|
result = @api.put_wall_post("Hello, world, from the test suite delete method!")
|
203
153
|
object_id_to_delete = result["id"]
|
204
154
|
delete_result = @api.delete_object(object_id_to_delete)
|
205
|
-
expect(delete_result).to eq(true)
|
155
|
+
expect(delete_result).to eq("success" => true)
|
206
156
|
end
|
207
157
|
|
208
158
|
it "can delete likes" do
|
@@ -210,7 +160,7 @@ shared_examples_for "Koala GraphAPI with an access token" do
|
|
210
160
|
@temporary_object_id = result["id"]
|
211
161
|
@api.put_like(@temporary_object_id)
|
212
162
|
delete_like_result = @api.delete_like(@temporary_object_id)
|
213
|
-
expect(delete_like_result).to eq(true)
|
163
|
+
expect(delete_like_result).to eq("success" => true)
|
214
164
|
end
|
215
165
|
|
216
166
|
# additional put tests
|
@@ -253,52 +203,53 @@ shared_examples_for "Koala GraphAPI with an access token" do
|
|
253
203
|
end
|
254
204
|
|
255
205
|
describe "#put_picture" do
|
256
|
-
|
257
|
-
content_type
|
258
|
-
file
|
206
|
+
context "with a file object" do
|
207
|
+
let(:content_type) { "image/jpg" }
|
208
|
+
let(:file) { File.open(File.join(File.dirname(__FILE__), "..", "fixtures", "beach.jpg")) }
|
209
|
+
let(:file_path) { File.join(File.dirname(__FILE__), "..", "fixtures", "beach.jpg") }
|
259
210
|
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
it "can post photos to the user's wall without an open file object" do
|
266
|
-
content_type = "image/jpg",
|
267
|
-
file_path = File.join(File.dirname(__FILE__), "..", "fixtures", "beach.jpg")
|
211
|
+
it "can post photos to the user's wall with an open file object" do
|
212
|
+
result = @api.put_picture(file, content_type)
|
213
|
+
@temporary_object_id = result["id"]
|
214
|
+
expect(@temporary_object_id).not_to be_nil
|
215
|
+
end
|
268
216
|
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
217
|
+
it "can post photos to the user's wall without an open file object" do
|
218
|
+
result = @api.put_picture(file_path, content_type)
|
219
|
+
@temporary_object_id = result["id"]
|
220
|
+
expect(@temporary_object_id).not_to be_nil
|
221
|
+
end
|
273
222
|
|
274
|
-
|
275
|
-
|
276
|
-
file_path = File.join(File.dirname(__FILE__), "..", "fixtures", "beach.jpg")
|
223
|
+
it "can verify a photo posted to a user's wall" do
|
224
|
+
expected_message = "This is the test message"
|
277
225
|
|
278
|
-
|
226
|
+
result = @api.put_picture(file_path, content_type, :message => expected_message)
|
227
|
+
@temporary_object_id = result["id"]
|
228
|
+
expect(@temporary_object_id).not_to be_nil
|
279
229
|
|
280
|
-
|
281
|
-
|
282
|
-
|
230
|
+
get_result = @api.get_object(@temporary_object_id)
|
231
|
+
expect(get_result["name"]).to eq(expected_message)
|
232
|
+
end
|
283
233
|
|
284
|
-
|
285
|
-
|
234
|
+
it "passes options and block through" do
|
235
|
+
opts = {a: 2}
|
236
|
+
block = Proc.new {}
|
237
|
+
expect(@api).to receive(:graph_call).with(anything, anything, anything, hash_including(opts), &block)
|
238
|
+
@api.put_picture(file_path, content_type, {:message => "my message"}, "target", opts, &block)
|
239
|
+
end
|
286
240
|
end
|
287
241
|
|
288
|
-
|
289
242
|
describe "using a URL instead of a file" do
|
290
|
-
|
291
|
-
@url = "http://img.slate.com/images/redesign2008/slate_logo.gif"
|
292
|
-
end
|
243
|
+
let(:url) { "http://img.slate.com/images/redesign2008/slate_logo.gif" }
|
293
244
|
|
294
245
|
it "can post photo to the user's wall using a URL" do
|
295
|
-
result = @api.put_picture(
|
246
|
+
result = @api.put_picture(url)
|
296
247
|
@temporary_object_id = result["id"]
|
297
248
|
expect(@temporary_object_id).not_to be_nil
|
298
249
|
end
|
299
250
|
|
300
|
-
it "can post photo to the user's wall using
|
301
|
-
result = @api.put_picture(
|
251
|
+
it "can post photo to the user's wall using aurl and an additional param" do
|
252
|
+
result = @api.put_picture(url, :message => "my message")
|
302
253
|
@temporary_object_id = result["id"]
|
303
254
|
expect(@temporary_object_id).not_to be_nil
|
304
255
|
end
|
@@ -306,10 +257,8 @@ shared_examples_for "Koala GraphAPI with an access token" do
|
|
306
257
|
end
|
307
258
|
|
308
259
|
describe "#put_video" do
|
309
|
-
|
310
|
-
|
311
|
-
@content_type = "video/mpeg4"
|
312
|
-
end
|
260
|
+
let(:cat_movie) { File.join(File.dirname(__FILE__), "..", "fixtures", "cat.m4v") }
|
261
|
+
let(:content_type) { "video/mpeg4" }
|
313
262
|
|
314
263
|
it "sets options[:video] to true" do
|
315
264
|
source = double("UploadIO")
|
@@ -319,16 +268,24 @@ shared_examples_for "Koala GraphAPI with an access token" do
|
|
319
268
|
@api.put_video("foo")
|
320
269
|
end
|
321
270
|
|
271
|
+
it "passes options and block through" do
|
272
|
+
opts = {a: 2}
|
273
|
+
block = Proc.new {}
|
274
|
+
expect(@api).to receive(:graph_call).with(anything, anything, anything, hash_including(opts), &block)
|
275
|
+
file = File.open(cat_movie)
|
276
|
+
@api.put_video(file, content_type, {}, "target", opts, &block)
|
277
|
+
end
|
278
|
+
|
322
279
|
it "can post videos to the user's wall with an open file object" do
|
323
|
-
file = File.open(
|
280
|
+
file = File.open(cat_movie)
|
324
281
|
|
325
|
-
result = @api.put_video(file,
|
282
|
+
result = @api.put_video(file, content_type)
|
326
283
|
@temporary_object_id = result["id"]
|
327
284
|
expect(@temporary_object_id).not_to be_nil
|
328
285
|
end
|
329
286
|
|
330
287
|
it "can post videos to the user's wall without an open file object" do
|
331
|
-
result = @api.put_video(
|
288
|
+
result = @api.put_video(cat_movie, content_type)
|
332
289
|
@temporary_object_id = result["id"]
|
333
290
|
expect(@temporary_object_id).not_to be_nil
|
334
291
|
end
|
@@ -336,21 +293,17 @@ shared_examples_for "Koala GraphAPI with an access token" do
|
|
336
293
|
# note: Facebook doesn't post videos immediately to the wall, due to processing time
|
337
294
|
# during which get_object(video_id) will return false
|
338
295
|
# hence we can't do the same verify test we do for photos
|
296
|
+
describe "using aurl instead of a file" do
|
297
|
+
let(:url) { "http://techslides.com/demos/sample-videos/small.mp4" }
|
339
298
|
|
340
|
-
|
341
|
-
|
342
|
-
before :each do
|
343
|
-
@url = "http://techslides.com/demos/sample-videos/small.mp4"
|
344
|
-
end
|
345
|
-
|
346
|
-
it "can post photo to the user's wall using a URL" do
|
347
|
-
result = @api.put_video(@url)
|
299
|
+
it "can post photo to the user's wall using aurl" do
|
300
|
+
result = @api.put_video(url)
|
348
301
|
@temporary_object_id = result["id"]
|
349
302
|
expect(@temporary_object_id).not_to be_nil
|
350
303
|
end
|
351
304
|
|
352
|
-
it "can post photo to the user's wall using
|
353
|
-
result = @api.put_video(
|
305
|
+
it "can post photo to the user's wall using aurl and an additional param" do
|
306
|
+
result = @api.put_video(url, :description => "my message")
|
354
307
|
@temporary_object_id = result["id"]
|
355
308
|
expect(@temporary_object_id).not_to be_nil
|
356
309
|
end
|
@@ -365,7 +318,7 @@ shared_examples_for "Koala GraphAPI with an access token" do
|
|
365
318
|
|
366
319
|
# make sure the result we fetch includes all the parameters we sent
|
367
320
|
it_matches = attachment.inject(true) {|valid, param| valid && (get_result[param[0]] == attachment[param[0]])}
|
368
|
-
expect(it_matches).to
|
321
|
+
expect(it_matches).to be true
|
369
322
|
end
|
370
323
|
|
371
324
|
it "can comment on an object" do
|
@@ -394,7 +347,8 @@ shared_examples_for "Koala GraphAPI with an access token" do
|
|
394
347
|
it "can like an object" do
|
395
348
|
result = @api.put_wall_post("Hello, world, from the test suite, testing liking!")
|
396
349
|
@temporary_object_id = result["id"]
|
397
|
-
|
350
|
+
app_api = Koala::Facebook::API.new(@app_access_token)
|
351
|
+
like_result = app_api.put_like(@temporary_object_id)
|
398
352
|
expect(like_result).to be_truthy
|
399
353
|
end
|
400
354
|
|
@@ -402,14 +356,14 @@ shared_examples_for "Koala GraphAPI with an access token" do
|
|
402
356
|
describe "#get_page_access_token" do
|
403
357
|
it "gets the page object with the access_token field" do
|
404
358
|
# we can't test this live since test users (or random real users) can't be guaranteed to have pages to manage
|
405
|
-
expect(@api).to receive(:api).with("my_page", hash_including({:fields => "access_token"}), "get", anything)
|
359
|
+
expect(@api).to receive(:api).with("my_page", hash_including({:fields => "access_token"}), "get", anything).and_return(dummy_response)
|
406
360
|
@api.get_page_access_token("my_page")
|
407
361
|
end
|
408
362
|
|
409
363
|
it "merges in any other arguments" do
|
410
364
|
# we can't test this live since test users (or random real users) can't be guaranteed to have pages to manage
|
411
365
|
args = {:a => 3}
|
412
|
-
expect(@api).to receive(:api).with("my_page", hash_including(args), "get", anything)
|
366
|
+
expect(@api).to receive(:api).with("my_page", hash_including(args), "get", anything).and_return(dummy_response)
|
413
367
|
@api.get_page_access_token("my_page", args)
|
414
368
|
end
|
415
369
|
end
|
@@ -455,37 +409,22 @@ shared_examples_for "Koala GraphAPI with an access token" do
|
|
455
409
|
# we run the tests here (rather than in the common shared example group)
|
456
410
|
# since some require access tokens
|
457
411
|
describe "HTTP options" do
|
458
|
-
# Each of the below methods should take an options hash as their last argument
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
:
|
466
|
-
:
|
467
|
-
:
|
468
|
-
:
|
469
|
-
|
470
|
-
:search => 3,
|
471
|
-
:set_app_restrictions => 4,
|
472
|
-
:get_page_access_token => 3,
|
473
|
-
# methods that have special arguments
|
474
|
-
:get_comments_for_urls => [["url1", "url2"], {}],
|
475
|
-
:put_picture => ["x.jpg", "image/jpg", {}, "me"],
|
476
|
-
:put_video => ["x.mp4", "video/mpeg4", {}, "me"],
|
477
|
-
:get_objects => [["x"], {}]
|
478
|
-
}.each_pair do |method_name, params|
|
412
|
+
# Each of the below methods should take an options hash as their last argument.
|
413
|
+
[
|
414
|
+
:get_object,
|
415
|
+
:get_connections,
|
416
|
+
:put_wall_post,
|
417
|
+
:put_comment,
|
418
|
+
:put_like,
|
419
|
+
:search,
|
420
|
+
:set_app_restrictions,
|
421
|
+
:get_page_access_token,
|
422
|
+
:get_objects
|
423
|
+
].each do |method_name|
|
479
424
|
it "passes http options through for #{method_name}" do
|
480
|
-
|
481
|
-
|
482
|
-
expect(
|
483
|
-
|
484
|
-
# if we supply args, use them (since some methods process params)
|
485
|
-
# the method should receive as args n-1 anythings and then options
|
486
|
-
args = (params.is_a?(Integer) ? ([{}] * (params - 1)) : params) + [options]
|
487
|
-
|
488
|
-
@api.send(method_name, *args)
|
425
|
+
params = @api.method(method_name).parameters
|
426
|
+
expect(params.last).to eq([:block, :block])
|
427
|
+
expect(params[-2]).to eq([:opt, :options])
|
489
428
|
end
|
490
429
|
end
|
491
430
|
|
@@ -497,15 +436,25 @@ shared_examples_for "Koala GraphAPI with an access token" do
|
|
497
436
|
@api.send(:get_picture, "x", {}, options)
|
498
437
|
end
|
499
438
|
end
|
439
|
+
|
440
|
+
# Beta tier
|
441
|
+
# In theory this is usable by both but so few operations now allow access without a token
|
442
|
+
it "can use the beta tier" do
|
443
|
+
result = @api.get_object(KoalaTest.user1, {}, :beta => true)
|
444
|
+
# the results should have an ID and a name, among other things
|
445
|
+
expect(result["id"] && result["name"]).to be_truthy
|
446
|
+
end
|
500
447
|
end
|
501
448
|
|
502
449
|
|
503
450
|
# GraphCollection
|
504
451
|
shared_examples_for "Koala GraphAPI with GraphCollection" do
|
452
|
+
let(:dummy_response) { double("fake response", data: {}, status: 200, body: "", headers: {}) }
|
453
|
+
|
505
454
|
describe "when getting a collection" do
|
506
455
|
# GraphCollection methods
|
507
456
|
it "gets a GraphCollection when getting connections" do
|
508
|
-
@result = @api.get_connections(KoalaTest.page, "
|
457
|
+
@result = @api.get_connections(KoalaTest.page, "events")
|
509
458
|
expect(@result).to be_a(Koala::Facebook::API::GraphCollection)
|
510
459
|
end
|
511
460
|
|
@@ -516,43 +465,37 @@ shared_examples_for "Koala GraphAPI with GraphCollection" do
|
|
516
465
|
end
|
517
466
|
|
518
467
|
it "gets a GraphCollection when searching" do
|
519
|
-
result = @api.search("facebook")
|
468
|
+
result = @api.search("facebook", type: "page")
|
520
469
|
expect(result).to be_a(Koala::Facebook::API::GraphCollection)
|
521
470
|
end
|
522
471
|
|
523
472
|
it "returns nil if the search call fails with nil" do
|
524
473
|
# this happens sometimes
|
525
474
|
expect(@api).to receive(:graph_call).and_return(nil)
|
526
|
-
expect(@api.search("facebook")).to be_nil
|
475
|
+
expect(@api.search("facebook", type: "page")).to be_nil
|
527
476
|
end
|
528
477
|
|
529
478
|
it "gets a GraphCollection when paging through results" do
|
530
|
-
@results = @api.get_page(["search", {"q"=>"facebook", "limit"=>"25", "until"=> KoalaTest.search_time}])
|
479
|
+
@results = @api.get_page(["search", {"q"=>"facebook", "type" => "page", "limit"=>"25", "until"=> KoalaTest.search_time}])
|
531
480
|
expect(@results).to be_a(Koala::Facebook::API::GraphCollection)
|
532
481
|
end
|
533
482
|
|
534
483
|
it "returns nil if the page call fails with nil" do
|
535
484
|
# this happens sometimes
|
536
485
|
expect(@api).to receive(:graph_call).and_return(nil)
|
537
|
-
expect(@api.get_page(["search", {"q"=>"facebook", "limit"=>"25", "until"=> KoalaTest.search_time}])).to be_nil
|
486
|
+
expect(@api.get_page(["search", {"q"=>"facebook", "type" => "page", "limit"=>"25", "until"=> KoalaTest.search_time}])).to be_nil
|
538
487
|
end
|
539
488
|
end
|
540
489
|
end
|
541
490
|
|
542
491
|
|
543
492
|
shared_examples_for "Koala GraphAPI without an access token" do
|
544
|
-
it "can't get private data about a user" do
|
545
|
-
result = @api.get_object(KoalaTest.user1)
|
546
|
-
# updated_time should be a pretty fixed test case
|
547
|
-
expect(result["updated_time"]).to be_nil
|
548
|
-
end
|
549
|
-
|
550
493
|
it "can't get data about 'me'" do
|
551
494
|
expect { @api.get_object("me") }.to raise_error(Koala::Facebook::ClientError)
|
552
495
|
end
|
553
496
|
|
554
497
|
it "can't access connections from users" do
|
555
|
-
expect { @api.get_connections(KoalaTest.user2, "
|
498
|
+
expect { @api.get_connections(KoalaTest.user2, "likes") }.to raise_error(Koala::Facebook::ClientError)
|
556
499
|
end
|
557
500
|
|
558
501
|
it "can't put an object" do
|