fb_graph 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/VERSION +1 -1
  2. data/fb_graph.gemspec +53 -2
  3. data/lib/fb_graph/album.rb +26 -0
  4. data/lib/fb_graph/comment.rb +18 -0
  5. data/lib/fb_graph/connections/activities.rb +12 -0
  6. data/lib/fb_graph/connections/albums.rb +12 -0
  7. data/lib/fb_graph/connections/attending.rb +16 -0
  8. data/lib/fb_graph/connections/books.rb +12 -0
  9. data/lib/fb_graph/connections/comments.rb +12 -0
  10. data/lib/fb_graph/connections/declined.rb +16 -0
  11. data/lib/fb_graph/connections/events.rb +12 -0
  12. data/lib/fb_graph/connections/feed.rb +4 -1
  13. data/lib/fb_graph/connections/friends.rb +12 -0
  14. data/lib/fb_graph/connections/groups.rb +12 -0
  15. data/lib/fb_graph/connections/home.rb +4 -1
  16. data/lib/fb_graph/connections/interests.rb +12 -0
  17. data/lib/fb_graph/connections/invited.rb +16 -0
  18. data/lib/fb_graph/connections/links.rb +12 -0
  19. data/lib/fb_graph/connections/maybe.rb +16 -0
  20. data/lib/fb_graph/connections/members.rb +16 -0
  21. data/lib/fb_graph/connections/movies.rb +12 -0
  22. data/lib/fb_graph/connections/music.rb +12 -0
  23. data/lib/fb_graph/connections/noreply.rb +16 -0
  24. data/lib/fb_graph/connections/notes.rb +12 -0
  25. data/lib/fb_graph/connections/photos.rb +12 -0
  26. data/lib/fb_graph/connections/posts.rb +1 -4
  27. data/lib/fb_graph/connections/tagged.rb +4 -1
  28. data/lib/fb_graph/connections/television.rb +12 -0
  29. data/lib/fb_graph/connections/videos.rb +12 -0
  30. data/lib/fb_graph/event.rb +28 -0
  31. data/lib/fb_graph/group.rb +23 -0
  32. data/lib/fb_graph/link.rb +21 -0
  33. data/lib/fb_graph/note.rb +22 -0
  34. data/lib/fb_graph/page.rb +10 -0
  35. data/lib/fb_graph/photo.rb +42 -0
  36. data/lib/fb_graph/post.rb +7 -5
  37. data/lib/fb_graph/status.rb +5 -3
  38. data/lib/fb_graph/user.rb +21 -1
  39. data/lib/fb_graph/video.rb +23 -0
  40. data/lib/fb_graph.rb +11 -3
  41. data/spec/fake_json/users/activities/arjun_private.json +24 -0
  42. data/spec/fake_json/users/activities/arjun_public.json +6 -0
  43. data/spec/fake_json/users/feed/arjun_private.json +520 -0
  44. data/spec/fake_json/users/feed/arjun_public.json +520 -0
  45. data/spec/fake_json/users/friends/arjun_private.json +6 -0
  46. data/spec/fake_json/users/friends/arjun_public.json +6 -0
  47. data/spec/fake_json/users/friends/me_private.json +524 -0
  48. data/spec/fake_json/users/friends/me_public.json +6 -0
  49. data/spec/fake_json/users/posts/arjun_private.json +386 -0
  50. data/spec/fake_json/users/posts/arjun_public.json +386 -0
  51. data/spec/fake_json/users/tagged/arjun_private.json +308 -0
  52. data/spec/fake_json/users/tagged/arjun_public.json +308 -0
  53. data/spec/fb_graph/connections/activities_spec.rb +28 -0
  54. data/spec/fb_graph/connections/feed_spec.rb +34 -0
  55. data/spec/fb_graph/connections/friends_spec.rb +42 -0
  56. data/spec/fb_graph/connections/home_spec.rb +14 -2
  57. data/spec/fb_graph/connections/likes_spec.rb +0 -5
  58. data/spec/fb_graph/connections/posts_spec.rb +34 -0
  59. data/spec/fb_graph/connections/statuses_spec.rb +0 -19
  60. data/spec/fb_graph/connections/tagged_spec.rb +41 -0
  61. metadata +53 -2
