fb_graph 2.7.14 → 2.7.15
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/README.rdoc +7 -0
- data/VERSION +1 -1
- data/lib/fb_graph/connections/permissions.rb +11 -10
- data/lib/fb_graph/node.rb +5 -1
- data/spec/fb_graph/connections/permissions_spec.rb +34 -28
- 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: 368ca9c527e97ab552c51958ff0614ea86dd0d8b
|
4
|
+
data.tar.gz: 5ff8b37a4ea646ccb4a912848ba0cf7e782fee28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ad52e162c283b9e57293a7d351fcd6e5ff8af8896cae381bc3e55674221fda4607d5c7a349b53f61765c2284647e7a8cba091c64c37aea5b72cf0ef7be560e0
|
7
|
+
data.tar.gz: eda16eacf3f3aeac3dc05e038a45e26e6517c6eb5c31bf1fa19f7d313a9f978b641f4eeb391a75fe2f1bcbda56fe672e48de83f1f37c8c1d4795db688ca837bc
|
data/README.rdoc
CHANGED
@@ -15,6 +15,13 @@ A full-stack Facebook Graph API wrapper in Ruby.
|
|
15
15
|
* Subscribe Update Info (https://www.facebook.com/FbGraph)
|
16
16
|
* Q&A on Google Groups (http://groups.google.com/group/fb_graph)
|
17
17
|
|
18
|
+
== Graph API v2.0
|
19
|
+
|
20
|
+
FbGraph is basically developed for v1.0, and could be buggy for v2.0.
|
21
|
+
|
22
|
+
Along with adding v2 support to this gem, I also started to develop fb_graph2 as Graph API v2.0 client library.
|
23
|
+
https://github.com/nov/fb_graph2
|
24
|
+
|
18
25
|
== Examples
|
19
26
|
|
20
27
|
Now FbGraph supports all objects listed here: http://developers.facebook.com/docs/reference/api/
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.7.
|
1
|
+
2.7.15
|
@@ -2,17 +2,18 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module Permissions
|
4
4
|
def permissions(options = {})
|
5
|
-
|
6
|
-
|
5
|
+
self.connection(:permissions, options).try(:inject, []) do |arr, entry|
|
6
|
+
if entry.include? :status
|
7
|
+
# v2.0
|
7
8
|
arr << entry[:permission].to_sym if entry[:status] == 'granted'
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
9
|
+
else
|
10
|
+
# v1.0
|
11
|
+
entry.each do |key, value|
|
12
|
+
arr << key.to_sym if value.to_i == 1
|
13
|
+
end
|
14
|
+
end
|
15
|
+
arr
|
16
|
+
end || []
|
16
17
|
end
|
17
18
|
|
18
19
|
def revoke!(permission = nil, options = {})
|
data/lib/fb_graph/node.rb
CHANGED
@@ -90,7 +90,11 @@ module FbGraph
|
|
90
90
|
alias_method :cache_collection, :cache_collections
|
91
91
|
|
92
92
|
def build_endpoint(params = {})
|
93
|
-
|
93
|
+
_endpoint_ = URI.parse self.endpoint
|
94
|
+
if api_version = params.delete(:api_version)
|
95
|
+
_endpoint_.path = File.join('/', api_version, _endpoint_.path)
|
96
|
+
end
|
97
|
+
File.join([_endpoint_.to_s, params.delete(:connection), params.delete(:connection_scope)].compact.collect(&:to_s))
|
94
98
|
end
|
95
99
|
|
96
100
|
def build_params(params)
|
@@ -29,40 +29,46 @@ describe FbGraph::Connections::Permissions do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
context 'v2 API' do
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
).with(
|
37
|
-
request_for(:get, { :params => { :access_token => 'access_token' } })
|
38
|
-
).to_return(
|
39
|
-
{ body: response }
|
40
|
-
)
|
41
|
-
end
|
32
|
+
context 'using global config' do
|
33
|
+
before(:each) do
|
34
|
+
FbGraph.v2!
|
35
|
+
end
|
42
36
|
|
43
|
-
|
44
|
-
|
45
|
-
|
37
|
+
after(:each) do
|
38
|
+
FbGraph.v1!
|
39
|
+
end
|
46
40
|
|
47
|
-
|
48
|
-
|
49
|
-
|
41
|
+
it 'should be an Array of Hash' do
|
42
|
+
mock_graph :get, 'v2.0/me/permissions', 'users/permissions/v2', :access_token => 'access_token' do
|
43
|
+
permissions = FbGraph::User.me('access_token').permissions
|
44
|
+
permissions.should be_instance_of Array
|
45
|
+
permissions.should_not be_blank
|
46
|
+
permissions.each do |permission|
|
47
|
+
permission.should be_instance_of Symbol
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
50
51
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
52
|
+
context 'when blank' do
|
53
|
+
it 'should return blank array' do
|
54
|
+
mock_graph :get, 'v2.0/me/permissions', 'users/permissions/blank', :access_token => 'access_token' do
|
55
|
+
permissions = FbGraph::User.me('access_token').permissions
|
56
|
+
permissions.should == []
|
57
|
+
end
|
58
|
+
end
|
58
59
|
end
|
59
60
|
end
|
60
61
|
|
61
|
-
context '
|
62
|
-
it 'should
|
63
|
-
|
64
|
-
|
65
|
-
|
62
|
+
context 'using local config' do
|
63
|
+
it 'should be an Array of Hash' do
|
64
|
+
mock_graph :get, 'v2.0/me/permissions', 'users/permissions/v2', :access_token => 'access_token' do
|
65
|
+
permissions = FbGraph::User.me('access_token').permissions(:api_version => 'v2.0')
|
66
|
+
permissions.should be_instance_of Array
|
67
|
+
permissions.should_not be_blank
|
68
|
+
permissions.each do |permission|
|
69
|
+
permission.should be_instance_of Symbol
|
70
|
+
end
|
71
|
+
end
|
66
72
|
end
|
67
73
|
end
|
68
74
|
end
|