fb_graph 1.0.7 → 1.1.0
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 +6 -2
- data/lib/fb_graph/application.rb +8 -8
- data/lib/fb_graph/connection.rb +0 -1
- data/lib/fb_graph/connections/insights.rb +3 -2
- data/lib/fb_graph/insight.rb +3 -2
- data/lib/fb_graph/node.rb +1 -1
- data/lib/fb_graph/page.rb +10 -9
- data/lib/fb_graph/user.rb +17 -17
- data/spec/fake_json/pages/insights/FbGraph_private.json +858 -0
- data/spec/fake_json/pages/insights/FbGraph_public.json +6 -0
- data/spec/fb_graph/connections/accounts_spec.rb +2 -2
- data/spec/fb_graph/connections/activities_spec.rb +2 -2
- data/spec/fb_graph/connections/albums_spec.rb +5 -3
- data/spec/fb_graph/connections/checkins_spec.rb +4 -6
- data/spec/fb_graph/connections/comments_spec.rb +8 -6
- data/spec/fb_graph/connections/events_spec.rb +5 -3
- data/spec/fb_graph/connections/feed_spec.rb +5 -5
- data/spec/fb_graph/connections/insights_spec.rb +41 -0
- data/spec/fb_graph/connections/likes_spec.rb +2 -2
- data/spec/fb_graph/connections/links_spec.rb +5 -3
- data/spec/fb_graph/connections/notes_spec.rb +4 -4
- data/spec/fb_graph/connections/photos_spec.rb +9 -7
- data/spec/fb_graph/connections/subscriptions_spec.rb +2 -2
- data/spec/fb_graph/insight_spec.rb +2 -1
- metadata +8 -4
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '../../spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
describe FbGraph::Connections::Accounts, '#accounts' do
|
4
|
+
context 'when included by FbGraph::User' do
|
5
5
|
before(:all) do
|
6
6
|
fake_json(:get, 'matake/accounts', 'users/accounts/matake_public')
|
7
7
|
fake_json(:get, 'matake/accounts?access_token=access_token', 'users/accounts/matake_private')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '../../spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
describe FbGraph::Connections::Activities, '#activities' do
|
4
|
+
context 'when included by FbGraph::User' do
|
5
5
|
before(:all) do
|
6
6
|
fake_json(:get, 'arjun/activities', 'users/activities/arjun_public')
|
7
7
|
fake_json(:get, 'arjun/activities?access_token=access_token', 'users/activities/arjun_private')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '../../spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
describe FbGraph::Connections::Albums, '#albums' do
|
4
|
+
context 'when included by FbGraph::User' do
|
5
5
|
before(:all) do
|
6
6
|
fake_json(:get, 'matake/albums', 'users/albums/matake_public')
|
7
7
|
fake_json(:get, 'matake/albums?access_token=access_token', 'users/albums/matake_private')
|
@@ -40,8 +40,10 @@ context 'when included by FbGraph::User' do
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
43
|
+
end
|
43
44
|
|
44
|
-
|
45
|
+
describe FbGraph::Connections::Albums, '#album!' do
|
46
|
+
context 'when included by FbGraph::User' do
|
45
47
|
before do
|
46
48
|
fake_json(:post, 'matake/albums', 'users/albums/post_with_valid_access_token')
|
47
49
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '../../spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
describe FbGraph::Connections::Checkins, '#checkins' do
|
4
|
+
context 'when included by FbGraph::User' do
|
5
5
|
before(:all) do
|
6
6
|
fake_json(:get, 'mattt/checkins', 'users/checkins/mattt_public')
|
7
7
|
fake_json(:get, 'mattt/checkins?access_token=access_token', 'users/checkins/mattt_private')
|
@@ -52,10 +52,8 @@ context 'when included by FbGraph::User' do
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
55
|
-
end
|
56
55
|
|
57
|
-
context 'when included by FbGraph::Page' do
|
58
|
-
describe FbGraph::Connections::Checkins, '#checkins' do
|
56
|
+
context 'when included by FbGraph::Page' do
|
59
57
|
before(:all) do
|
60
58
|
fake_json(:get, 'gowalla/checkins', 'pages/checkins/gowalla_public')
|
61
59
|
fake_json(:get, 'gowalla/checkins?access_token=access_token', 'pages/checkins/gowalla_private')
|
@@ -106,4 +104,4 @@ context 'when included by FbGraph::Page' do
|
|
106
104
|
end
|
107
105
|
end
|
108
106
|
end
|
109
|
-
end
|
107
|
+
end
|
@@ -1,12 +1,13 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '../../spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
describe FbGraph::Connections::Comments, '#comments' do
|
3
|
+
describe FbGraph::Connections::Comments, '#comments' do
|
4
|
+
context 'when included by FbGraph::Post' do
|
6
5
|
# TODO
|
7
6
|
end
|
7
|
+
end
|
8
8
|
|
9
|
-
|
9
|
+
describe FbGraph::Connections::Comments, '#comment!' do
|
10
|
+
context 'when included by FbGraph::Post' do
|
10
11
|
context 'when no access_token given' do
|
11
12
|
before do
|
12
13
|
fake_json(:post, '12345/comments', 'posts/comments/post_without_access_token', :status => [500, 'Internal Server Error'])
|
@@ -45,8 +46,10 @@ context 'when included by FbGraph::Post' do
|
|
45
46
|
end
|
46
47
|
end
|
47
48
|
end
|
49
|
+
end
|
48
50
|
|
49
|
-
|
51
|
+
describe FbGraph::Connections::Comments, '#like!' do
|
52
|
+
context 'when included by FbGraph::Post' do
|
50
53
|
context 'when no access_token given' do
|
51
54
|
before do
|
52
55
|
fake_json(:post, '12345/likes', 'posts/likes/post_without_access_token', :status => [500, 'Internal Server Error'])
|
@@ -81,5 +84,4 @@ context 'when included by FbGraph::Post' do
|
|
81
84
|
end
|
82
85
|
end
|
83
86
|
end
|
84
|
-
|
85
87
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '../../spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
describe FbGraph::Connections::Events, '#events' do
|
4
|
+
context 'when included by FbGraph::User' do
|
5
5
|
before(:all) do
|
6
6
|
fake_json(:get, 'matake/events', 'users/events/matake_public')
|
7
7
|
fake_json(:get, 'matake/events?access_token=access_token', 'users/events/matake_private')
|
@@ -32,8 +32,10 @@ context 'when included by FbGraph::User' do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
35
|
+
end
|
35
36
|
|
36
|
-
|
37
|
+
describe FbGraph::Connections::Events, '#events!' do
|
38
|
+
context 'when included by FbGraph::User' do
|
37
39
|
before do
|
38
40
|
fake_json(:post, 'matake/events', 'users/events/post_with_valid_access_token')
|
39
41
|
end
|
@@ -1,8 +1,7 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '../../spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
describe FbGraph::Connections::Feed, '#feed' do
|
3
|
+
describe FbGraph::Connections::Feed, '#feed' do
|
4
|
+
context 'when included by FbGraph::User' do
|
6
5
|
before(:all) do
|
7
6
|
fake_json(:get, 'arjun/feed', 'users/feed/arjun_public')
|
8
7
|
fake_json(:get, 'arjun/feed?access_token=access_token', 'users/feed/arjun_private')
|
@@ -59,8 +58,10 @@ context 'when included by FbGraph::User' do
|
|
59
58
|
end
|
60
59
|
end
|
61
60
|
end
|
61
|
+
end
|
62
62
|
|
63
|
-
|
63
|
+
describe FbGraph::Connections::Feed, '#feed!' do
|
64
|
+
context 'when included by FbGraph::User' do
|
64
65
|
context 'when no access_token given' do
|
65
66
|
before do
|
66
67
|
fake_json(:post, 'matake/feed', 'users/feed/post_without_access_token', :status => [500, 'Internal Server Error'])
|
@@ -98,5 +99,4 @@ context 'when included by FbGraph::User' do
|
|
98
99
|
end
|
99
100
|
end
|
100
101
|
end
|
101
|
-
|
102
102
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '../../spec_helper')
|
2
|
+
|
3
|
+
describe FbGraph::Connections::Insights, '#insights' do
|
4
|
+
|
5
|
+
context 'when included by FbGraph::Page' do
|
6
|
+
before(:all) do
|
7
|
+
fake_json(:get, 'FbGraph/insights', 'pages/insights/FbGraph_public')
|
8
|
+
fake_json(:get, 'FbGraph/insights?access_token=access_token', 'pages/insights/FbGraph_private')
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'when no access_token given' do
|
12
|
+
it 'should raise FbGraph::Unauthorized' do
|
13
|
+
lambda do
|
14
|
+
FbGraph::Page.new('FbGraph').insights
|
15
|
+
end.should raise_exception(FbGraph::Unauthorized)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'when access_token is given' do
|
20
|
+
it 'should return insights as FbGraph::Insight' do
|
21
|
+
insights = FbGraph::Page.new('FbGraph').insights(:access_token => 'access_token')
|
22
|
+
insights.class.should == FbGraph::Connection
|
23
|
+
insights.first.should == FbGraph::Insight.new(
|
24
|
+
'117513961602338/insights/page_fan_adds_unique/day',
|
25
|
+
:access_token => 'access_token',
|
26
|
+
:name => 'page_fan_adds_unique',
|
27
|
+
:description => 'Daily New Likes of your Page (Unique Users)',
|
28
|
+
:period => 'day',
|
29
|
+
:values => [{
|
30
|
+
:value => 1,
|
31
|
+
:end_time => '2010-11-27T08:00:00+0000'
|
32
|
+
}]
|
33
|
+
)
|
34
|
+
insights.each do |insight|
|
35
|
+
insight.should be_instance_of(FbGraph::Insight)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '../../spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
describe FbGraph::Connections::Likes, '#likes' do
|
4
|
+
context 'when included by FbGraph::User' do
|
5
5
|
before(:all) do
|
6
6
|
fake_json(:get, 'arjun/likes', 'users/likes/arjun_public')
|
7
7
|
fake_json(:get, 'arjun/likes?access_token=access_token', 'users/likes/arjun_private')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '../../spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
describe FbGraph::Connections::Links, '#links' do
|
4
|
+
context 'when included by FbGraph::User' do
|
5
5
|
before(:all) do
|
6
6
|
fake_json(:get, 'matake/links?access_token=access_token', 'users/links/matake_private')
|
7
7
|
end
|
@@ -13,8 +13,10 @@ context 'when included by FbGraph::User' do
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
+
describe FbGraph::Connections::Links, '#link!' do
|
19
|
+
context 'when included by FbGraph::User' do
|
18
20
|
before do
|
19
21
|
fake_json(:post, 'matake/links', 'users/links/post_with_valid_access_token')
|
20
22
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '../../spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
describe FbGraph::Connections::Notes, '#notes' do
|
4
|
+
context 'when included by FbGraph::User' do
|
5
5
|
before(:all) do
|
6
6
|
fake_json(:get, 'matake/notes?access_token=access_token', 'users/notes/matake_private')
|
7
7
|
end
|
@@ -15,8 +15,8 @@ context 'when included by FbGraph::User' do
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
describe FbGraph::Connections::Notes, '#note!' do
|
19
|
+
context 'when included by FbGraph::Page' do
|
20
20
|
before do
|
21
21
|
fake_json(:post, '12345/notes', 'pages/notes/post_with_valid_access_token')
|
22
22
|
end
|
@@ -1,14 +1,16 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '../../spec_helper')
|
2
2
|
|
3
3
|
describe FbGraph::Connections::Photos, '#photos' do
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
context 'when included by FbGraph::Album' do
|
5
|
+
before(:all) do
|
6
|
+
fake_json(:get, '12345/photos?access_token=access_token', 'albums/photos/matake_private')
|
7
|
+
end
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
it 'should return photos as FbGraph::Photo' do
|
10
|
+
photos = FbGraph::Album.new('12345', :access_token => 'access_token').photos
|
11
|
+
photos.each do |photo|
|
12
|
+
photo.should be_instance_of(FbGraph::Photo)
|
13
|
+
end
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '../../spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
describe FbGraph::Connections::Subscriptions, '#subscriptions' do
|
4
|
+
context 'when included by FbGraph::Application' do
|
5
5
|
before(:all) do
|
6
6
|
fake_json(:get, 'fb_graph/subscriptions?access_token=access_token', 'applications/subscriptions/fb_graph_private')
|
7
7
|
end
|
@@ -8,7 +8,8 @@ describe FbGraph::Insight, '.new' do
|
|
8
8
|
:period => 'day',
|
9
9
|
:values => [{'key1' => 'value2'}, {'key2' => 'value2'}]
|
10
10
|
}
|
11
|
-
insight = FbGraph::Insight.new(attributes)
|
11
|
+
insight = FbGraph::Insight.new('foo/insights/bar', attributes)
|
12
|
+
insight.identifier == 'foo/insights/bar'
|
12
13
|
insight.period.should == 'day'
|
13
14
|
insight.values.should == [{'key1' => 'value2'}, {'key2' => 'value2'}]
|
14
15
|
insight.values.first[:key1].should == 'value2'
|
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: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 1.0.7
|
10
|
+
version: 1.1.0
|
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-
|
18
|
+
date: 2010-12-02 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -218,6 +218,8 @@ files:
|
|
218
218
|
- spec/fake_json/groups/members/emacs_private.json
|
219
219
|
- spec/fake_json/pages/checkins/gowalla_private.json
|
220
220
|
- spec/fake_json/pages/checkins/gowalla_public.json
|
221
|
+
- spec/fake_json/pages/insights/FbGraph_private.json
|
222
|
+
- spec/fake_json/pages/insights/FbGraph_public.json
|
221
223
|
- spec/fake_json/pages/notes/post_with_valid_access_token.json
|
222
224
|
- spec/fake_json/pages/platform_private.json
|
223
225
|
- spec/fake_json/pages/platform_public.json
|
@@ -303,6 +305,7 @@ files:
|
|
303
305
|
- spec/fb_graph/connections/friends_spec.rb
|
304
306
|
- spec/fb_graph/connections/groups_spec.rb
|
305
307
|
- spec/fb_graph/connections/home_spec.rb
|
308
|
+
- spec/fb_graph/connections/insights_spec.rb
|
306
309
|
- spec/fb_graph/connections/interests_spec.rb
|
307
310
|
- spec/fb_graph/connections/invited_spec.rb
|
308
311
|
- spec/fb_graph/connections/likes_spec.rb
|
@@ -396,6 +399,7 @@ test_files:
|
|
396
399
|
- spec/fb_graph/connections/friends_spec.rb
|
397
400
|
- spec/fb_graph/connections/groups_spec.rb
|
398
401
|
- spec/fb_graph/connections/home_spec.rb
|
402
|
+
- spec/fb_graph/connections/insights_spec.rb
|
399
403
|
- spec/fb_graph/connections/interests_spec.rb
|
400
404
|
- spec/fb_graph/connections/invited_spec.rb
|
401
405
|
- spec/fb_graph/connections/likes_spec.rb
|