@@ -0,0 +1,42 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ describe FbGraph::Connections::Friends, '#friends' do
4
+ describe 'when included by FbGraph::User' do
5
+ before(:all) do
6
+ fake_json(:get, 'me/friends', 'users/friends/me_public')
7
+ fake_json(:get, 'me/friends?access_token=access_token', 'users/friends/me_private')
8
+ fake_json(:get, 'arjun/friends', 'users/friends/arjun_public')
9
+ fake_json(:get, 'arjun/friends?access_token=access_token', 'users/friends/arjun_private')
10
+ end
11
+
12
+ it 'should raise FbGraph::Exception when no access_token given' do
13
+ lambda do
14
+ FbGraph::User.new('arjun').friends
15
+ end.should raise_exception(FbGraph::Exception)
16
+ end
17
+
18
+ it 'should raise FbGraph::Exception when identifier is not me' do
19
+ lambda do
20
+ FbGraph::User.new('arjun', :access_token => 'access_token').friends
21
+ end.should raise_exception(FbGraph::Exception)
22
+ end
23
+
24
+ it 'should raise FbGraph::NotFound when identifier is me and no access_token is given' do
25
+ lambda do
26
+ FbGraph::User.new('me').friends
27
+ end.should raise_exception(FbGraph::NotFound)
28
+ end
29
+
30
+ it 'should return posts when identifier is me and access_token is given' do
31
+ users = FbGraph::User.new('me', :access_token => 'access_token').friends
32
+ users.first.should == FbGraph::User.new(
33
+ '6401',
34
+ :name => 'Kirk McMurray'
35
+ )
36
+ users.each do |user|
37
+ user.should be_instance_of(FbGraph::User)
38
+ end
39
+ end
40
+
41
+ end
42
+ end
@@ -21,14 +21,26 @@ describe FbGraph::Connections::Home, '#home' do
21
21
  end.should raise_exception(FbGraph::Exception)
22
22
  end
23
23
 
24
- it 'shoud raise FbGraph::NotFound when identifier is me and no access_token is given' do
24
+ it 'should raise FbGraph::NotFound when identifier is me and no access_token is given' do
25
25
  lambda do
26
26
  FbGraph::User.new('me').home
27
27
  end.should raise_exception(FbGraph::NotFound)
28
28
  end
29
29
 
30
- it 'shoud return posts when identifier is me and access_token is given' do
30
+ it 'should return posts when identifier is me and access_token is given' do
31
31
  posts = FbGraph::User.new('me', :access_token => 'access_token').home
32
+ posts.first.should == FbGraph::Post.new(
33
+ '777639200_114261338604732',
34
+ :from => {
35
+ :id => '777639200',
36
+ :name => 'Masahiro Kiura'
37
+ },
38
+ :message => "\"午前の試験監督の女の子が劇的に好みだった。細身色白、鼻筋通って目の大きいちょっと日本人離れしたタイプで、そう考えると嫁さんは実にストライクである。\" http://tumblr.com/xq3928azv",
39
+ :icon => 'http://photos-h.ak.fbcdn.net/photos-ak-sf2p/v43/23/2231777543/app_2_2231777543_2528.gif',
40
+ :attribution => 'Twitter',
41
+ :created_time => '2010-04-25T12:23:09+0000',
42
+ :updated_time => '2010-04-25T12:23:09+0000'
43
+ )
32
44
  posts.each do |post|
33
45
  post.should be_instance_of(FbGraph::Post)
34
46
  end
@@ -20,11 +20,6 @@ describe FbGraph::Connections::Likes, '#likes' do
20
20
  :name => 'Doing Things at the Last Minute',
21
21
  :category => '活動'
22
22
  )
