g5_facebook_api_client 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/g5_facebook_api_client/base.rb +4 -3
- data/lib/g5_facebook_api_client/insights.rb +0 -6
- data/lib/g5_facebook_api_client/page.rb +0 -6
- data/lib/g5_facebook_api_client/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/page_posts.yml +96 -0
- data/spec/lib/g5_facebook_api_client/page_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c92bda38f7895cb56b46bfe0c236d16167f484b3
|
4
|
+
data.tar.gz: a7c62283635ce6a4216206d6cc2e17779b390e3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd9e96f72bd9fbe29cf4cd79fbc9cc790331735ba747772486d6ebf34f6ccf4d2df27a273c08dc256694691a8c7e810b9d3fd8dd65d11d6ded1c816288e9df71
|
7
|
+
data.tar.gz: 8544cef227b494e40cf8afd026b602a76227fef28e99cb850f58dad943e379b2fd8c0b7ea007c016e47d00eab50f17a7471e03071b99ccfa8660de42c359421e
|
data/README.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
class G5FacebookApiClient::Base
|
2
|
-
def initialize(client_id
|
3
|
-
@client_id = client_id
|
4
|
-
@client_secret = client_secret
|
2
|
+
def initialize(client_id, client_secret, page=nil)
|
3
|
+
@client_id = client_id
|
4
|
+
@client_secret = client_secret
|
5
|
+
@page = page
|
5
6
|
end
|
6
7
|
|
7
8
|
def access_token
|
@@ -1,12 +1,6 @@
|
|
1
1
|
class G5FacebookApiClient::Insights < G5FacebookApiClient::Base
|
2
2
|
RESOURCE = "insights"
|
3
3
|
|
4
|
-
def initialize(page, client_id=nil, client_secret=nil)
|
5
|
-
@page = page
|
6
|
-
@client_id = client_id || ENV["FACEBOOK_ID"]
|
7
|
-
@client_secret = client_secret || ENV["FACEBOOK_SECRET"]
|
8
|
-
end
|
9
|
-
|
10
4
|
def page_likes
|
11
5
|
parse(request(resource("page_fans_locale/lifetime")))
|
12
6
|
end
|
@@ -1,12 +1,6 @@
|
|
1
1
|
class G5FacebookApiClient::Page < G5FacebookApiClient::Base
|
2
2
|
LIMIT = 20
|
3
3
|
|
4
|
-
def initialize(page, client_id=nil, client_secret=nil)
|
5
|
-
@page = page
|
6
|
-
@client_id = client_id || ENV["FACEBOOK_ID"]
|
7
|
-
@client_secret = client_secret || ENV["FACEBOOK_SECRET"]
|
8
|
-
end
|
9
|
-
|
10
4
|
def posts
|
11
5
|
parse(get(posts_uri))
|
12
6
|
end
|
@@ -240,4 +240,100 @@ http_interactions:
|
|
240
240
|
string: '{"error":{"message":"An access token is required to request this resource.","type":"OAuthException","code":104}}'
|
241
241
|
http_version:
|
242
242
|
recorded_at: Tue, 16 Dec 2014 17:41:43 GMT
|
243
|
+
- request:
|
244
|
+
method: get
|
245
|
+
uri: https://graph.facebook.com/oauth/access_token?client_id=GetG5&client_secret=121584141274833&grant_type=client_credentials
|
246
|
+
body:
|
247
|
+
encoding: US-ASCII
|
248
|
+
string: ''
|
249
|
+
headers:
|
250
|
+
Accept-Encoding:
|
251
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
252
|
+
Accept:
|
253
|
+
- "*/*"
|
254
|
+
User-Agent:
|
255
|
+
- Ruby
|
256
|
+
response:
|
257
|
+
status:
|
258
|
+
code: 500
|
259
|
+
message: Internal Server Error
|
260
|
+
headers:
|
261
|
+
Www-Authenticate:
|
262
|
+
- OAuth "Facebook Platform" "unknown_error" "An unknown error has occurred."
|
263
|
+
Facebook-Api-Version:
|
264
|
+
- v1.0
|
265
|
+
Content-Type:
|
266
|
+
- application/json; charset=UTF-8
|
267
|
+
Pragma:
|
268
|
+
- no-cache
|
269
|
+
Access-Control-Allow-Origin:
|
270
|
+
- "*"
|
271
|
+
X-Fb-Rev:
|
272
|
+
- '1533836'
|
273
|
+
Cache-Control:
|
274
|
+
- no-store
|
275
|
+
Expires:
|
276
|
+
- Sat, 01 Jan 2000 00:00:00 GMT
|
277
|
+
X-Fb-Debug:
|
278
|
+
- UPb/gf/W7M7nGj5IddwhRwTO8Xg1nqfz0FOMp244qSk/uGaaIKWJpyLwU9Nz1S/39X0K8N5SwLgkqjqRvYtFzQ==
|
279
|
+
Date:
|
280
|
+
- Tue, 16 Dec 2014 19:20:07 GMT
|
281
|
+
Connection:
|
282
|
+
- keep-alive
|
283
|
+
Content-Length:
|
284
|
+
- '87'
|
285
|
+
body:
|
286
|
+
encoding: UTF-8
|
287
|
+
string: '{"error":{"message":"An unknown error has occurred.","type":"OAuthException","code":1}}'
|
288
|
+
http_version:
|
289
|
+
recorded_at: Tue, 16 Dec 2014 19:20:07 GMT
|
290
|
+
- request:
|
291
|
+
method: get
|
292
|
+
uri: https://graph.facebook.com/b0d3826624470f5f5c3e70ce70893ed4/posts?fields=likes.limit(1).summary(true),shares,message,id,created_time,from&limit=20&%7B%22error%22:%7B%22message%22:%22An%20unknown%20error%20has%20occurred.%22,%22type%22:%22OAuthException%22,%22code%22:1%7D%7D
|
293
|
+
body:
|
294
|
+
encoding: US-ASCII
|
295
|
+
string: ''
|
296
|
+
headers:
|
297
|
+
Accept-Encoding:
|
298
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
299
|
+
Accept:
|
300
|
+
- "*/*"
|
301
|
+
User-Agent:
|
302
|
+
- Ruby
|
303
|
+
response:
|
304
|
+
status:
|
305
|
+
code: 404
|
306
|
+
message: Not Found
|
307
|
+
headers:
|
308
|
+
Www-Authenticate:
|
309
|
+
- 'OAuth "Facebook Platform" "not_found" "(#803) Some of the aliases you requested
|
310
|
+
do not exist: b0d3826624470f5f5c3e70ce70893ed4"'
|
311
|
+
Facebook-Api-Version:
|
312
|
+
- v1.0
|
313
|
+
Content-Type:
|
314
|
+
- application/json; charset=UTF-8
|
315
|
+
Pragma:
|
316
|
+
- no-cache
|
317
|
+
Access-Control-Allow-Origin:
|
318
|
+
- "*"
|
319
|
+
X-Fb-Rev:
|
320
|
+
- '1533836'
|
321
|
+
Cache-Control:
|
322
|
+
- no-store
|
323
|
+
Expires:
|
324
|
+
- Sat, 01 Jan 2000 00:00:00 GMT
|
325
|
+
X-Fb-Debug:
|
326
|
+
- BU9jFBCSmXreG7gUXsbyU6BGDTtPltS199ebtz5MwvjNqJL5a2W0JTp9TWqd5N7T0+06bgZk1VSnconHk8I6vA==
|
327
|
+
Date:
|
328
|
+
- Tue, 16 Dec 2014 19:20:07 GMT
|
329
|
+
Connection:
|
330
|
+
- keep-alive
|
331
|
+
Content-Length:
|
332
|
+
- '146'
|
333
|
+
body:
|
334
|
+
encoding: UTF-8
|
335
|
+
string: '{"error":{"message":"(#803) Some of the aliases you requested do not
|
336
|
+
exist: b0d3826624470f5f5c3e70ce70893ed4","type":"OAuthException","code":803}}'
|
337
|
+
http_version:
|
338
|
+
recorded_at: Tue, 16 Dec 2014 19:20:07 GMT
|
243
339
|
recorded_with: VCR 2.9.3
|
@@ -4,7 +4,7 @@ describe G5FacebookApiClient::Page do
|
|
4
4
|
let(:page_id) { "GetG5" }
|
5
5
|
let(:client_id) { "121584141274833" }
|
6
6
|
let(:client_secret) { "b0d3826624470f5f5c3e70ce70893ed4" }
|
7
|
-
let(:page) { described_class.new(
|
7
|
+
let(:page) { described_class.new(client_id, client_secret, page_id) }
|
8
8
|
|
9
9
|
describe "#posts" do
|
10
10
|
subject { VCR.use_cassette("page_posts") { page.posts } }
|