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,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Movies, '#movies' do
|
4
|
+
it 'should return movies pages as GSGraph::Page' do
|
5
|
+
mock_graph :get, 'matake/movies', 'users/movies/matake_private', :access_token => 'access_token' do
|
6
|
+
pages = GSGraph::User.new('matake', :access_token => 'access_token').movies
|
7
|
+
pages.each do |page|
|
8
|
+
page.should be_instance_of(GSGraph::Page)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Music, '#music' do
|
4
|
+
it 'should return music pages as GSGraph::Page' do
|
5
|
+
mock_graph :get, 'matake/music', 'users/music/matake_private', :access_token => 'access_token' do
|
6
|
+
pages = GSGraph::User.new('matake', :access_token => 'access_token').music
|
7
|
+
pages.each do |page|
|
8
|
+
page.should be_instance_of(GSGraph::Page)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::MutualFriends do
|
4
|
+
let(:me) { GSGraph::User.me('access_token') }
|
5
|
+
|
6
|
+
shared_examples_for :fetch_mutual_friends_between_me_and_friend do
|
7
|
+
it 'should return an Array of GSGraph::User' do
|
8
|
+
mock_graph :get, 'me/mutualfriends/agektmr', 'users/mutual_friends/me_and_agektmr', :access_token => 'access_token' do
|
9
|
+
friends = me.mutual_friends(friend)
|
10
|
+
friends.each do |friend|
|
11
|
+
friend.should be_instance_of GSGraph::User
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#mutual_friends' do
|
18
|
+
context 'when friend is a GSGraph::User' do
|
19
|
+
let(:friend) { GSGraph::User.new('agektmr') }
|
20
|
+
it_behaves_like :fetch_mutual_friends_between_me_and_friend
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'when friend is just an identifier' do
|
24
|
+
let(:friend) { 'agektmr' }
|
25
|
+
it_behaves_like :fetch_mutual_friends_between_me_and_friend
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Noreply do
|
4
|
+
let(:event) do
|
5
|
+
GSGraph::Event.new('smartday', :access_token => 'access_token')
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#no_reply' do
|
9
|
+
it 'should return noreply users as GSGraph::User' do
|
10
|
+
mock_graph :get, 'smartday/noreply', 'events/noreply/smartday_private', :access_token => 'access_token' do
|
11
|
+
event.no_reply.each do |user|
|
12
|
+
user.should be_instance_of(GSGraph::User)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '#no_reply?' do
|
19
|
+
context 'when no_reply' do
|
20
|
+
it 'should return true' do
|
21
|
+
mock_graph :get, 'smartday/noreply/uid', 'events/invited/not_replied', :access_token => 'access_token' do
|
22
|
+
event.no_reply?(
|
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/noreply/uid', 'empty', :access_token => 'access_token' do
|
32
|
+
event.no_reply?(
|
33
|
+
GSGraph::User.new('uid')
|
34
|
+
).should be_false
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Notes, '#notes' do
|
4
|
+
context 'when included by GSGraph::User' do
|
5
|
+
it 'should return notes as GSGraph::Note' do
|
6
|
+
mock_graph :get, 'matake/notes', 'users/notes/matake_private', :access_token => 'access_token' do
|
7
|
+
notes = GSGraph::User.new('matake', :access_token => 'access_token').notes
|
8
|
+
notes.each do |note|
|
9
|
+
note.should be_instance_of(GSGraph::Note)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe GSGraph::Connections::Notes, '#note!' do
|
17
|
+
context 'when included by GSGraph::Page' do
|
18
|
+
it 'should return generated note' do
|
19
|
+
mock_graph :post, '12345/notes', 'pages/notes/post_with_valid_access_token', :params => {
|
20
|
+
:subject => 'test',
|
21
|
+
:message => 'hello'
|
22
|
+
}, :access_token => 'valid' do
|
23
|
+
note = GSGraph::Page.new('12345', :access_token => 'valid').note!(:subject => 'test', :message => 'hello')
|
24
|
+
note.identifier.should == 396664845100
|
25
|
+
note.subject.should == 'test'
|
26
|
+
note.message.should == 'hello'
|
27
|
+
note.access_token.should == 'valid'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Notifications do
|
4
|
+
describe '#notifications' do
|
5
|
+
it 'should return notifications as GSGraph::Notification' do
|
6
|
+
mock_graph :get, 'me/notifications', 'users/notifications/all', :params => {
|
7
|
+
:include_read => 'true'
|
8
|
+
}, :access_token => 'access_token' do
|
9
|
+
notifications = GSGraph::User.me('access_token').notifications(:include_read => true)
|
10
|
+
notifications.each do |notification|
|
11
|
+
notification.should be_instance_of GSGraph::Notification
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#notification!' do
|
18
|
+
it 'should return success json' do
|
19
|
+
mock_graph :post, 'matake/notifications', 'success', :params => {
|
20
|
+
:template => 'hello'
|
21
|
+
}, :access_token => 'app_access_token' do
|
22
|
+
response = GSGraph::User.new('matake').notification!(
|
23
|
+
:access_token => 'app_access_token',
|
24
|
+
:template => 'hello'
|
25
|
+
)
|
26
|
+
response.should == {'success' => true}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Outbox, '#outbox' do
|
4
|
+
context 'before message platform transition' do
|
5
|
+
it 'should return threads as GSGraph::Thread::BeforeTransition' do
|
6
|
+
mock_graph :get, 'me/outbox', 'users/outbox/me_private', :access_token => 'access_token' do
|
7
|
+
threads = GSGraph::User.me('access_token').outbox
|
8
|
+
threads.each do |thread|
|
9
|
+
thread.should be_instance_of(GSGraph::Thread::BeforeTransition)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# TODO: after transition, check JSON format and put test here
|
16
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Participants, '#participants' do
|
4
|
+
it 'should return participants as GSGraph::User' do
|
5
|
+
mock_graph :get, '12345/participants', 'thread/participants/private', :params => {:no_cache => 'true'}, :access_token => 'access_token' do
|
6
|
+
participants = GSGraph::Thread.new(12345, :access_token => 'access_token').participants(:no_cache => true)
|
7
|
+
participants.each do |participant|
|
8
|
+
participant.should be_instance_of(GSGraph::User)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'cached messages' do
|
14
|
+
context 'when cached' do
|
15
|
+
let(:thread) { GSGraph::Thread.new(12345, :access_token => 'access_token', :participants => {}) }
|
16
|
+
|
17
|
+
it 'should use cache' do
|
18
|
+
lambda do
|
19
|
+
thread.participants
|
20
|
+
end.should_not request_to '12345/participants?access_token=access_token'
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'when options are specified' do
|
24
|
+
it 'should not use cache' do
|
25
|
+
lambda do
|
26
|
+
thread.participants(:no_cache => true)
|
27
|
+
end.should request_to '12345/participants?access_token=access_token&no_cache=true'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'otherwise' do
|
33
|
+
let(:thread) { GSGraph::Thread.new(12345, :access_token => 'access_token') }
|
34
|
+
|
35
|
+
it 'should not use cache' do
|
36
|
+
lambda do
|
37
|
+
thread.participants
|
38
|
+
end.should request_to '12345/participants?access_token=access_token'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Payments do
|
4
|
+
describe '#payments' do
|
5
|
+
let(:app) { GSGraph::Application.new('app_id', :secret => 'sec sec') }
|
6
|
+
|
7
|
+
it 'should return payments as GSGraph::Order' do
|
8
|
+
mock_graph :post, 'oauth/access_token', 'token_response' do
|
9
|
+
mock_graph :get, 'app_id/payments', 'applications/payments/sample', :access_token => 'token' do
|
10
|
+
app.payments.each do |payment|
|
11
|
+
payment.should be_a GSGraph::Order
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Permissions do
|
4
|
+
describe '#permissions' do
|
5
|
+
let :permissions do
|
6
|
+
mock_graph :get, 'me/permissions', 'users/permissions/me_private', :access_token => 'access_token' do
|
7
|
+
GSGraph::User.me('access_token').permissions
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should be an Array of Symbol' do
|
12
|
+
permissions.should be_instance_of Array
|
13
|
+
permissions.should_not be_blank
|
14
|
+
permissions.each do |permission|
|
15
|
+
permission.should be_instance_of Symbol
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'when blank' do
|
20
|
+
it 'should return blank array' do
|
21
|
+
mock_graph :get, 'me/permissions', 'users/permissions/blank', :access_token => 'access_token' do
|
22
|
+
permissions = GSGraph::User.me('access_token').permissions
|
23
|
+
permissions.should == []
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#revoke!' do
|
30
|
+
it 'should DELETE /:user_id/permissions' do
|
31
|
+
mock_graph :delete, 'me/permissions', 'true', :access_token => 'access_token' do
|
32
|
+
GSGraph::User.me('access_token').revoke!
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should support revoking specific permission' do
|
37
|
+
mock_graph :delete, 'me/permissions', 'true', :access_token => 'access_token', :params => {
|
38
|
+
:permission => :email
|
39
|
+
} do
|
40
|
+
GSGraph::User.me('access_token').revoke! :email
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Photos, '#photos' do
|
4
|
+
context 'when included by GSGraph::Album' do
|
5
|
+
it 'should return photos as GSGraph::Photo' do
|
6
|
+
mock_graph :get, '12345/photos', 'albums/photos/matake_private', :access_token => 'access_token' do
|
7
|
+
photos = GSGraph::Album.new('12345', :access_token => 'access_token').photos
|
8
|
+
photos.each do |photo|
|
9
|
+
photo.should be_instance_of(GSGraph::Photo)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe GSGraph::Connections::Photos, '#photo!' do
|
17
|
+
it 'should return generated photo' do
|
18
|
+
mock_graph :post, '12345/photos', 'albums/photos/post_with_valid_access_token' do
|
19
|
+
photo = GSGraph::Album.new('12345', :access_token => 'valid').photo!(
|
20
|
+
:source => Tempfile.new('image_file'),
|
21
|
+
:message => 'Hello, where is photo?'
|
22
|
+
)
|
23
|
+
photo.identifier.should == 401111132276
|
24
|
+
photo.name.should == 'Hello, where is photo?'
|
25
|
+
photo.access_token.should == 'valid'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should support Tag' do
|
30
|
+
mock_graph :post, '12345/photos', 'albums/photos/post_with_valid_access_token' do
|
31
|
+
photo = GSGraph::Album.new('12345', :access_token => 'valid').photo!(
|
32
|
+
:source => Tempfile.new('image_file'),
|
33
|
+
:message => 'Hello, where is photo?',
|
34
|
+
:tags => [GSGraph::Tag.new(:id => 12345, :name => 'me', :x => 0, :y => 10)]
|
35
|
+
)
|
36
|
+
photo.tags.should == [GSGraph::Tag.new(:id => 12345, :name => 'me', :x => 0, :y => 10)]
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Picture do
|
4
|
+
describe '#picture' do
|
5
|
+
context 'when included by GSGraph::User' do
|
6
|
+
it 'should return image url' do
|
7
|
+
GSGraph::User.new('matake').picture.should == File.join(GSGraph::graph_url, 'matake/picture')
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should support size option' do
|
11
|
+
[:square, :small, :normal, :large].each do |size|
|
12
|
+
GSGraph::User.new('matake').picture(size).should == File.join(GSGraph::graph_url, "matake/picture?type=#{size}")
|
13
|
+
GSGraph::User.new('matake').picture(:type => size).should == File.join(GSGraph::graph_url, "matake/picture?type=#{size}")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should support width option' do
|
18
|
+
GSGraph::User.new('matake').picture(:width => 13).should == File.join(GSGraph::graph_url, "matake/picture?width=13")
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should support height option' do
|
22
|
+
GSGraph::User.new('matake').picture(:height => 37).should == File.join(GSGraph::graph_url, "matake/picture?height=37")
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should support width and height options at the same time' do
|
26
|
+
# Because we can't be sure of order of arguments and order by itself doesn't matter
|
27
|
+
GSGraph::User.new('matake').picture(:width => 13, :height => 37).should satisfy { |uri|
|
28
|
+
[
|
29
|
+
File.join(GSGraph::graph_url, "matake/picture?width=13&height=37"),
|
30
|
+
File.join(GSGraph::graph_url, "matake/picture?height=37&width=13")
|
31
|
+
].include? uri
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'when no-redirect' do
|
36
|
+
it 'should return Picture object' do
|
37
|
+
mock_graph :get, 'matake/picture', 'users/picture/success', :params => {
|
38
|
+
:redirect => 'false'
|
39
|
+
} do
|
40
|
+
picture = GSGraph::User.new('matake').picture(:redirect => false)
|
41
|
+
picture.should be_instance_of GSGraph::Picture
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'when included by GSGraph::Page' do
|
48
|
+
it 'should return image url' do
|
49
|
+
GSGraph::Page.new('platform').picture.should == File.join(GSGraph::graph_url, 'platform/picture')
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should support size option' do
|
53
|
+
[:square, :small, :normal, :large].each do |size|
|
54
|
+
GSGraph::Page.new('platform').picture(size).should == File.join(GSGraph::graph_url, "platform/picture?type=#{size}")
|
55
|
+
GSGraph::Page.new('platform').picture(:type => size).should == File.join(GSGraph::graph_url, "platform/picture?type=#{size}")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'should support width option' do
|
60
|
+
GSGraph::Page.new('platform').picture(:width => 13).should == File.join(GSGraph::graph_url, "platform/picture?width=13")
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'should support height option' do
|
64
|
+
GSGraph::Page.new('platform').picture(:height => 37).should == File.join(GSGraph::graph_url, "platform/picture?height=37")
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'should support width and height options at the same time' do
|
68
|
+
GSGraph::Page.new('platform').picture(:width => 13, :height => 37).should satisfy { |uri|
|
69
|
+
[
|
70
|
+
File.join(GSGraph::graph_url, "platform/picture?width=13&height=37"),
|
71
|
+
File.join(GSGraph::graph_url, "platform/picture?height=37&width=13")
|
72
|
+
].include? uri
|
73
|
+
}
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe GSGraph::Connections::Picture::Updatable do
|
80
|
+
describe '#picture!' do
|
81
|
+
it 'should update profile picture' do
|
82
|
+
mock_graph :post, 'GSGraph/picture', 'true', :access_token => 'page_token', :params => {
|
83
|
+
:picture => 'http://example.com/images/GSGraph.png'
|
84
|
+
} do
|
85
|
+
page = GSGraph::Page.new('GSGraph', :access_token => 'page_token')
|
86
|
+
page.picture!(
|
87
|
+
:picture => 'http://example.com/images/GSGraph.png'
|
88
|
+
).should be_true
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Pokes do
|
4
|
+
describe '#pokes' do
|
5
|
+
it 'should return an Array of Poke' do
|
6
|
+
mock_graph :get, 'me/pokes', 'users/pokes/sample', :access_token => 'access_token' do
|
7
|
+
pokes = GSGraph::User.me('access_token').pokes
|
8
|
+
pokes.should be_instance_of GSGraph::Connection
|
9
|
+
pokes.should be_present
|
10
|
+
pokes.each do |poke|
|
11
|
+
poke.should be_instance_of GSGraph::Poke
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Posts, '#posts' do
|
4
|
+
context 'when included by GSGraph::User' do
|
5
|
+
context 'when no access_token given' do
|
6
|
+
it 'should return public posts the user created as GSGraph::Post' do
|
7
|
+
mock_graph :get, 'arjun/posts', 'users/posts/arjun_public' do
|
8
|
+
posts = GSGraph::User.new('arjun').posts
|
9
|
+
posts.first.should == GSGraph::Post.new(
|
10
|
+
'7901103_121392141207495',
|
11
|
+
:from => {
|
12
|
+
:id => '7901103',
|
13
|
+
:name => 'Arjun Banker'
|
14
|
+
},
|
15
|
+
: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',
|
16
|
+
:link => 'http://www.ted.com/talks/wade_davis_on_endangered_cultures.html',
|
17
|
+
:name => 'Wade Davis on endangered cultures | Video on TED.com',
|
18
|
+
:caption => 'www.ted.com',
|
19
|
+
: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.',
|
20
|
+
:icon => 'http://static.ak.fbcdn.net/rsrc.php/z9XZ8/hash/976ulj6z.gif',
|
21
|
+
:created_time => '2010-04-25T04:05:32+0000',
|
22
|
+
:updated_time => '2010-04-25T04:05:32+0000',
|
23
|
+
:privacy => {
|
24
|
+
:value => 'EVERYONE'
|
25
|
+
}
|
26
|
+
)
|
27
|
+
posts.each do |post|
|
28
|
+
post.should be_instance_of(GSGraph::Post)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|