23
- likes.last.should == FbGraph::Page.new(
24
- '329322570299',
25
- :name => 'Dirtybird Records',
26
- :category => 'Products_other'
27
- )
28
23
  likes.each do |like|
29
24
  like.should be_instance_of(FbGraph::Page)
30
25
  end
@@ -0,0 +1,34 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ describe FbGraph::Connections::Posts, '#posts' do
4
+ describe 'when included by FbGraph::User' do
5
+ before(:all) do
6
+ fake_json(:get, 'arjun/posts', 'users/posts/arjun_public')
7
+ fake_json(:get, 'arjun/posts?access_token=access_token', 'users/posts/arjun_private')
8
+ end
9
+
10
+ it 'should return public own posts even when access_token is not given' do
11
+ posts = FbGraph::User.new('arjun').posts
12
+ posts.first.should == FbGraph::Post.new(
13
+ '7901103_121392141207495',
14
+ :from => {
15
+ :id => '7901103',
16
+ :name => 'Arjun Banker'
17
+ },
18
+ :picture => 'http://external.ak.fbcdn.net/safe_image.php?d=d2cc5beedaa401ba54eccc9014647285&w=130&h=130&url=http%3A%2F%2Fimages.ted.com%2Fimages%2Fted%2F269_389x292.jpg',
19
+ :link => 'http://www.ted.com/talks/wade_davis_on_endangered_cultures.html',
20
+ :name => 'Wade Davis on endangered cultures | Video on TED.com',
21
+ :caption => 'www.ted.com',
22
+ :description => 'TED Talks With stunning photos and stories, National Geographic Explorer Wade Davis celebrates the extraordinary diversity of the world\'s indigenous cultures, which are disappearing from the planet at an alarming rate.',
23
+ :icon => 'http://static.ak.fbcdn.net/rsrc.php/z9XZ8/hash/976ulj6z.gif',
24
+ :created_time => '2010-04-25T04:05:32+0000',
25
+ :updated_time => '2010-04-25T04:05:32+0000',
26
+ :likes => 1
27
+ )
28
+ posts.each do |post|
29
+ post.should be_instance_of(FbGraph::Post)
30
+ end
31
+ end
32
+
33
+ end
34
+ end
@@ -25,15 +25,6 @@ describe FbGraph::Connections::Statuses, '#statuses' do
25
25
  :message => 'http://www.facebook.com/photo.php?pid=60538827&l=79b44ffb74&id=7901103',
26
26
  :updated_time => '2010-04-21T21:10:16+0000'
27
27
  )
28
- statuses.last.should == FbGraph::Status.new(
29
- '258870336453',
30
- :from => {
31
- :id => '7901103',
32
- :name => 'Arjun Banker'
33
- },
34
- :message => 'everything that is everywhere is in the Bharata, and what is not is nowhere',
35
- :updated_time => '2010-01-08T06:55:12+0000'
36
- )
37
28
  statuses.each do |like|
38
29
  like.should be_instance_of(FbGraph::Status)
39
30
  end
@@ -64,16 +55,6 @@ describe FbGraph::Connections::Statuses, '#statuses' do
64
55
  :message => 'Here\'s more information on the new social plugins announced at f8 today - http://bit.ly/db8ahS',
65
56
  :updated_time => '2010-04-21T20:17:04+0000'
66
57
  )
67
- statuses.last.should == FbGraph::Status.new(
68
- '59328281651',
69
- :from => {
70
- :id => '19292868552',
71
- :name => 'Facebook Platform',
72
- :category => 'Technology'
73
- },
74
- :message => 'http://developers.facebook.com/news.php?blog=1&story=209',
75
- :updated_time => '2009-03-06T22:56:36+0000'
76
- )
77
58
  statuses.each do |like|
78
59
  like.should be_instance_of(FbGraph::Status)
79
60
  end
