fb_graph 1.2.2 → 1.2.3
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.
- data/VERSION +1 -1
- data/fb_graph.gemspec +297 -288
- data/lib/fb_graph/project.rb +31 -0
- data/lib/fb_graph/query.rb +3 -0
- data/lib/fb_graph/test_user.rb +2 -2
- data/lib/fb_graph/work.rb +7 -1
- data/lib/fb_graph.rb +1 -0
- data/spec/fake_json/query/user/with_invalid_token.json +1 -0
- data/spec/fake_json/query/user/with_valid_token.json +1 -0
- data/spec/fake_json/query/user/without_token.json +1 -0
- data/spec/fake_json/true.json +1 -0
- data/spec/fake_json/users/me_private.json +106 -60
- data/spec/fb_graph/project_spec.rb +34 -0
- data/spec/fb_graph/query/core_spec.rb +68 -0
- data/spec/fb_graph/test_user_spec.rb +44 -0
- data/spec/fb_graph/work_spec.rb +20 -0
- data/spec/helpers/fake_json_helper.rb +18 -0
- metadata +17 -7
- data/.gitignore +0 -21
@@ -0,0 +1,31 @@
|
|
1
|
+
module FbGraph
|
2
|
+
class Project < Page
|
3
|
+
attr_accessor :with, :start_date, :end_date
|
4
|
+
|
5
|
+
def initialize(identifier, attributes = {})
|
6
|
+
super
|
7
|
+
@with = []
|
8
|
+
if attributes[:with]
|
9
|
+
attributes[:with].each do |user|
|
10
|
+
@with << User.new(user.delete(:id), user)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
if attributes[:start_date]
|
14
|
+
year, month = attributes[:start_date].split('-').collect(&:to_i)
|
15
|
+
@start_date = if month == 0
|
16
|
+
Date.new(year)
|
17
|
+
else
|
18
|
+
Date.new(year, month)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
if attributes[:end_date]
|
22
|
+
year, month = attributes[:end_date].split('-').collect(&:to_i)
|
23
|
+
@end_date = if month == 0
|
24
|
+
Date.new(year)
|
25
|
+
else
|
26
|
+
Date.new(year, month)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/fb_graph/query.rb
CHANGED
data/lib/fb_graph/test_user.rb
CHANGED
@@ -38,11 +38,11 @@ module FbGraph
|
|
38
38
|
:connection => :friends,
|
39
39
|
:connection_scope => test_user.identifier
|
40
40
|
)
|
41
|
-
post
|
41
|
+
test_user.send :post, {
|
42
42
|
:access_token => test_user.access_token,
|
43
43
|
:connection => :friends,
|
44
44
|
:connection_scope => self.identifier
|
45
|
-
|
45
|
+
}
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
data/lib/fb_graph/work.rb
CHANGED
@@ -2,7 +2,7 @@ module FbGraph
|
|
2
2
|
class Work
|
3
3
|
include Comparison
|
4
4
|
|
5
|
-
attr_accessor :employer, :location, :position, :start_date, :end_date
|
5
|
+
attr_accessor :employer, :location, :position, :projects, :start_date, :end_date
|
6
6
|
|
7
7
|
def initialize(attributes = {})
|
8
8
|
if (employer = attributes[:employer])
|
@@ -14,6 +14,12 @@ module FbGraph
|
|
14
14
|
if (position = attributes[:position])
|
15
15
|
@position = Page.new(position.delete(:id), position)
|
16
16
|
end
|
17
|
+
@projects = []
|
18
|
+
if attributes[:projects]
|
19
|
+
attributes[:projects].each do |project|
|
20
|
+
@projects << Project.new(project.delete(:id), project)
|
21
|
+
end
|
22
|
+
end
|
17
23
|
if attributes[:start_date] && attributes[:start_date] != '0000-00'
|
18
24
|
year, month = attributes[:start_date].split('-').collect(&:to_i)
|
19
25
|
@start_date = if month == 0
|
data/lib/fb_graph.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"error_code":190,"error_msg":"Invalid OAuth 2.0 Access Token","request_args":[{"key":"method","value":"fql.query"},{"key":"access_token","value":"token"},{"key":"format","value":"json"},{"key":"query","value":"SELECT uid FROM user WHERE uid = me()"}]}
|
@@ -0,0 +1 @@
|
|
1
|
+
[{"uid":579612276}]
|
@@ -0,0 +1 @@
|
|
1
|
+
{}
|
@@ -0,0 +1 @@
|
|
1
|
+
true
|
@@ -4,112 +4,147 @@
|
|
4
4
|
"first_name": "Nov",
|
5
5
|
"last_name": "Matake",
|
6
6
|
"link": "http://www.facebook.com/matake",
|
7
|
-
"about": "I'm a Ruby on Rails Developer on smart.fm",
|
8
7
|
"birthday": "12/13/1981",
|
9
8
|
"hometown": {
|
10
|
-
"id": 112359252112966,
|
9
|
+
"id": "112359252112966",
|
11
10
|
"name": "Hirakata, Osaka"
|
12
11
|
},
|
13
12
|
"location": {
|
14
|
-
"id": 108449982512946,
|
13
|
+
"id": "108449982512946",
|
15
14
|
"name": "Kawasaki, Kanagawa"
|
16
15
|
},
|
16
|
+
"bio": "I'm a Ruby on Rails Developer on smart.fm",
|
17
|
+
"quotes": "\u6c42\u3081\u306a\u3055\u3044\u3002\u305d\u3046\u3059\u308c\u3070\u3001\u4e0e\u3048\u3089\u308c\u308b\u3002\r\n\u63a2\u3057\u306a\u3055\u3044\u3002\u305d\u3046\u3059\u308c\u3070\u3001\u898b\u3064\u304b\u308b\u3002\r\n\u9580\u3092\u305f\u305f\u304d\u306a\u3055\u3044\u3002\u305d\u3046\u3059\u308c\u3070\u3001\u958b\u304b\u308c\u308b\u3002\r\n\u3060\u308c\u3067\u3082\u3001\u6c42\u3081\u308b\u8005\u306f\u53d7\u3051\u3001\u63a2\u3059\u8005\u306f\u898b\u3064\u3051\u3001\u9580\u3092\u305f\u305f\u304f\u8005\u306b\u306f\u958b\u304b\u308c\u308b\u3002\r\n\r\n\u3042\u306a\u305f\u304c\u305f\u306e\u3060\u308c\u304c\u3001\u30d1\u30f3\u3092\u6b32\u3057\u304c\u308b\u81ea\u5206\u306e\u5b50\u4f9b\u306b\u3001\u77f3\u3092\u4e0e\u3048\u308b\u3060\u308d\u3046\u304b\u3002\u9b5a\u3092\u6b32\u3057\u304c\u308b\u306e\u306b\u3001\u86c7\u3092\u4e0e\u3048\u308b\u3060\u308d\u3046\u304b\u3002\r\n\r\n\u3053\u306e\u3088\u3046\u306b\u3001\u3042\u306a\u305f\u304c\u305f\u306f\u60aa\u3044\u8005\u3067\u3042\u308a\u306a\u304c\u3089\u3082\u3001\u81ea\u5206\u306e\u5b50\u4f9b\u306b\u826f\u3044\u7269\u3092\u4e0e\u3048\u308b\u3053\u3068\u3092\u77e5\u3063\u3066\u3044\u308b\u3002\u307e\u3057\u3066\u3001\u3042\u306a\u305f\u304c\u305f\u306e\u5929\u306e\u7236\u306f\u3001\u6c42\u3081\u308b\u8005\u306b\u826f\u3044\u7269\u3092\u304f\u3060\u3055\u308b\u306b\u3061\u304c\u3044\u306a\u3044\u3002\r\n\r\n\u3060\u304b\u3089\u3001\u4eba\u306b\u3057\u3066\u3082\u3089\u3044\u305f\u3044\u3068\u601d\u3046\u3053\u3068\u306f\u4f55\u3067\u3082\u3001\u3042\u306a\u305f\u304c\u305f\u3082\u4eba\u306b\u3057\u306a\u3055\u3044\u3002\r\n\r\n\u3053\u308c\u3053\u305d\u3001\u5f8b\u6cd5\u3068\u9810\u8a00\u8005\u3067\u3042\u308b\u3002",
|
17
18
|
"work": [
|
18
19
|
{
|
19
20
|
"employer": {
|
20
|
-
"id":
|
21
|
-
"name": "Cerego Japan
|
21
|
+
"id": "168674439825608",
|
22
|
+
"name": "Cerego Japan"
|
22
23
|
},
|
23
24
|
"location": {
|
24
|
-
"id":
|
25
|
-
"name": "Shibuya"
|
25
|
+
"id": "112261372122567",
|
26
|
+
"name": "Shibuya, Tokyo"
|
26
27
|
},
|
27
28
|
"position": {
|
28
|
-
"id":
|
29
|
-
"name": "
|
29
|
+
"id": "116439701737440",
|
30
|
+
"name": "Rails Developer"
|
30
31
|
},
|
31
|
-
"start_date": "2008-
|
32
|
-
"end_date": "0000-00"
|
32
|
+
"start_date": "2008-10",
|
33
|
+
"end_date": "0000-00",
|
34
|
+
"projects": [
|
35
|
+
{
|
36
|
+
"id": "139390256117606",
|
37
|
+
"name": "Smart.fm",
|
38
|
+
"start_date": "2009-03"
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"id": "166213200088679",
|
42
|
+
"name": "iKnow!",
|
43
|
+
"start_date": "2008-10",
|
44
|
+
"end_date": "2009-02"
|
45
|
+
}
|
46
|
+
]
|
33
47
|
},
|
34
48
|
{
|
35
49
|
"employer": {
|
36
|
-
"id":
|
37
|
-
"name": "
|
38
|
-
},
|
39
|
-
"location": {
|
40
|
-
"id": 111736052177472,
|
41
|
-
"name": "Tokyo, Tokyo"
|
50
|
+
"id": "110398398982373",
|
51
|
+
"name": "\u30c9\u30ea\u30b3\u30e0"
|
42
52
|
},
|
43
53
|
"position": {
|
44
|
-
"id":
|
45
|
-
"name": "Web
|
54
|
+
"id": "114582978558535",
|
55
|
+
"name": "Web-developer"
|
46
56
|
},
|
47
|
-
"start_date": "
|
48
|
-
"end_date": "2008-09"
|
57
|
+
"start_date": "2006-01",
|
58
|
+
"end_date": "2008-09",
|
59
|
+
"projects": [
|
60
|
+
{
|
61
|
+
"id": "184246058253896",
|
62
|
+
"name": "Drecom Blog",
|
63
|
+
"with": [
|
64
|
+
{
|
65
|
+
"id": "1064067203",
|
66
|
+
"name": "Takanori Ishikawa"
|
67
|
+
}
|
68
|
+
],
|
69
|
+
"start_date": "2008-04",
|
70
|
+
"end_date": "2008-09"
|
71
|
+
},
|
72
|
+
{
|
73
|
+
"id": "180894985272562",
|
74
|
+
"name": "Resumy",
|
75
|
+
"with": [
|
76
|
+
{
|
77
|
+
"id": "1064067203",
|
78
|
+
"name": "Takanori Ishikawa"
|
79
|
+
}
|
80
|
+
],
|
81
|
+
"start_date": "2008-01",
|
82
|
+
"end_date": "2008-05"
|
83
|
+
},
|
84
|
+
{
|
85
|
+
"id": "129047983826039",
|
86
|
+
"name": "Drecom Wanted",
|
87
|
+
"with": [
|
88
|
+
{
|
89
|
+
"id": "581259565",
|
90
|
+
"name": "Hiroumi Mitani"
|
91
|
+
}
|
92
|
+
],
|
93
|
+
"start_date": "2006-04",
|
94
|
+
"end_date": "2007-12"
|
95
|
+
}
|
96
|
+
]
|
49
97
|
}
|
50
98
|
],
|
51
99
|
"education": [
|
52
100
|
{
|
53
101
|
"school": {
|
54
|
-
"id":
|
55
|
-
"name": "
|
56
|
-
},
|
57
|
-
"degree": {
|
58
|
-
"id": 110616875633830,
|
59
|
-
"name": "Master of Engineering"
|
102
|
+
"id": "109239532428621",
|
103
|
+
"name": "Doshisha University"
|
60
104
|
},
|
61
105
|
"year": {
|
62
|
-
"id":
|
63
|
-
"name": "
|
106
|
+
"id": "141016309258708",
|
107
|
+
"name": "2004"
|
64
108
|
},
|
65
109
|
"concentration": [
|
66
110
|
{
|
67
|
-
"id":
|
68
|
-
"name": "
|
69
|
-
},
|
70
|
-
{
|
71
|
-
"id": 102358546472290,
|
72
|
-
"name": "Intelligent Information"
|
73
|
-
},
|
74
|
-
{
|
75
|
-
"id": 108311762535367,
|
76
|
-
"name": "Intelligent Systems Design Laboratory"
|
111
|
+
"id": "123326981016954",
|
112
|
+
"name": "engineering"
|
77
113
|
}
|
78
|
-
]
|
114
|
+
],
|
115
|
+
"type": "College"
|
79
116
|
},
|
80
117
|
{
|
81
118
|
"school": {
|
82
|
-
"id":
|
83
|
-
"name": "
|
119
|
+
"id": "109239532428621",
|
120
|
+
"name": "Doshisha University"
|
121
|
+
},
|
122
|
+
"degree": {
|
123
|
+
"id": "114462511951178",
|
124
|
+
"name": "Engineering"
|
84
125
|
},
|
85
126
|
"year": {
|
86
|
-
"id":
|
87
|
-
"name": "
|
127
|
+
"id": "122604561117941",
|
128
|
+
"name": "2007"
|
88
129
|
},
|
89
130
|
"concentration": [
|
90
131
|
{
|
91
|
-
"id":
|
92
|
-
"name": "
|
93
|
-
},
|
94
|
-
{
|
95
|
-
"id": 120973077930419,
|
96
|
-
"name": "Engineering"
|
97
|
-
},
|
98
|
-
{
|
99
|
-
"id": 114592028573050,
|
100
|
-
"name": "Intelligent Information"
|
132
|
+
"id": "123326981016954",
|
133
|
+
"name": "engineering"
|
101
134
|
}
|
102
|
-
]
|
135
|
+
],
|
136
|
+
"type": "Graduate School"
|
103
137
|
},
|
104
138
|
{
|
105
139
|
"school": {
|
106
|
-
"id":
|
107
|
-
"name": "Doshisha
|
140
|
+
"id": "108125045896334",
|
141
|
+
"name": "Doshisha High School"
|
108
142
|
},
|
109
143
|
"year": {
|
110
|
-
"id":
|
144
|
+
"id": "125324724167172",
|
111
145
|
"name": "2000"
|
112
|
-
}
|
146
|
+
},
|
147
|
+
"type": "High School"
|
113
148
|
}
|
114
149
|
],
|
115
150
|
"gender": "male",
|
@@ -123,6 +158,17 @@
|
|
123
158
|
"relationship_status": "Married",
|
124
159
|
"website": "http://matake.jp",
|
125
160
|
"timezone": 9,
|
161
|
+
"locale": "en_US",
|
162
|
+
"languages": [
|
163
|
+
{
|
164
|
+
"id": "109549852396760",
|
165
|
+
"name": "Japanese"
|
166
|
+
},
|
167
|
+
{
|
168
|
+
"id": "106059522759137",
|
169
|
+
"name": "English"
|
170
|
+
}
|
171
|
+
],
|
126
172
|
"verified": true,
|
127
|
-
"updated_time": "2010-
|
173
|
+
"updated_time": "2010-12-11T08:33:47+0000"
|
128
174
|
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '../spec_helper')
|
2
|
+
|
3
|
+
describe FbGraph::Project, '.new' do
|
4
|
+
|
5
|
+
it 'should setup all supported attributes' do
|
6
|
+
attributes = {
|
7
|
+
:id => 184246058253896,
|
8
|
+
:name => "Drecom Blog",
|
9
|
+
:with => [{
|
10
|
+
:id => 1064067203,
|
11
|
+
:name => "Takanori Ishikawa"
|
12
|
+
}],
|
13
|
+
:start_date => "2008-04",
|
14
|
+
:end_date => "2008-09"
|
15
|
+
}
|
16
|
+
project = FbGraph::Project.new(attributes.delete(:id), attributes)
|
17
|
+
project.with.should == [FbGraph::User.new(1064067203, :name => "Takanori Ishikawa")]
|
18
|
+
project.start_date.should == Date.new(2008, 4)
|
19
|
+
project.end_date.should == Date.new(2008, 9)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should treat 2008-00 style date' do
|
23
|
+
attributes = {
|
24
|
+
:id => 184246058253896,
|
25
|
+
:name => "Drecom Blog",
|
26
|
+
:start_date => "2008-00",
|
27
|
+
:end_date => "2009-00"
|
28
|
+
}
|
29
|
+
project = FbGraph::Project.new(attributes.delete(:id), attributes)
|
30
|
+
project.start_date.should == Date.new(2008)
|
31
|
+
project.end_date.should == Date.new(2009)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '../../spec_helper')
|
2
|
+
|
3
|
+
describe FbGraph::Query, '.new' do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@raw_query = 'SELECT uid FROM user WHERE uid = me()'
|
7
|
+
@query = FbGraph::Query.new(@raw_query, 'access_token')
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should setup query and access_token' do
|
11
|
+
@query.query.should == @raw_query
|
12
|
+
@query.access_token.should == 'access_token'
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should setup proper endpoint' do
|
16
|
+
endpoint = @query.send :build_endpoint
|
17
|
+
params = {
|
18
|
+
:query => @raw_query,
|
19
|
+
:format => :json,
|
20
|
+
:access_token => 'access_token'
|
21
|
+
}
|
22
|
+
endpoint.should == "#{FbGraph::Query::ENDPOINT}?#{params.to_query}"
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
describe FbGraph::Query, '.fetch' do
|
28
|
+
|
29
|
+
before do
|
30
|
+
@raw_query = 'SELECT uid FROM user WHERE uid = me()'
|
31
|
+
@query = FbGraph::Query.new(@raw_query)
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'when no access token given' do
|
35
|
+
before do
|
36
|
+
fake_fql_json @raw_query, 'query/user/without_token'
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should return blank Hash' do
|
40
|
+
response = @query.fetch
|
41
|
+
response.should == {}
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'when invalid access token given' do
|
46
|
+
before do
|
47
|
+
fake_fql_json @raw_query, 'query/user/with_invalid_token', :access_token => 'invalid'
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should raise exception' do
|
51
|
+
lambda do
|
52
|
+
@query.fetch('invalid')
|
53
|
+
end.should raise_error(FbGraph::Exception)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'when valid access token given' do
|
58
|
+
before do
|
59
|
+
fake_fql_json @raw_query, 'query/user/with_valid_token', :access_token => 'valid'
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'should return an Array of Hash' do
|
63
|
+
response = @query.fetch('valid')
|
64
|
+
response.should == [{'uid' => 579612276}]
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '../spec_helper')
|
2
|
+
|
3
|
+
describe FbGraph::TestUser, '.new' do
|
4
|
+
|
5
|
+
it 'should setup all supported attributes' do
|
6
|
+
attributes = {
|
7
|
+
:id => 12345,
|
8
|
+
:access_token => 'access_token',
|
9
|
+
:login_url => 'https://www.facebook.com/login/test-user/12345'
|
10
|
+
}
|
11
|
+
test_user = FbGraph::TestUser.new(attributes.delete(:id), attributes)
|
12
|
+
test_user.login_url.should == 'https://www.facebook.com/login/test-user/12345'
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
describe FbGraph::TestUser, '.friend!' do
|
18
|
+
|
19
|
+
before do
|
20
|
+
@u1 = FbGraph::TestUser.new(111, :access_token => 'token1')
|
21
|
+
@u2 = FbGraph::TestUser.new(222, :access_token => 'token2')
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should POST twice' do
|
25
|
+
lambda do
|
26
|
+
@u1.friend! @u2
|
27
|
+
end.should raise_error(
|
28
|
+
FakeWeb::NetConnectNotAllowedError,
|
29
|
+
"Real HTTP connections are disabled. Unregistered request: POST https://graph.facebook.com/111/friends/222"
|
30
|
+
)
|
31
|
+
fake_json(:post, '111/friends/222', 'true')
|
32
|
+
lambda do
|
33
|
+
@u1.friend! @u2
|
34
|
+
end.should raise_error(
|
35
|
+
FakeWeb::NetConnectNotAllowedError,
|
36
|
+
"Real HTTP connections are disabled. Unregistered request: POST https://graph.facebook.com/222/friends/111"
|
37
|
+
)
|
38
|
+
fake_json(:post, '222/friends/111', 'true')
|
39
|
+
lambda do
|
40
|
+
@u1.friend! @u2
|
41
|
+
end.should_not raise_error(FakeWeb::NetConnectNotAllowedError)
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
data/spec/fb_graph/work_spec.rb
CHANGED
@@ -16,6 +16,16 @@ describe FbGraph::Work, '.new' do
|
|
16
16
|
:id => 111091815582753,
|
17
17
|
:name => "Web Engineer"
|
18
18
|
},
|
19
|
+
:projects => [{
|
20
|
+
:id => 184246058253896,
|
21
|
+
:name => "Drecom Blog",
|
22
|
+
:with => [{
|
23
|
+
:id => 1064067203,
|
24
|
+
:name => "Takanori Ishikawa"
|
25
|
+
}],
|
26
|
+
:start_date => "2008-04",
|
27
|
+
:end_date => "2008-09"
|
28
|
+
}],
|
19
29
|
:start_date => "2007-04",
|
20
30
|
:end_date => "2008-09"
|
21
31
|
}
|
@@ -32,6 +42,16 @@ describe FbGraph::Work, '.new' do
|
|
32
42
|
111091815582753,
|
33
43
|
:name => "Web Engineer"
|
34
44
|
)
|
45
|
+
work.projects.should == [FbGraph::Project.new(
|
46
|
+
184246058253896,
|
47
|
+
:name => "Drecom Blog",
|
48
|
+
:with => [{
|
49
|
+
:id => 1064067203,
|
50
|
+
:name => "Takanori Ishikawa"
|
51
|
+
}],
|
52
|
+
:start_date => "2008-04",
|
53
|
+
:end_date => "2008-09"
|
54
|
+
)]
|
35
55
|
work.start_date.should == Date.new(2007, 4)
|
36
56
|
work.end_date.should == Date.new(2008, 9)
|
37
57
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
module FakeJsonHelper
|
2
|
+
|
2
3
|
def fake_json(method, path, file_path, options = {})
|
3
4
|
FakeWeb.register_uri(
|
4
5
|
method,
|
@@ -8,4 +9,21 @@ module FakeJsonHelper
|
|
8
9
|
)
|
9
10
|
)
|
10
11
|
end
|
12
|
+
|
13
|
+
def fake_fql_json(query, file_path, options = {})
|
14
|
+
params = {
|
15
|
+
:query => query,
|
16
|
+
:access_token => options[:access_token],
|
17
|
+
:format => :json
|
18
|
+
}
|
19
|
+
params.delete_if do |k, v|
|
20
|
+
v.blank?
|
21
|
+
end
|
22
|
+
FakeWeb.register_uri(
|
23
|
+
:get,
|
24
|
+
FbGraph::Query::ENDPOINT + '?' + params.to_query,
|
25
|
+
:body => File.read(File.join(File.dirname(__FILE__), '../fake_json', "#{file_path}.json"))
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
11
29
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fb_graph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 1.2.
|
9
|
+
- 3
|
10
|
+
version: 1.2.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- nov matake
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-12-
|
18
|
+
date: 2010-12-25 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -133,7 +133,6 @@ extra_rdoc_files:
|
|
133
133
|
- README.rdoc
|
134
134
|
files:
|
135
135
|
- .document
|
136
|
-
- .gitignore
|
137
136
|
- LICENSE
|
138
137
|
- README.rdoc
|
139
138
|
- Rakefile
|
@@ -198,6 +197,7 @@ files:
|
|
198
197
|
- lib/fb_graph/photo.rb
|
199
198
|
- lib/fb_graph/place.rb
|
200
199
|
- lib/fb_graph/post.rb
|
200
|
+
- lib/fb_graph/project.rb
|
201
201
|
- lib/fb_graph/query.rb
|
202
202
|
- lib/fb_graph/searchable.rb
|
203
203
|
- lib/fb_graph/searchable/result.rb
|
@@ -242,7 +242,11 @@ files:
|
|
242
242
|
- spec/fake_json/posts/likes/post_without_access_token.json
|
243
243
|
- spec/fake_json/posts/platform_private.json
|
244
244
|
- spec/fake_json/posts/platform_public.json
|
245
|
+
- spec/fake_json/query/user/with_invalid_token.json
|
246
|
+
- spec/fake_json/query/user/with_valid_token.json
|
247
|
+
- spec/fake_json/query/user/without_token.json
|
245
248
|
- spec/fake_json/statuses/with_likes.json
|
249
|
+
- spec/fake_json/true.json
|
246
250
|
- spec/fake_json/users/accounts/matake_private.json
|
247
251
|
- spec/fake_json/users/accounts/matake_private_with_manage_pages_permission.json
|
248
252
|
- spec/fake_json/users/accounts/matake_public.json
|
@@ -347,9 +351,12 @@ files:
|
|
347
351
|
- spec/fb_graph/page_spec.rb
|
348
352
|
- spec/fb_graph/photo_spec.rb
|
349
353
|
- spec/fb_graph/post_spec.rb
|
354
|
+
- spec/fb_graph/project_spec.rb
|
355
|
+
- spec/fb_graph/query/core_spec.rb
|
350
356
|
- spec/fb_graph/status_spec.rb
|
351
357
|
- spec/fb_graph/subscription_spec.rb
|
352
358
|
- spec/fb_graph/tag_spec.rb
|
359
|
+
- spec/fb_graph/test_user_spec.rb
|
353
360
|
- spec/fb_graph/user_spec.rb
|
354
361
|
- spec/fb_graph/venue_spec.rb
|
355
362
|
- spec/fb_graph/video_spec.rb
|
@@ -362,8 +369,8 @@ homepage: http://github.com/nov/fb_graph
|
|
362
369
|
licenses: []
|
363
370
|
|
364
371
|
post_install_message:
|
365
|
-
rdoc_options:
|
366
|
-
|
372
|
+
rdoc_options: []
|
373
|
+
|
367
374
|
require_paths:
|
368
375
|
- lib
|
369
376
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -443,9 +450,12 @@ test_files:
|
|
443
450
|
- spec/fb_graph/page_spec.rb
|
444
451
|
- spec/fb_graph/photo_spec.rb
|
445
452
|
- spec/fb_graph/post_spec.rb
|
453
|
+
- spec/fb_graph/project_spec.rb
|
454
|
+
- spec/fb_graph/query/core_spec.rb
|
446
455
|
- spec/fb_graph/status_spec.rb
|
447
456
|
- spec/fb_graph/subscription_spec.rb
|
448
457
|
- spec/fb_graph/tag_spec.rb
|
458
|
+
- spec/fb_graph/test_user_spec.rb
|
449
459
|
- spec/fb_graph/user_spec.rb
|
450
460
|
- spec/fb_graph/venue_spec.rb
|
451
461
|
- spec/fb_graph/video_spec.rb
|