gs_graph 2.6.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitattributes +22 -0
- data/.gitignore +26 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +95 -0
- data/LICENSE +20 -0
- data/README.rdoc +314 -0
- data/Rakefile +25 -0
- data/VERSION +1 -0
- data/assets/fb_graph.ai +1726 -6
- data/assets/fb_graph.png +0 -0
- data/gs_graph.gemspec +28 -0
- data/lib/gs_graph.rb +174 -0
- data/lib/gs_graph/achievement.rb +44 -0
- data/lib/gs_graph/action.rb +12 -0
- data/lib/gs_graph/ad_account.rb +51 -0
- data/lib/gs_graph/ad_campaign.rb +39 -0
- data/lib/gs_graph/ad_campaign_stat.rb +22 -0
- data/lib/gs_graph/ad_connection_object.rb +53 -0
- data/lib/gs_graph/ad_creative.rb +44 -0
- data/lib/gs_graph/ad_group.rb +51 -0
- data/lib/gs_graph/ad_group_stat.rb +22 -0
- data/lib/gs_graph/ad_keyword.rb +20 -0
- data/lib/gs_graph/ad_keyword_suggestion.rb +8 -0
- data/lib/gs_graph/ad_keyword_valid.rb +23 -0
- data/lib/gs_graph/ad_preview.rb +10 -0
- data/lib/gs_graph/ad_user.rb +58 -0
- data/lib/gs_graph/age_range.rb +12 -0
- data/lib/gs_graph/album.rb +59 -0
- data/lib/gs_graph/app_request.rb +24 -0
- data/lib/gs_graph/application.rb +119 -0
- data/lib/gs_graph/auth.rb +88 -0
- data/lib/gs_graph/auth/cookie.rb +20 -0
- data/lib/gs_graph/auth/signed_request.rb +44 -0
- data/lib/gs_graph/broad_targeting_category.rb +13 -0
- data/lib/gs_graph/checkin.rb +51 -0
- data/lib/gs_graph/collection.rb +55 -0
- data/lib/gs_graph/comment.rb +24 -0
- data/lib/gs_graph/comparison.rb +13 -0
- data/lib/gs_graph/connection.rb +37 -0
- data/lib/gs_graph/connections.rb +3 -0
- data/lib/gs_graph/connections/accounts.rb +23 -0
- data/lib/gs_graph/connections/achievements.rb +21 -0
- data/lib/gs_graph/connections/activities.rb +14 -0
- data/lib/gs_graph/connections/ad_accounts.rb +15 -0
- data/lib/gs_graph/connections/ad_campaign_stats.rb +22 -0
- data/lib/gs_graph/connections/ad_campaigns.rb +30 -0
- data/lib/gs_graph/connections/ad_connection_objects.rb +14 -0
- data/lib/gs_graph/connections/ad_creatives.rb +14 -0
- data/lib/gs_graph/connections/ad_group_stats.rb +22 -0
- data/lib/gs_graph/connections/ad_groups.rb +35 -0
- data/lib/gs_graph/connections/ad_previews.rb +10 -0
- data/lib/gs_graph/connections/admins.rb +10 -0
- data/lib/gs_graph/connections/albums.rb +21 -0
- data/lib/gs_graph/connections/app_notifications.rb +10 -0
- data/lib/gs_graph/connections/app_requests.rb +21 -0
- data/lib/gs_graph/connections/attending.rb +26 -0
- data/lib/gs_graph/connections/banned.rb +31 -0
- data/lib/gs_graph/connections/blocked.rb +36 -0
- data/lib/gs_graph/connections/books.rb +14 -0
- data/lib/gs_graph/connections/broad_targeting_categories.rb +14 -0
- data/lib/gs_graph/connections/checkins.rb +21 -0
- data/lib/gs_graph/connections/comments.rb +21 -0
- data/lib/gs_graph/connections/conversations.rb +14 -0
- data/lib/gs_graph/connections/declined.rb +25 -0
- data/lib/gs_graph/connections/docs.rb +14 -0
- data/lib/gs_graph/connections/events.rb +21 -0
- data/lib/gs_graph/connections/family.rb +14 -0
- data/lib/gs_graph/connections/feed.rb +21 -0
- data/lib/gs_graph/connections/former_participants.rb +14 -0
- data/lib/gs_graph/connections/friend_lists.rb +21 -0
- data/lib/gs_graph/connections/friend_requests.rb +12 -0
- data/lib/gs_graph/connections/friends.rb +14 -0
- data/lib/gs_graph/connections/games.rb +14 -0
- data/lib/gs_graph/connections/groups.rb +14 -0
- data/lib/gs_graph/connections/home.rb +14 -0
- data/lib/gs_graph/connections/inbox.rb +20 -0
- data/lib/gs_graph/connections/insights.rb +27 -0
- data/lib/gs_graph/connections/interests.rb +14 -0
- data/lib/gs_graph/connections/invited.rb +36 -0
- data/lib/gs_graph/connections/likes.rb +29 -0
- data/lib/gs_graph/connections/links.rb +21 -0
- data/lib/gs_graph/connections/maybe.rb +25 -0
- data/lib/gs_graph/connections/members.rb +22 -0
- data/lib/gs_graph/connections/messages.rb +22 -0
- data/lib/gs_graph/connections/milestones.rb +21 -0
- data/lib/gs_graph/connections/movies.rb +14 -0
- data/lib/gs_graph/connections/music.rb +14 -0
- data/lib/gs_graph/connections/mutual_friends.rb +26 -0
- data/lib/gs_graph/connections/noreply.rb +23 -0
- data/lib/gs_graph/connections/notes.rb +21 -0
- data/lib/gs_graph/connections/notifications.rb +18 -0
- data/lib/gs_graph/connections/offers.rb +22 -0
- data/lib/gs_graph/connections/outbox.rb +20 -0
- data/lib/gs_graph/connections/participants.rb +14 -0
- data/lib/gs_graph/connections/payments.rb +14 -0
- data/lib/gs_graph/connections/permissions.rb +16 -0
- data/lib/gs_graph/connections/photos.rb +21 -0
- data/lib/gs_graph/connections/picture.rb +39 -0
- data/lib/gs_graph/connections/pokes.rb +12 -0
- data/lib/gs_graph/connections/posts.rb +14 -0
- data/lib/gs_graph/connections/promotable_posts.rb +14 -0
- data/lib/gs_graph/connections/question_options.rb +14 -0
- data/lib/gs_graph/connections/questions.rb +22 -0
- data/lib/gs_graph/connections/reach_estimates.rb +12 -0
- data/lib/gs_graph/connections/roles.rb +36 -0
- data/lib/gs_graph/connections/scores.rb +22 -0
- data/lib/gs_graph/connections/senders.rb +14 -0
- data/lib/gs_graph/connections/settings.rb +65 -0
- data/lib/gs_graph/connections/statuses.rb +14 -0
- data/lib/gs_graph/connections/subscribed_to.rb +14 -0
- data/lib/gs_graph/connections/subscribers.rb +14 -0
- data/lib/gs_graph/connections/subscriptions.rb +53 -0
- data/lib/gs_graph/connections/tabs.rb +23 -0
- data/lib/gs_graph/connections/tagged.rb +14 -0
- data/lib/gs_graph/connections/tags.rb +23 -0
- data/lib/gs_graph/connections/television.rb +14 -0
- data/lib/gs_graph/connections/test_users.rb +19 -0
- data/lib/gs_graph/connections/threads.rb +14 -0
- data/lib/gs_graph/connections/user_achievements.rb +22 -0
- data/lib/gs_graph/connections/user_likes.rb +19 -0
- data/lib/gs_graph/connections/videos.rb +21 -0
- data/lib/gs_graph/connections/votes.rb +9 -0
- data/lib/gs_graph/cover.rb +10 -0
- data/lib/gs_graph/debugger.rb +28 -0
- data/lib/gs_graph/device.rb +11 -0
- data/lib/gs_graph/doc.rb +18 -0
- data/lib/gs_graph/domain.rb +32 -0
- data/lib/gs_graph/education.rb +32 -0
- data/lib/gs_graph/event.rb +52 -0
- data/lib/gs_graph/exception.rb +139 -0
- data/lib/gs_graph/friend_list.rb +13 -0
- data/lib/gs_graph/friend_request.rb +14 -0
- data/lib/gs_graph/group.rb +29 -0
- data/lib/gs_graph/image.rb +11 -0
- data/lib/gs_graph/insight.rb +13 -0
- data/lib/gs_graph/klass.rb +31 -0
- data/lib/gs_graph/link.rb +32 -0
- data/lib/gs_graph/location.rb +20 -0
- data/lib/gs_graph/message.rb +30 -0
- data/lib/gs_graph/milestone.rb +26 -0
- data/lib/gs_graph/node.rb +149 -0
- data/lib/gs_graph/note.rb +32 -0
- data/lib/gs_graph/notification.rb +32 -0
- data/lib/gs_graph/offer.rb +33 -0
- data/lib/gs_graph/open_graph.rb +3 -0
- data/lib/gs_graph/open_graph/action.rb +42 -0
- data/lib/gs_graph/open_graph/application_context.rb +10 -0
- data/lib/gs_graph/open_graph/object.rb +29 -0
- data/lib/gs_graph/open_graph/user_context.rb +21 -0
- data/lib/gs_graph/order.rb +55 -0
- data/lib/gs_graph/page.rb +57 -0
- data/lib/gs_graph/page/category_attributes.rb +117 -0
- data/lib/gs_graph/photo.rb +48 -0
- data/lib/gs_graph/picture.rb +14 -0
- data/lib/gs_graph/place.rb +7 -0
- data/lib/gs_graph/poke.rb +19 -0
- data/lib/gs_graph/post.rb +117 -0
- data/lib/gs_graph/privacy.rb +27 -0
- data/lib/gs_graph/project.rb +4 -0
- data/lib/gs_graph/promotable_post.rb +34 -0
- data/lib/gs_graph/property.rb +13 -0
- data/lib/gs_graph/query.rb +47 -0
- data/lib/gs_graph/question.rb +26 -0
- data/lib/gs_graph/question_option.rb +22 -0
- data/lib/gs_graph/reach_estimate.rb +22 -0
- data/lib/gs_graph/role.rb +13 -0
- data/lib/gs_graph/score.rb +16 -0
- data/lib/gs_graph/searchable.rb +33 -0
- data/lib/gs_graph/searchable/result.rb +31 -0
- data/lib/gs_graph/serialization.rb +19 -0
- data/lib/gs_graph/status.rb +27 -0
- data/lib/gs_graph/subscription.rb +14 -0
- data/lib/gs_graph/tab.rb +17 -0
- data/lib/gs_graph/tag.rb +30 -0
- data/lib/gs_graph/tagged_object.rb +23 -0
- data/lib/gs_graph/targeting.rb +23 -0
- data/lib/gs_graph/test_user.rb +24 -0
- data/lib/gs_graph/thread.rb +71 -0
- data/lib/gs_graph/user.rb +153 -0
- data/lib/gs_graph/user_achievement.rb +35 -0
- data/lib/gs_graph/venue.rb +14 -0
- data/lib/gs_graph/video.rb +41 -0
- data/lib/gs_graph/work.rb +48 -0
- data/lib/patch/rack/oauth2/access_token.rb +11 -0
- data/lib/patch/rack/oauth2/access_token/introspectable.rb +37 -0
- data/lib/patch/rack/oauth2/client.rb +13 -0
- data/lib/patch/rack/oauth2/grant/fb_exchange_token.rb +11 -0
- data/lib/patch/rack/oauth2/util.rb +14 -0
- data/spec/gs_graph/achievement_spec.rb +59 -0
- data/spec/gs_graph/ad_account_spec.rb +124 -0
- data/spec/gs_graph/ad_campaign_spec.rb +99 -0
- data/spec/gs_graph/ad_connection_object_spec.rb +71 -0
- data/spec/gs_graph/ad_creative_spec.rb +87 -0
- data/spec/gs_graph/ad_group_spec.rb +95 -0
- data/spec/gs_graph/ad_keyword_spec.rb +27 -0
- data/spec/gs_graph/ad_keyword_suggestion_spec.rb +17 -0
- data/spec/gs_graph/ad_keyword_valid_spec.rb +19 -0
- data/spec/gs_graph/ad_user_spec.rb +67 -0
- data/spec/gs_graph/album_spec.rb +93 -0
- data/spec/gs_graph/app_request_spec.rb +40 -0
- data/spec/gs_graph/application_spec.rb +251 -0
- data/spec/gs_graph/auth/cookie_spec.rb +29 -0
- data/spec/gs_graph/auth/signed_request_spec.rb +22 -0
- data/spec/gs_graph/auth_spec.rb +223 -0
- data/spec/gs_graph/broad_targeting_category_spec.rb +17 -0
- data/spec/gs_graph/checkin_spec.rb +42 -0
- data/spec/gs_graph/collection_spec.rb +50 -0
- data/spec/gs_graph/comment_spec.rb +31 -0
- data/spec/gs_graph/connection_spec.rb +42 -0
- data/spec/gs_graph/connections/accounts_spec.rb +78 -0
- data/spec/gs_graph/connections/achievements_spec.rb +27 -0
- data/spec/gs_graph/connections/activities_spec.rb +34 -0
- data/spec/gs_graph/connections/ad_accounts_spec.rb +28 -0
- data/spec/gs_graph/connections/ad_campaign_stat_spec.rb +35 -0
- data/spec/gs_graph/connections/ad_campaigns_spec.rb +36 -0
- data/spec/gs_graph/connections/ad_connection_objects_spec.rb +20 -0
- data/spec/gs_graph/connections/ad_creatives_spec.rb +29 -0
- data/spec/gs_graph/connections/ad_group_stat_spec.rb +54 -0
- data/spec/gs_graph/connections/ad_groups_spec.rb +92 -0
- data/spec/gs_graph/connections/ad_previews_spec.rb +18 -0
- data/spec/gs_graph/connections/admins_spec.rb +20 -0
- data/spec/gs_graph/connections/albums_spec.rb +63 -0
- data/spec/gs_graph/connections/app_notifications_spec.rb +23 -0
- data/spec/gs_graph/connections/app_requests_spec.rb +28 -0
- data/spec/gs_graph/connections/attending_spec.rb +47 -0
- data/spec/gs_graph/connections/banned_spec.rb +63 -0
- data/spec/gs_graph/connections/blocked_spec.rb +56 -0
- data/spec/gs_graph/connections/books_spec.rb +32 -0
- data/spec/gs_graph/connections/broad_targeting_categories_spec.rb +18 -0
- data/spec/gs_graph/connections/checkins_spec.rb +153 -0
- data/spec/gs_graph/connections/comments_spec.rb +75 -0
- data/spec/gs_graph/connections/conversations_spec.rb +19 -0
- data/spec/gs_graph/connections/declined_spec.rb +47 -0
- data/spec/gs_graph/connections/docs_spec.rb +14 -0
- data/spec/gs_graph/connections/events_spec.rb +52 -0
- data/spec/gs_graph/connections/family_spec.rb +32 -0
- data/spec/gs_graph/connections/feed_spec.rb +124 -0
- data/spec/gs_graph/connections/former_participants_spec.rb +44 -0
- data/spec/gs_graph/connections/friend_lists_spec.rb +26 -0
- data/spec/gs_graph/connections/friend_requests_spec.rb +16 -0
- data/spec/gs_graph/connections/friends_spec.rb +51 -0
- data/spec/gs_graph/connections/games_spec.rb +20 -0
- data/spec/gs_graph/connections/groups_spec.rb +31 -0
- data/spec/gs_graph/connections/home_spec.rb +62 -0
- data/spec/gs_graph/connections/inbox_spec.rb +16 -0
- data/spec/gs_graph/connections/insights_spec.rb +104 -0
- data/spec/gs_graph/connections/interests_spec.rb +12 -0
- data/spec/gs_graph/connections/invited_spec.rb +84 -0
- data/spec/gs_graph/connections/likes_spec.rb +127 -0
- data/spec/gs_graph/connections/links_spec.rb +31 -0
- data/spec/gs_graph/connections/maybe_spec.rb +47 -0
- data/spec/gs_graph/connections/members_spec.rb +57 -0
- data/spec/gs_graph/connections/messages_spec.rb +58 -0
- data/spec/gs_graph/connections/milestones_spec.rb +40 -0
- data/spec/gs_graph/connections/movies_spec.rb +12 -0
- data/spec/gs_graph/connections/music_spec.rb +12 -0
- data/spec/gs_graph/connections/mutual_friends_spec.rb +28 -0
- data/spec/gs_graph/connections/noreply_spec.rb +39 -0
- data/spec/gs_graph/connections/notes_spec.rb +31 -0
- data/spec/gs_graph/connections/notifications_spec.rb +30 -0
- data/spec/gs_graph/connections/outbox_spec.rb +16 -0
- data/spec/gs_graph/connections/participants_spec.rb +42 -0
- data/spec/gs_graph/connections/payments_spec.rb +17 -0
- data/spec/gs_graph/connections/permissions_spec.rb +44 -0
- data/spec/gs_graph/connections/photos_spec.rb +39 -0
- data/spec/gs_graph/connections/picture_spec.rb +92 -0
- data/spec/gs_graph/connections/pokes_spec.rb +16 -0
- data/spec/gs_graph/connections/posts_spec.rb +34 -0
- data/spec/gs_graph/connections/promotable_posts_spec.rb +24 -0
- data/spec/gs_graph/connections/question_options_spec.rb +14 -0
- data/spec/gs_graph/connections/questions_spec.rb +31 -0
- data/spec/gs_graph/connections/reach_estimates_spec.rb +18 -0
- data/spec/gs_graph/connections/roles_spec.rb +59 -0
- data/spec/gs_graph/connections/scores_spec.rb +40 -0
- data/spec/gs_graph/connections/senders_spec.rb +42 -0
- data/spec/gs_graph/connections/settings_spec.rb +62 -0
- data/spec/gs_graph/connections/statuses_spec.rb +72 -0
- data/spec/gs_graph/connections/subscribed_to_spec.rb +12 -0
- data/spec/gs_graph/connections/subscribers_spec.rb +12 -0
- data/spec/gs_graph/connections/subscriptions_spec.rb +47 -0
- data/spec/gs_graph/connections/tabs_spec.rb +47 -0
- data/spec/gs_graph/connections/tagged_spec.rb +42 -0
- data/spec/gs_graph/connections/tags_spec.rb +30 -0
- data/spec/gs_graph/connections/television_spec.rb +12 -0
- data/spec/gs_graph/connections/test_users_spec.rb +65 -0
- data/spec/gs_graph/connections/threads_spec.rb +12 -0
- data/spec/gs_graph/connections/user_achievements_spec.rb +37 -0
- data/spec/gs_graph/connections/user_likes_spec.rb +55 -0
- data/spec/gs_graph/connections/videos_spec.rb +27 -0
- data/spec/gs_graph/connections/votes_spec.rb +15 -0
- data/spec/gs_graph/debugger_spec.rb +33 -0
- data/spec/gs_graph/doc_spec.rb +27 -0
- data/spec/gs_graph/domain_spec.rb +23 -0
- data/spec/gs_graph/education_spec.rb +61 -0
- data/spec/gs_graph/event_spec.rb +70 -0
- data/spec/gs_graph/exception_spec.rb +310 -0
- data/spec/gs_graph/friend_list_spec.rb +22 -0
- data/spec/gs_graph/group_spec.rb +28 -0
- data/spec/gs_graph/image_spec.rb +16 -0
- data/spec/gs_graph/insight_spec.rb +18 -0
- data/spec/gs_graph/link_spec.rb +41 -0
- data/spec/gs_graph/location_spec.rb +28 -0
- data/spec/gs_graph/message_spec.rb +47 -0
- data/spec/gs_graph/node_spec.rb +91 -0
- data/spec/gs_graph/note_spec.rb +37 -0
- data/spec/gs_graph/notification_spec.rb +59 -0
- data/spec/gs_graph/offer_spec.rb +30 -0
- data/spec/gs_graph/open_graph/action_spec.rb +112 -0
- data/spec/gs_graph/open_graph/application_context_spec.rb +28 -0
- data/spec/gs_graph/open_graph/object_spec.rb +76 -0
- data/spec/gs_graph/open_graph/user_context_spec.rb +33 -0
- data/spec/gs_graph/order_spec.rb +66 -0
- data/spec/gs_graph/page/local_business_spec.rb +88 -0
- data/spec/gs_graph/page/movie_spec.rb +25 -0
- data/spec/gs_graph/page/music_spec.rb +25 -0
- data/spec/gs_graph/page/person_spec.rb +23 -0
- data/spec/gs_graph/page/product_spec.rb +36 -0
- data/spec/gs_graph/page_spec.rb +81 -0
- data/spec/gs_graph/photo_spec.rb +85 -0
- data/spec/gs_graph/place_spec.rb +8 -0
- data/spec/gs_graph/post_spec.rb +238 -0
- data/spec/gs_graph/privacy_spec.rb +33 -0
- data/spec/gs_graph/project_spec.rb +46 -0
- data/spec/gs_graph/promotable_post_spec.rb +57 -0
- data/spec/gs_graph/qeustion_option_spec.rb +35 -0
- data/spec/gs_graph/query_spec.rb +73 -0
- data/spec/gs_graph/question_spec.rb +73 -0
- data/spec/gs_graph/reach_estimate_spec.rb +48 -0
- data/spec/gs_graph/searchable_spec.rb +47 -0
- data/spec/gs_graph/seriarization_spec.rb +29 -0
- data/spec/gs_graph/status_spec.rb +31 -0
- data/spec/gs_graph/subscription_spec.rb +5 -0
- data/spec/gs_graph/tag_spec.rb +34 -0
- data/spec/gs_graph/tagged_object_spec.rb +45 -0
- data/spec/gs_graph/targeting_spec.rb +34 -0
- data/spec/gs_graph/test_user_spec.rb +50 -0
- data/spec/gs_graph/thread_spec.rb +86 -0
- data/spec/gs_graph/user_achievement_spec.rb +53 -0
- data/spec/gs_graph/user_spec.rb +185 -0
- data/spec/gs_graph/venue_spec.rb +23 -0
- data/spec/gs_graph/video_spec.rb +31 -0
- data/spec/gs_graph/work_spec.rb +101 -0
- data/spec/gs_graph_spec.rb +57 -0
- data/spec/spec_helper.rb +9 -0
- metadata +538 -0
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Blocked do
|
4
|
+
let(:page) { GSGraph::Page.new(117513961602338, :access_token => 'access_token') }
|
5
|
+
let(:user) { GSGraph::User.new(579612276) }
|
6
|
+
|
7
|
+
describe '#blocked' do
|
8
|
+
it 'should return blocked users as GSGraph::User' do
|
9
|
+
mock_graph :get, '117513961602338/blocked', 'pages/blocked/index', :access_token => 'access_token' do
|
10
|
+
users = page.blocked
|
11
|
+
users.each do |user|
|
12
|
+
user.should be_a GSGraph::User
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '#blocked?' do
|
19
|
+
context 'when blocked' do
|
20
|
+
it 'should retrun true' do
|
21
|
+
mock_graph :get, '117513961602338/blocked/579612276', 'pages/blocked/show_blocked', :access_token => 'access_token' do
|
22
|
+
page.blocked?(user).should be_true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'otherwise' do
|
28
|
+
it 'should retrun false' do
|
29
|
+
mock_graph :get, '117513961602338/blocked/579612276', 'pages/blocked/show_non_blocked', :access_token => 'access_token' do
|
30
|
+
page.blocked?(user).should be_false
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe '#block!' do
|
37
|
+
it 'should return blocked users as GSGraph::User' do
|
38
|
+
mock_graph :post, '117513961602338/blocked', 'pages/blocked/create', :access_token => 'access_token', :params => {
|
39
|
+
:uid => '579612276'
|
40
|
+
} do
|
41
|
+
blocked = page.block! user
|
42
|
+
blocked.each do |user|
|
43
|
+
user.should be_a GSGraph::User
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe '#unblock!' do
|
50
|
+
it 'should return true' do
|
51
|
+
mock_graph :delete, '117513961602338/blocked/579612276', 'true', :access_token => 'access_token' do
|
52
|
+
page.unblock!(user).should be_true
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Books, '#books' do
|
4
|
+
context 'when included by GSGraph::User' do
|
5
|
+
context 'when no access_token given' do
|
6
|
+
it 'should raise GSGraph::Unauthorized' do
|
7
|
+
mock_graph :get, 'matake/books', 'users/books/matake_public', :status => [401, 'Unauthorized'] do
|
8
|
+
lambda do
|
9
|
+
GSGraph::User.new('matake').books
|
10
|
+
end.should raise_exception(GSGraph::Unauthorized)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'when access_token is given' do
|
16
|
+
it 'should return books as GSGraph::Page' do
|
17
|
+
mock_graph :get, 'matake/books', 'users/books/matake_private', :access_token => 'access_token' do
|
18
|
+
books = GSGraph::User.new('matake', :access_token => 'access_token').books
|
19
|
+
books.first.should == GSGraph::Page.new(
|
20
|
+
'102253616477130',
|
21
|
+
:access_token => 'access_token',
|
22
|
+
:name => 'Momo Michael Ende',
|
23
|
+
:category => 'Unknown'
|
24
|
+
)
|
25
|
+
books.each do |book|
|
26
|
+
book.should be_instance_of(GSGraph::Page)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::BroadTargetingCategories, '#broad_targeting_categories' do
|
4
|
+
context 'when included by GSGraph::AdAccount' do
|
5
|
+
context 'when access_token is given' do
|
6
|
+
it 'should return broad_targeting_categories as GSGraph::BroadTargetingCategory' do
|
7
|
+
mock_graph :get, 'act_22334455/broadtargetingcategories', 'ad_accounts/broad_targeting_categories/test_bct', :access_token => 'access_token' do
|
8
|
+
bcts = GSGraph::AdAccount.new("act_22334455").broad_targeting_categories(:access_token => 'access_token')
|
9
|
+
bcts.size.should == 3
|
10
|
+
bcts.each {|x| x.should be_instance_of(GSGraph::BroadTargetingCategory)}
|
11
|
+
bcts[0].identifier.should == 6002714885172
|
12
|
+
bcts[0].name.should == "Cooking"
|
13
|
+
bcts[0].parent_category.should == "Activities"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,153 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Checkins do
|
4
|
+
describe '#checkins' do
|
5
|
+
context 'when included by GSGraph::User' do
|
6
|
+
context 'when no access_token given' do
|
7
|
+
it 'should raise GSGraph::Unauthorized' do
|
8
|
+
mock_graph :get, 'mattt/checkins', 'users/checkins/mattt_public', :status => [401, 'Unauthorized'] do
|
9
|
+
lambda do
|
10
|
+
GSGraph::User.new('mattt').checkins
|
11
|
+
end.should raise_exception(GSGraph::Unauthorized)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'when access_token is given' do
|
17
|
+
it 'should return checkins as GSGraph::Checkin' do
|
18
|
+
mock_graph :get, 'mattt/checkins', 'users/checkins/mattt_private', :access_token => 'access_token' do
|
19
|
+
checkins = GSGraph::User.new('mattt', :access_token => 'access_token').checkins
|
20
|
+
checkins.first.should == GSGraph::Checkin.new(
|
21
|
+
'696876187499',
|
22
|
+
:access_token => 'access_token',
|
23
|
+
:from => {
|
24
|
+
:id => '12820552',
|
25
|
+
:name => 'Roger Pincombe'
|
26
|
+
},
|
27
|
+
:tags => {
|
28
|
+
:data => [{
|
29
|
+
:id => '4810308',
|
30
|
+
:name => 'Mattt Thompson'
|
31
|
+
}]
|
32
|
+
},
|
33
|
+
:message => 'Checking out Austin, TX',
|
34
|
+
:place => {
|
35
|
+
:id => '120454134658381',
|
36
|
+
:name => 'Gowalla HQ',
|
37
|
+
:location => {
|
38
|
+
:latitude => 30.26876,
|
39
|
+
:longitude => -97.74962
|
40
|
+
}
|
41
|
+
},
|
42
|
+
:application => {
|
43
|
+
:id => '6628568379',
|
44
|
+
:name => 'Facebook for iPhone'
|
45
|
+
},
|
46
|
+
:created_time => '2010-09-08T00:09:25+0000'
|
47
|
+
)
|
48
|
+
checkins.each do |checkin|
|
49
|
+
checkin.should be_instance_of(GSGraph::Checkin)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context 'when included by GSGraph::Page' do
|
57
|
+
context 'when no access_token given' do
|
58
|
+
it 'should raise GSGraph::Unauthorized' do
|
59
|
+
mock_graph :get, 'gowalla/checkins', 'pages/checkins/gowalla_public', :status => [401, 'Unauthorized'] do
|
60
|
+
lambda do
|
61
|
+
GSGraph::Page.new('gowalla').checkins
|
62
|
+
end.should raise_exception(GSGraph::Unauthorized)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
context 'when access_token is given' do
|
68
|
+
it 'should return checkins as GSGraph::Checkin' do
|
69
|
+
mock_graph :get, 'gowalla/checkins', 'pages/checkins/gowalla_private', :access_token => 'access_token' do
|
70
|
+
checkins = GSGraph::Page.new('gowalla', :access_token => 'access_token').checkins
|
71
|
+
checkins.first.should == GSGraph::Checkin.new(
|
72
|
+
'696876187499',
|
73
|
+
:access_token => 'access_token',
|
74
|
+
:from => {
|
75
|
+
:id => '12820552',
|
76
|
+
:name => 'Roger Pincombe'
|
77
|
+
},
|
78
|
+
:tags => {
|
79
|
+
:data => [{
|
80
|
+
:id => '4810308',
|
81
|
+
:name => 'Mattt Thompson'
|
82
|
+
}]
|
83
|
+
},
|
84
|
+
:message => 'Checking out Austin, TX',
|
85
|
+
:place => {
|
86
|
+
:id => '120454134658381',
|
87
|
+
:name => 'Gowalla HQ',
|
88
|
+
:location => {
|
89
|
+
:latitude => 30.26876,
|
90
|
+
:longitude => -97.74962
|
91
|
+
}
|
92
|
+
},
|
93
|
+
:application => {
|
94
|
+
:id => '6628568379',
|
95
|
+
:name => 'Facebook for iPhone'
|
96
|
+
},
|
97
|
+
:created_time => '2010-09-08T00:09:25+0000'
|
98
|
+
)
|
99
|
+
checkins.each do |checkin|
|
100
|
+
checkin.should be_instance_of(GSGraph::Checkin)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe '#checkin!' do
|
109
|
+
it 'should POST :user_id/checkins' do
|
110
|
+
mock_graph :post, 'me/checkins', 'users/checkins/posted' do
|
111
|
+
checkin = GSGraph::User.me('token').checkin!(
|
112
|
+
:place => 'place_id',
|
113
|
+
:coordinates => {
|
114
|
+
:latitude => 30.26876,
|
115
|
+
:longitude => -97.74962
|
116
|
+
}.to_json
|
117
|
+
)
|
118
|
+
checkin.identifier.should == '10150090286117277'
|
119
|
+
checkin.place.should == GSGraph::Place.new('place_id')
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
context 'when tags are given' do
|
124
|
+
it 'should allow single tag' do
|
125
|
+
mock_graph :post, 'me/checkins', 'users/checkins/posted' do
|
126
|
+
checkin = GSGraph::User.me('token').checkin!(
|
127
|
+
:place => 'place_id',
|
128
|
+
:coordinates => {
|
129
|
+
:latitude => 30.26876,
|
130
|
+
:longitude => -97.74962
|
131
|
+
}.to_json,
|
132
|
+
:tags => 'friend_1'
|
133
|
+
)
|
134
|
+
checkin.tags.should == [GSGraph::User.new('friend_1')]
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
it 'should allow multiple tags' do
|
139
|
+
mock_graph :post, 'me/checkins', 'users/checkins/posted' do
|
140
|
+
checkin = GSGraph::User.me('token').checkin!(
|
141
|
+
:place => 'place_id',
|
142
|
+
:coordinates => {
|
143
|
+
:latitude => 30.26876,
|
144
|
+
:longitude => -97.74962
|
145
|
+
}.to_json,
|
146
|
+
:tags => ['friend_1', 'friend_2']
|
147
|
+
)
|
148
|
+
checkin.tags.should == [GSGraph::User.new('friend_1'), GSGraph::User.new('friend_2')]
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Comments, '#comments' do
|
4
|
+
context 'when included by GSGraph::Post' do
|
5
|
+
let :post do
|
6
|
+
mock_graph :get, 'no_comments', 'posts/no_comments' do
|
7
|
+
GSGraph::Post.new('no_comments').fetch
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe 'cached comments' do
|
12
|
+
context 'when cached' do
|
13
|
+
it 'should use cache' do
|
14
|
+
lambda do
|
15
|
+
post.comments
|
16
|
+
end.should_not request_to "#{post.identifier}/comments"
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'when options are specified' do
|
20
|
+
it 'should not use cache' do
|
21
|
+
lambda do
|
22
|
+
post.comments(:no_cache => true)
|
23
|
+
end.should request_to "#{post.identifier}/comments?no_cache=true"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'otherwise' do
|
29
|
+
let(:post) { GSGraph::Post.new(12345, :access_token => 'access_token') }
|
30
|
+
|
31
|
+
it 'should not use cache' do
|
32
|
+
lambda do
|
33
|
+
post.comments
|
34
|
+
end.should request_to '12345/comments?access_token=access_token'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe GSGraph::Connections::Comments, '#comment!' do
|
42
|
+
context 'when included by GSGraph::Post' do
|
43
|
+
context 'when no access_token given' do
|
44
|
+
it 'should raise GSGraph::Exception' do
|
45
|
+
mock_graph :post, '12345/comments', 'posts/comments/post_without_access_token', :status => [500, 'Internal Server Error'] do
|
46
|
+
lambda do
|
47
|
+
GSGraph::Post.new('12345').comment!(:message => 'hello')
|
48
|
+
end.should raise_exception(GSGraph::Exception)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'when invalid access_token is given' do
|
54
|
+
it 'should raise GSGraph::Exception' do
|
55
|
+
mock_graph :post, '12345/comments', 'posts/comments/post_with_invalid_access_token', :status => [500, 'Internal Server Error'] do
|
56
|
+
lambda do
|
57
|
+
GSGraph::Post.new('12345', :access_token => 'invalid').comment!(:message => 'hello')
|
58
|
+
end.should raise_exception(GSGraph::Exception)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'when valid access_token is given' do
|
64
|
+
it 'should return generated comment' do
|
65
|
+
mock_graph :post, '12345/comments', 'posts/comments/post_with_valid_access_token' do
|
66
|
+
comment = GSGraph::Post.new('12345', :access_token => 'valid').comment!(:message => 'hello')
|
67
|
+
comment.identifier.should == '117513961602338_119401698085884_535271'
|
68
|
+
comment.access_token.should == 'valid'
|
69
|
+
comment.message.should == 'hello'
|
70
|
+
comment.access_token.should == 'valid'
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Conversations do
|
4
|
+
describe '#conversations' do
|
5
|
+
let(:page) do
|
6
|
+
GSGraph::Page.new('page_id', :access_token => 'page_token')
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should return an Array of GSGraph::Thread' do
|
10
|
+
mock_graph :get, 'page_id/conversations', 'pages/conversations/list', :access_token => 'page_token' do
|
11
|
+
conversations = page.conversations
|
12
|
+
conversations.should be_instance_of GSGraph::Connection
|
13
|
+
conversations.each do |conversation|
|
14
|
+
conversation.should be_instance_of GSGraph::Thread
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Declined do
|
4
|
+
let(:event) do
|
5
|
+
GSGraph::Event.new('smartday', :access_token => 'access_token')
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#declined' do
|
9
|
+
it 'should return declined users as GSGraph::User' do
|
10
|
+
mock_graph :get, 'smartday/declined', 'events/declined/smartday_private', :access_token => 'access_token' do
|
11
|
+
event.declined.each do |user|
|
12
|
+
user.should be_instance_of(GSGraph::User)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '#declined?' do
|
19
|
+
context 'when declined' do
|
20
|
+
it 'should return true' do
|
21
|
+
mock_graph :get, 'smartday/declined/uid', 'events/invited/declined', :access_token => 'access_token' do
|
22
|
+
event.declined?(
|
23
|
+
GSGraph::User.new('uid')
|
24
|
+
).should be_true
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'otherwise' do
|
30
|
+
it 'should return false' do
|
31
|
+
mock_graph :get, 'smartday/declined/uid', 'empty', :access_token => 'access_token' do
|
32
|
+
event.declined?(
|
33
|
+
GSGraph::User.new('uid')
|
34
|
+
).should be_false
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#declined!' do
|
41
|
+
it 'should return true' do
|
42
|
+
mock_graph :post, 'smartday/declined', 'events/declined/post_with_valid_access_token', :access_token => 'access_token' do
|
43
|
+
event.declined!.should be_true
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Docs do
|
4
|
+
describe '#docs' do
|
5
|
+
it 'should return docs as GSGraph::Doc' do
|
6
|
+
mock_graph :get, 'my_group/docs', 'groups/docs/private', :access_token => 'access_token' do
|
7
|
+
docs = GSGraph::Group.new('my_group', :access_token => 'access_token').docs
|
8
|
+
docs.each do |doc|
|
9
|
+
doc.should be_instance_of(GSGraph::Doc)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Events, '#events' do
|
4
|
+
context 'when included by GSGraph::User' do
|
5
|
+
context 'when no access_token given' do
|
6
|
+
it 'should raise GSGraph::Unauthorized' do
|
7
|
+
mock_graph :get, 'matake/events', 'users/events/matake_public', :status => [401, 'Unauthorized'] do
|
8
|
+
lambda do
|
9
|
+
GSGraph::User.new('matake').events
|
10
|
+
end.should raise_exception(GSGraph::Unauthorized)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'when access_token is given' do
|
16
|
+
it 'should return events as GSGraph::Event' do
|
17
|
+
mock_graph :get, 'matake/events', 'users/events/matake_private', :access_token => 'access_token' do
|
18
|
+
events = GSGraph::User.new('matake', :access_token => 'access_token').events
|
19
|
+
events.first.should == GSGraph::Event.new(
|
20
|
+
'116600818359630',
|
21
|
+
:access_token => 'access_token',
|
22
|
+
:name => 'The Loyal We @ Rainy Day Bookstore and Cafe',
|
23
|
+
:start_time => '2010-04-29T01:30:00+0000',
|
24
|
+
:end_time => '2010-04-29T04:30:00+0000',
|
25
|
+
:location => 'Nishi Azabu'
|
26
|
+
)
|
27
|
+
events.each do |event|
|
28
|
+
event.should be_instance_of(GSGraph::Event)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe GSGraph::Connections::Events, '#events!' do
|
37
|
+
context 'when included by GSGraph::User' do
|
38
|
+
it 'should return generated note' do
|
39
|
+
mock_graph :post, 'matake/events', 'users/events/post_with_valid_access_token' do
|
40
|
+
event = GSGraph::User.new('matake', :access_token => 'valid').event!(
|
41
|
+
:name => 'GSGraph test event',
|
42
|
+
:start_time => Time.utc(2010, 5, 11, 10, 0, 0).to_i,
|
43
|
+
:end_time => Time.utc(2010, 5, 11, 12, 0, 0).to_i
|
44
|
+
)
|
45
|
+
event.name.should == 'GSGraph test event'
|
46
|
+
event.access_token.should == 'valid'
|
47
|
+
event.start_time.should == Time.utc(2010, 5, 11, 10, 0, 0)
|
48
|
+
event.end_time.should == Time.utc(2010, 5, 11, 12, 0, 0)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|