@@ -0,0 +1,41 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ describe FbGraph::Connections::Tagged, '#tagged' do
4
+ describe 'when included by FbGraph::User' do
5
+ before(:all) do
6
+ fake_json(:get, 'arjun/tagged', 'users/tagged/arjun_public')
7
+ fake_json(:get, 'arjun/tagged?access_token=access_token', 'users/tagged/arjun_private')
8
+ end
9
+
10
+ it 'should return public own posts even when access_token is not given' do
11
+ posts = FbGraph::User.new('arjun').tagged
12
+ posts.first.should == FbGraph::Post.new(
13
+ '7901103_117809521578252',
14
+ :from => {
15
+ :id => '1404401889',
16
+ :name => 'Elli Mooney'
17
+ },
18
+ :to => {
19
+ :data => [{
20
+ :id => '7901103',
21
+ :name => 'Arjun Banker'
22
+ }]
23
+ },
24
+ :message => '...uh oh, here comes a privacy issue....',
25
+ :picture => 'http://external.ak.fbcdn.net/safe_image.php?d=c659c86d415c60c37b2871bfd67f2a97&w=130&h=130&url=http%3A%2F%2Fcdn.venturebeat.com%2Fwp-content%2Fuploads%2F2010%2F04%2Fusethisone.jpg',
26
+ :link => 'http://venturebeat.com/2010/04/23/blippy-credit-card-citibank/',
27
+ :name => 'Blippy users’ credit card numbers found on Google | VentureBeat',
28
+ :caption => 'venturebeat.com',
29
+ :description => '[Update: Blippy cofounder Philip Kaplan emailed a response. CNET News is reporting that the cards in question were issued by ...',
30
+ :icon => 'http://static.ak.fbcdn.net/rsrc.php/zB010/hash/9yvl71tw.gif',
31
+ :created_time => '2010-04-24T08:07:59+0000',
32
+ :updated_time => '2010-04-24T08:07:59+0000',
33
+ :likes => 1
34
+ )
35
+ posts.each do |post|
36
+ post.should be_instance_of(FbGraph::Post)
37
+ end
38
+ end
39
+
40
+ end
41
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - nov matake
@@ -71,39 +71,85 @@ files:
71
71
  - VERSION
72
72
  - fb_graph.gemspec
73
73
  - lib/fb_graph.rb
74
+ - lib/fb_graph/album.rb
75
+ - lib/fb_graph/comment.rb
74
76
  - lib/fb_graph/connections.rb
77
+ - lib/fb_graph/connections/activities.rb
78
+ - lib/fb_graph/connections/albums.rb
79
+ - lib/fb_graph/connections/attending.rb
80
+ - lib/fb_graph/connections/books.rb
75
81
  - lib/fb_graph/connections/collection.rb
82
+ - lib/fb_graph/connections/comments.rb
83
+ - lib/fb_graph/connections/declined.rb
84
+ - lib/fb_graph/connections/events.rb
76
85
  - lib/fb_graph/connections/feed.rb
86
+ - lib/fb_graph/connections/friends.rb
87
+ - lib/fb_graph/connections/groups.rb
77
88
  - lib/fb_graph/connections/home.rb
89
+ - lib/fb_graph/connections/interests.rb
90
+ - lib/fb_graph/connections/invited.rb
78
91
  - lib/fb_graph/connections/likes.rb
92
+ - lib/fb_graph/connections/links.rb
93
+ - lib/fb_graph/connections/maybe.rb
94
+ - lib/fb_graph/connections/members.rb
95
+ - lib/fb_graph/connections/movies.rb
96
+ - lib/fb_graph/connections/music.rb
97
+ - lib/fb_graph/connections/noreply.rb
98
+ - lib/fb_graph/connections/notes.rb
99
+ - lib/fb_graph/connections/photos.rb
79
100
  - lib/fb_graph/connections/picture.rb
80
101
  - lib/fb_graph/connections/posts.rb
81
102
  - lib/fb_graph/connections/statuses.rb
82
103
  - lib/fb_graph/connections/tagged.rb
104
+ - lib/fb_graph/connections/television.rb
105
+ - lib/fb_graph/connections/videos.rb
106
+ - lib/fb_graph/event.rb
107
+ - lib/fb_graph/group.rb
108
+ - lib/fb_graph/link.rb
83
109
  - lib/fb_graph/node.rb
