fb_graph2 0.0.4 → 0.0.5
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/.gitignore +2 -0
- data/VERSION +1 -1
- data/fb_graph2.gemspec +2 -1
- data/lib/fb_graph2/achievement.rb +3 -1
- data/lib/fb_graph2/application.rb +4 -0
- data/lib/fb_graph2/collection.rb +1 -1
- data/lib/fb_graph2/edge/albums.rb +5 -0
- data/lib/fb_graph2/edge/blocked.rb +7 -2
- data/lib/fb_graph2/edge/comments.rb +1 -1
- data/lib/fb_graph2/edge/feed.rb +1 -1
- data/lib/fb_graph2/edge/notifications.rb +6 -0
- data/lib/fb_graph2/edge/photos.rb +1 -1
- data/lib/fb_graph2/edge/shared_posts.rb +1 -1
- data/lib/fb_graph2/edge/videos.rb +1 -1
- data/lib/fb_graph2/page.rb +6 -1
- data/lib/fb_graph2/page_category.rb +7 -0
- data/lib/fb_graph2/user.rb +1 -0
- data/spec/fb_graph2/application_spec.rb +23 -0
- data/spec/fb_graph2/collection_spec.rb +11 -0
- data/spec/fb_graph2/edge/achievements_spec.rb +18 -0
- data/spec/fb_graph2/edge/activities_spec.rb +18 -0
- data/spec/fb_graph2/edge/admins_spec.rb +40 -0
- data/spec/fb_graph2/edge/albums_spec.rb +30 -0
- data/spec/fb_graph2/edge/blocked_spec.rb +60 -0
- data/spec/fb_graph2/edge/books_spec.rb +18 -0
- data/spec/fb_graph2/edge/events_spec.rb +18 -0
- data/spec/fb_graph2/edge/friend_lists_spec.rb +18 -0
- data/spec/fb_graph2/edge/friends_spec.rb +18 -0
- data/spec/fb_graph2/edge/groups_spec.rb +18 -0
- data/spec/fb_graph2/edge/home_spec.rb +18 -0
- data/spec/fb_graph2/edge/interests_spec.rb +18 -0
- data/spec/fb_graph2/edge/invitable_friends_spec.rb +18 -0
- data/spec/fb_graph2/edge/likes_spec.rb +4 -4
- data/spec/fb_graph2/edge/links_spec.rb +18 -0
- data/spec/fb_graph2/edge/milestones_spec.rb +18 -0
- data/spec/fb_graph2/edge/movies_spec.rb +18 -0
- data/spec/fb_graph2/edge/music_spec.rb +18 -0
- data/spec/fb_graph2/edge/notifications_spec.rb +29 -0
- data/spec/fb_graph2/edge/permissions_spec.rb +18 -0
- data/spec/fb_graph2/edge/picture_spec.rb +16 -0
- data/spec/fb_graph2/edge/pokes_spec.rb +18 -0
- data/spec/fb_graph2/edge/posts_spec.rb +18 -0
- data/spec/fb_graph2/edge/promotable_posts_spec.rb +18 -0
- data/spec/fb_graph2/edge/scores_spec.rb +18 -0
- data/spec/fb_graph2/edge/shared_posts_spec.rb +18 -0
- data/spec/fb_graph2/edge/statuses_spec.rb +18 -0
- data/spec/fb_graph2/edge/television_spec.rb +18 -0
- data/spec/fb_graph2/edge/videos_spec.rb +28 -0
- data/spec/fb_graph2/request_filter/authenticator_spec.rb +25 -0
- data/spec/fb_graph2/request_filter/debugger_spec.rb +33 -0
- data/spec/fb_graph2/user_spec.rb +1 -1
- data/spec/fb_graph2/util_spec.rb +19 -0
- data/spec/mock_json/application/app.json +15 -0
- data/spec/mock_json/page/admins.json +11 -0
- data/spec/mock_json/page/block_succeeded.json +3 -0
- data/spec/mock_json/page/blocked.json +11 -0
- data/spec/mock_json/page/milestones.json +19 -0
- data/spec/mock_json/page/promotable_posts.json +67 -0
- data/spec/mock_json/post/shared_posts.json +50 -0
- data/spec/mock_json/success_true.json +3 -0
- data/spec/mock_json/user/achievements.json +40 -0
- data/spec/mock_json/user/activities.json +36 -0
- data/spec/mock_json/user/albums.json +23 -0
- data/spec/mock_json/user/books.json +11 -0
- data/spec/mock_json/user/events.json +16 -0
- data/spec/mock_json/user/friend_lists.json +98 -0
- data/spec/mock_json/user/friends.json +18 -0
- data/spec/mock_json/user/groups.json +16 -0
- data/spec/mock_json/user/home.json +61 -0
- data/spec/mock_json/user/interests.json +41 -0
- data/spec/mock_json/user/invitable_friends.json +27 -0
- data/spec/mock_json/user/links.json +45 -0
- data/spec/mock_json/user/movies.json +11 -0
- data/spec/mock_json/user/music.json +45 -0
- data/spec/mock_json/user/notifications.json +111 -0
- data/spec/mock_json/user/permissions.json +114 -0
- data/spec/mock_json/user/picture.json +6 -0
- data/spec/mock_json/user/pokes.json +17 -0
- data/spec/mock_json/user/posts.json +48 -0
- data/spec/mock_json/user/scores.json +14 -0
- data/spec/mock_json/user/statuses.json +15 -0
- data/spec/mock_json/user/television.json +11 -0
- data/spec/mock_json/user/videos.json +41 -0
- data/spec/spec_helper/mock_graph.rb +1 -1
- data/spec/spec_helper.rb +7 -0
- metadata +84 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 74750faa426059425c7abd637447a8fdad787239
|
|
4
|
+
data.tar.gz: 766bad5045a521469346a990a8d63ab799eb8a7e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 300cbfc8444dc6e4efaaa5ff530bc424da44304f5b46f753c8aeea9887aa0ddc0bf94fb3da45f2297ff2c3d437ad98907fbfc3f035d3431a1f6621d74d3a78cd
|
|
7
|
+
data.tar.gz: fb4423e27def44ce916faf226d9c96c2843fd83d8a94723417a9fa4ae19b267a8092c8b24e1f0dda5d91f4b00da23289f5e0d4ab3d140fbdb84fc9a7d7084300
|
data/.gitignore
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.5
|
data/fb_graph2.gemspec
CHANGED
|
@@ -20,5 +20,6 @@ Gem::Specification.new do |gem|
|
|
|
20
20
|
gem.add_development_dependency 'rake'
|
|
21
21
|
gem.add_development_dependency 'simplecov'
|
|
22
22
|
gem.add_development_dependency 'webmock'
|
|
23
|
-
gem.add_development_dependency 'rspec'
|
|
23
|
+
gem.add_development_dependency 'rspec'
|
|
24
|
+
gem.add_development_dependency 'rspec-its'
|
|
24
25
|
end
|
data/lib/fb_graph2/collection.rb
CHANGED
|
@@ -7,6 +7,11 @@ module FbGraph2
|
|
|
7
7
|
Album.new(album[:id], album).authenticate self.access_token
|
|
8
8
|
end
|
|
9
9
|
end
|
|
10
|
+
|
|
11
|
+
def album!(params = {})
|
|
12
|
+
album = self.post params, edge: :albums
|
|
13
|
+
Album.new(album[:id], params.merge(album)).authenticate self.access_token
|
|
14
|
+
end
|
|
10
15
|
end
|
|
11
16
|
end
|
|
12
17
|
end
|
|
@@ -8,15 +8,20 @@ module FbGraph2
|
|
|
8
8
|
end
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
+
def blocked?(user, params = {})
|
|
12
|
+
users = self.edge :blocked, params, edge_scope: user
|
|
13
|
+
users.present?
|
|
14
|
+
end
|
|
15
|
+
|
|
11
16
|
def block!(user, params = {})
|
|
12
17
|
self.post params.merge(
|
|
13
|
-
|
|
18
|
+
user: Util.as_identifier(user)
|
|
14
19
|
), edge: :blocked
|
|
15
20
|
end
|
|
16
21
|
|
|
17
22
|
def unblock!(user, params = {})
|
|
18
23
|
self.delete params.merge(
|
|
19
|
-
|
|
24
|
+
user: Util.as_identifier(user)
|
|
20
25
|
), edge: :blocked
|
|
21
26
|
end
|
|
22
27
|
end
|
|
@@ -21,7 +21,7 @@ module FbGraph2
|
|
|
21
21
|
|
|
22
22
|
def comment!(params = {})
|
|
23
23
|
comment = self.post params, edge: :comments
|
|
24
|
-
Comment.new(comment[:id],
|
|
24
|
+
Comment.new(comment[:id], params.merge(comment)).authenticate self.access_token
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
end
|
data/lib/fb_graph2/edge/feed.rb
CHANGED
|
@@ -7,6 +7,12 @@ module FbGraph2
|
|
|
7
7
|
Notification.new notification[:id], notification
|
|
8
8
|
end
|
|
9
9
|
end
|
|
10
|
+
|
|
11
|
+
def notification!(params = {})
|
|
12
|
+
notification = self.post params, edge: :notifications
|
|
13
|
+
notification.include? :success
|
|
14
|
+
end
|
|
15
|
+
alias_method :notify!, :notification!
|
|
10
16
|
end
|
|
11
17
|
end
|
|
12
18
|
end
|
data/lib/fb_graph2/page.rb
CHANGED
|
@@ -39,7 +39,12 @@ module FbGraph2
|
|
|
39
39
|
|
|
40
40
|
def initialize(id, attributes = {})
|
|
41
41
|
super
|
|
42
|
-
|
|
42
|
+
if attributes.include? :category_list
|
|
43
|
+
self.category_list = attributes[:category_list].collect do |page_category|
|
|
44
|
+
PageCategory.new page_category[:id], page_category
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
# TODO: handle other custom attributes.
|
|
43
48
|
end
|
|
44
49
|
end
|
|
45
50
|
end
|
data/lib/fb_graph2/user.rb
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe FbGraph2::User do
|
|
4
|
+
describe '.app' do
|
|
5
|
+
let(:klass) { FbGraph2::Application }
|
|
6
|
+
|
|
7
|
+
it 'should not call API' do
|
|
8
|
+
expect do
|
|
9
|
+
app = klass.app 'token'
|
|
10
|
+
app.should be_instance_of klass
|
|
11
|
+
end.not_to request_to 'app'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
context 'when fetched' do
|
|
15
|
+
it 'should call API' do
|
|
16
|
+
app = mock_graph :get, 'app', 'application/app' do
|
|
17
|
+
klass.app('token').fetch
|
|
18
|
+
end
|
|
19
|
+
app.should be_instance_of klass
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe FbGraph2::Edge::Achievements do
|
|
4
|
+
context 'included in User' do
|
|
5
|
+
describe '#achievements' do
|
|
6
|
+
let(:me) { FbGraph2::User.me('token') }
|
|
7
|
+
it 'should return an Array of FbGraph2::Achievement' do
|
|
8
|
+
pages = mock_graph :get, 'me/achievements', 'user/achievements', access_token: 'token' do
|
|
9
|
+
me.achievements
|
|
10
|
+
end
|
|
11
|
+
pages.should_not be_blank
|
|
12
|
+
pages.each do |page|
|
|
13
|
+
page.should be_instance_of FbGraph2::Achievement
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe FbGraph2::Edge::Activities do
|
|
4
|
+
context 'included in User' do
|
|
5
|
+
describe '#activities' do
|
|
6
|
+
let(:me) { FbGraph2::User.me('token') }
|
|
7
|
+
it 'should return an Array of FbGraph2::Page' do
|
|
8
|
+
pages = mock_graph :get, 'me/activities', 'user/activities', access_token: 'token' do
|
|
9
|
+
me.activities
|
|
10
|
+
end
|
|
11
|
+
pages.should_not be_blank
|
|
12
|
+
pages.each do |page|
|
|
13
|
+
page.should be_instance_of FbGraph2::Page
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe FbGraph2::Edge::Admins do
|
|
4
|
+
context 'included in Page' do
|
|
5
|
+
let(:page) { FbGraph2::Page.new('page_id').authenticate('page_token') }
|
|
6
|
+
|
|
7
|
+
describe '#admins' do
|
|
8
|
+
it 'should return an Array of FbGraph2::User' do
|
|
9
|
+
users = mock_graph :get, 'page_id/admins', 'page/admins', access_token: 'page_token' do
|
|
10
|
+
page.admins
|
|
11
|
+
end
|
|
12
|
+
users.should_not be_blank
|
|
13
|
+
users.each do |user|
|
|
14
|
+
user.should be_instance_of FbGraph2::User
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
describe '#admin?' do
|
|
20
|
+
let(:user_id) { 'user_id' }
|
|
21
|
+
let(:user) { FbGraph2::Page.new(user_id) }
|
|
22
|
+
|
|
23
|
+
context 'when String given' do
|
|
24
|
+
it do
|
|
25
|
+
mock_graph :get, "page_id/admins/#{user_id}", 'page/admins', access_token: 'page_token' do
|
|
26
|
+
page.admin? user_id
|
|
27
|
+
end.should be true
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
context 'when FbGraph2::User given' do
|
|
32
|
+
it do
|
|
33
|
+
mock_graph :get, "page_id/admins/#{user_id}", 'page/admins', access_token: 'page_token' do
|
|
34
|
+
page.admin? user
|
|
35
|
+
end.should be true
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe FbGraph2::Edge::Albums do
|
|
4
|
+
context 'included in User' do
|
|
5
|
+
let(:me) { FbGraph2::User.me('token') }
|
|
6
|
+
|
|
7
|
+
describe '#albums' do
|
|
8
|
+
it 'should return an Array of FbGraph2::Video' do
|
|
9
|
+
albums = mock_graph :get, 'me/albums', 'user/albums', access_token: 'token' do
|
|
10
|
+
me.albums
|
|
11
|
+
end
|
|
12
|
+
albums.should_not be_blank
|
|
13
|
+
albums.each do |album|
|
|
14
|
+
album.should be_instance_of FbGraph2::Album
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
describe '#album!' do
|
|
20
|
+
it do
|
|
21
|
+
album = mock_graph :post, 'me/albums', 'success_with_id', access_token: 'token', params: {
|
|
22
|
+
name: 'test'
|
|
23
|
+
} do
|
|
24
|
+
me.album! name: 'test'
|
|
25
|
+
end
|
|
26
|
+
album.should be_instance_of FbGraph2::Album
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe FbGraph2::Edge::Blocked do
|
|
4
|
+
context 'included in Page' do
|
|
5
|
+
let(:page) { FbGraph2::Page.new('page_id').authenticate('page_token') }
|
|
6
|
+
let(:user_id) { 'user_id' }
|
|
7
|
+
let(:user) { FbGraph2::Page.new(user_id) }
|
|
8
|
+
|
|
9
|
+
describe '#blocked' do
|
|
10
|
+
it 'should return an Array of FbGraph2::User' do
|
|
11
|
+
users = mock_graph :get, 'page_id/blocked', 'page/blocked', access_token: 'page_token' do
|
|
12
|
+
page.blocked
|
|
13
|
+
end
|
|
14
|
+
users.should_not be_blank
|
|
15
|
+
users.each do |user|
|
|
16
|
+
user.should be_instance_of FbGraph2::User
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe '#blocked?' do
|
|
22
|
+
context 'when String given' do
|
|
23
|
+
it do
|
|
24
|
+
mock_graph :get, "page_id/blocked/#{user_id}", 'page/blocked', access_token: 'page_token' do
|
|
25
|
+
page.blocked? user_id
|
|
26
|
+
end.should be true
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
context 'when FbGraph2::User given' do
|
|
31
|
+
it do
|
|
32
|
+
mock_graph :get, "page_id/blocked/#{user_id}", 'page/blocked', access_token: 'page_token' do
|
|
33
|
+
page.blocked? user
|
|
34
|
+
end.should be true
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
describe '#block!' do
|
|
40
|
+
it do
|
|
41
|
+
result = mock_graph :post, 'page_id/blocked', 'page/block_succeeded', access_token: 'page_token', params: {
|
|
42
|
+
user: user_id
|
|
43
|
+
} do
|
|
44
|
+
page.block! user
|
|
45
|
+
end
|
|
46
|
+
result.should == {'user_id' => true}
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
describe '#unblock!' do
|
|
51
|
+
it do
|
|
52
|
+
mock_graph :delete, 'page_id/blocked', 'true', access_token: 'page_token', params: {
|
|
53
|
+
user: user_id
|
|
54
|
+
} do
|
|
55
|
+
page.unblock! user
|
|
56
|
+
end.should be true
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe FbGraph2::Edge::Books do
|
|
4
|
+
context 'included in User' do
|
|
5
|
+
describe '#books' do
|
|
6
|
+
let(:me) { FbGraph2::User.me('token') }
|
|
7
|
+
it 'should return an Array of FbGraph2::Page' do
|
|
8
|
+
pages = mock_graph :get, 'me/books', 'user/books', access_token: 'token' do
|
|
9
|
+
me.books
|
|
10
|
+
end
|
|
11
|
+
pages.should_not be_blank
|
|
12
|
+
pages.each do |page|
|
|
13
|
+
page.should be_instance_of FbGraph2::Page
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe FbGraph2::Edge::Events do
|
|
4
|
+
context 'included in User' do
|
|
5
|
+
describe '#events' do
|
|
6
|
+
let(:me) { FbGraph2::User.me('token') }
|
|
7
|
+
it 'should return an Array of FbGraph2::Event' do
|
|
8
|
+
events = mock_graph :get, 'me/events', 'user/events', access_token: 'token' do
|
|
9
|
+
me.events
|
|
10
|
+
end
|
|
11
|
+
events.should_not be_blank
|
|
12
|
+
events.each do |event|
|
|
13
|
+
event.should be_instance_of FbGraph2::Event
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe FbGraph2::Edge::FriendLists do
|
|
4
|
+
context 'included in User' do
|
|
5
|
+
describe '#friend_lists' do
|
|
6
|
+
let(:me) { FbGraph2::User.me('token') }
|
|
7
|
+
it 'should return an Array of FbGraph2::FriendList' do
|
|
8
|
+
friend_lists = mock_graph :get, 'me/friendlists', 'user/friend_lists', access_token: 'token' do
|
|
9
|
+
me.friend_lists
|
|
10
|
+
end
|
|
11
|
+
friend_lists.should_not be_blank
|
|
12
|
+
friend_lists.each do |friend_list|
|
|
13
|
+
friend_list.should be_instance_of FbGraph2::FriendList
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe FbGraph2::Edge::Friends do
|
|
4
|
+
context 'included in User' do
|
|
5
|
+
describe '#friends' do
|
|
6
|
+
let(:me) { FbGraph2::User.me('token') }
|
|
7
|
+
it 'should return an Array of FbGraph2::User' do
|
|
8
|
+
users = mock_graph :get, 'me/friends', 'user/friends', access_token: 'token' do
|
|
9
|
+
me.friends
|
|
10
|
+
end
|
|
11
|
+
users.should_not be_blank
|
|
12
|
+
users.each do |user|
|
|
13
|
+
user.should be_instance_of FbGraph2::User
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe FbGraph2::Edge::Groups do
|
|
4
|
+
context 'included in User' do
|
|
5
|
+
describe '#groups' do
|
|
6
|
+
let(:me) { FbGraph2::User.me('token') }
|
|
7
|
+
it 'should return an Array of FbGraph2::Page' do
|
|
8
|
+
groups = mock_graph :get, 'me/groups', 'user/groups', access_token: 'token' do
|
|
9
|
+
me.groups
|
|
10
|
+
end
|
|
11
|
+
groups.should_not be_blank
|
|
12
|
+
groups.each do |group|
|
|
13
|
+
group.should be_instance_of FbGraph2::Group
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe FbGraph2::Edge::Feed do
|
|
4
|
+
context 'included in User' do
|
|
5
|
+
describe '#home' do
|
|
6
|
+
let(:me) { FbGraph2::User.me('token') }
|
|
7
|
+
it 'should return an Array of FbGraph2::Post' do
|
|
8
|
+
posts = mock_graph :get, 'me/home', 'user/home', access_token: 'token' do
|
|
9
|
+
me.home
|
|
10
|
+
end
|
|
11
|
+
posts.should_not be_blank
|
|
12
|
+
posts.each do |post|
|
|
13
|
+
post.should be_instance_of FbGraph2::Post
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe FbGraph2::Edge::Interests do
|
|
4
|
+
context 'included in User' do
|
|
5
|
+
describe '#interests' do
|
|
6
|
+
let(:me) { FbGraph2::User.me('token') }
|
|
7
|
+
it 'should return an Array of FbGraph2::Page' do
|
|
8
|
+
pages = mock_graph :get, 'me/interests', 'user/interests', access_token: 'token' do
|
|
9
|
+
me.interests
|
|
10
|
+
end
|
|
11
|
+
pages.should_not be_blank
|
|
12
|
+
pages.each do |page|
|
|
13
|
+
page.should be_instance_of FbGraph2::Page
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe FbGraph2::Edge::InvitableFriends do
|
|
4
|
+
context 'included in User' do
|
|
5
|
+
describe '#invitable_friends' do
|
|
6
|
+
let(:me) { FbGraph2::User.me('token') }
|
|
7
|
+
it 'should return an Array of FbGraph2::Struct::InvitableFriend' do
|
|
8
|
+
users = mock_graph :get, 'me/invitable_friends', 'user/invitable_friends', access_token: 'token' do
|
|
9
|
+
me.invitable_friends
|
|
10
|
+
end
|
|
11
|
+
users.should_not be_blank
|
|
12
|
+
users.each do |user|
|
|
13
|
+
user.should be_instance_of FbGraph2::Struct::InvitableFriend
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -21,7 +21,7 @@ describe FbGraph2::Edge::Likes do
|
|
|
21
21
|
it do
|
|
22
22
|
mock_graph :get, 'me/likes/page_id', 'user/likes', access_token: 'token' do
|
|
23
23
|
me.liked? 'page_id'
|
|
24
|
-
end.should
|
|
24
|
+
end.should be true
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
@@ -29,7 +29,7 @@ describe FbGraph2::Edge::Likes do
|
|
|
29
29
|
it do
|
|
30
30
|
mock_graph :get, 'me/likes/page_id', 'blank_collection', access_token: 'token' do
|
|
31
31
|
me.liked? 'page_id'
|
|
32
|
-
end.should
|
|
32
|
+
end.should be false
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
end
|
|
@@ -80,7 +80,7 @@ describe FbGraph2::Edge::Likes do
|
|
|
80
80
|
it 'should return true' do
|
|
81
81
|
mock_graph :post, 'post_id/likes', 'true', access_token: 'token' do
|
|
82
82
|
post.like!
|
|
83
|
-
end.should
|
|
83
|
+
end.should be true
|
|
84
84
|
end
|
|
85
85
|
end
|
|
86
86
|
|
|
@@ -88,7 +88,7 @@ describe FbGraph2::Edge::Likes do
|
|
|
88
88
|
it 'should return true' do
|
|
89
89
|
mock_graph :delete, 'post_id/likes', 'true', access_token: 'token' do
|
|
90
90
|
post.unlike!
|
|
91
|
-
end.should
|
|
91
|
+
end.should be true
|
|
92
92
|
end
|
|
93
93
|
end
|
|
94
94
|
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe FbGraph2::Edge::Links do
|
|
4
|
+
context 'included in User' do
|
|
5
|
+
let(:me) { FbGraph2::User.me('token') }
|
|
6
|
+
describe '#links' do
|
|
7
|
+
it 'should return an Array of FbGraph2::Post' do
|
|
8
|
+
posts = mock_graph :get, 'me/links', 'user/links', access_token: 'token' do
|
|
9
|
+
me.links
|
|
10
|
+
end
|
|
11
|
+
posts.should_not be_blank
|
|
12
|
+
posts.each do |post|
|
|
13
|
+
post.should be_instance_of FbGraph2::Post
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe FbGraph2::Edge::Milestones do
|
|
4
|
+
context 'included in Page' do
|
|
5
|
+
describe '#milestones' do
|
|
6
|
+
let(:page) { FbGraph2::Page.new('page_id').authenticate('token') }
|
|
7
|
+
it 'should return an Array of FbGraph2::Milestone' do
|
|
8
|
+
milestones = mock_graph :get, 'page_id/milestones', 'page/milestones', access_token: 'token' do
|
|
9
|
+
page.milestones
|
|
10
|
+
end
|
|
11
|
+
milestones.should_not be_blank
|
|
12
|
+
milestones.each do |milestone|
|
|
13
|
+
milestone.should be_instance_of FbGraph2::Milestone
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe FbGraph2::Edge::Movies do
|
|
4
|
+
context 'included in User' do
|
|
5
|
+
describe '#movies' do
|
|
6
|
+
let(:me) { FbGraph2::User.me('token') }
|
|
7
|
+
it 'should return an Array of FbGraph2::Page' do
|
|
8
|
+
pages = mock_graph :get, 'me/movies', 'user/movies', access_token: 'token' do
|
|
9
|
+
me.movies
|
|
10
|
+
end
|
|
11
|
+
pages.should_not be_blank
|
|
12
|
+
pages.each do |page|
|
|
13
|
+
page.should be_instance_of FbGraph2::Page
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|