110
+ - lib/fb_graph/note.rb
84
111
  - lib/fb_graph/page.rb
112
+ - lib/fb_graph/photo.rb
85
113
  - lib/fb_graph/post.rb
86
114
  - lib/fb_graph/status.rb
87
115
  - lib/fb_graph/user.rb
116
+ - lib/fb_graph/video.rb
88
117
  - spec/fake_json/pages/platform_private.json
89
118
  - spec/fake_json/pages/platform_public.json
90
119
  - spec/fake_json/pages/statuses/platform_private.json
91
120
  - spec/fake_json/pages/statuses/platform_public.json
121
+ - spec/fake_json/users/activities/arjun_private.json
122
+ - spec/fake_json/users/activities/arjun_public.json
92
123
  - spec/fake_json/users/arjun_private.json
93
124
  - spec/fake_json/users/arjun_public.json
125
+ - spec/fake_json/users/feed/arjun_private.json
126
+ - spec/fake_json/users/feed/arjun_public.json
127
+ - spec/fake_json/users/friends/arjun_private.json
128
+ - spec/fake_json/users/friends/arjun_public.json
129
+ - spec/fake_json/users/friends/me_private.json
130
+ - spec/fake_json/users/friends/me_public.json
94
131
  - spec/fake_json/users/home/arjun_private.json
95
132
  - spec/fake_json/users/home/arjun_public.json
96
133
  - spec/fake_json/users/home/me_private.json
97
134
  - spec/fake_json/users/home/me_public.json
98
135
  - spec/fake_json/users/likes/arjun_private.json
99
136
  - spec/fake_json/users/likes/arjun_public.json
137
+ - spec/fake_json/users/posts/arjun_private.json
138
+ - spec/fake_json/users/posts/arjun_public.json
100
139
  - spec/fake_json/users/statuses/arjun_private.json
101
140
  - spec/fake_json/users/statuses/arjun_public.json
141
+ - spec/fake_json/users/tagged/arjun_private.json
142
+ - spec/fake_json/users/tagged/arjun_public.json
143
+ - spec/fb_graph/connections/activities_spec.rb
102
144
  - spec/fb_graph/connections/collection_spec.rb
145
+ - spec/fb_graph/connections/feed_spec.rb
146
+ - spec/fb_graph/connections/friends_spec.rb
103
147
  - spec/fb_graph/connections/home_spec.rb
104
148
  - spec/fb_graph/connections/likes_spec.rb
105
149
  - spec/fb_graph/connections/picture_spec.rb
150
+ - spec/fb_graph/connections/posts_spec.rb
106
151
  - spec/fb_graph/connections/statuses_spec.rb
152
+ - spec/fb_graph/connections/tagged_spec.rb
107
153
  - spec/fb_graph/node_spec.rb
108
154
  - spec/fb_graph/page_spec.rb
109
155
  - spec/fb_graph/user_spec.rb
@@ -142,11 +188,16 @@ signing_key:
142
188
  specification_version: 3
143
189
  summary: Facebook Graph API library for Ruby
144
190
  test_files:
191
+ - spec/fb_graph/connections/activities_spec.rb
145
192
  - spec/fb_graph/connections/collection_spec.rb
193
+ - spec/fb_graph/connections/feed_spec.rb
194
+ - spec/fb_graph/connections/friends_spec.rb
146
195
  - spec/fb_graph/connections/home_spec.rb
147
196
  - spec/fb_graph/connections/likes_spec.rb
148
197
  - spec/fb_graph/connections/picture_spec.rb
198
+ - spec/fb_graph/connections/posts_spec.rb
149
199
  - spec/fb_graph/connections/statuses_spec.rb
200
+ - spec/fb_graph/connections/tagged_spec.rb
150
201
  - spec/fb_graph/node_spec.rb
151
202
  - spec/fb_graph/page_spec.rb
152
203
  - spec/fb_graph/user_spec.rb