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,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Family, '#family' 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, 'me/family', 'users/family/family_without_access_token', :status => [401, 'Unauthorized'] do
|
8
|
+
lambda do
|
9
|
+
GSGraph::User.new('me').family
|
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 family members as GSGraph::User' do
|
17
|
+
mock_graph :get, 'me/family', 'users/family/me_public', :access_token => 'access_token' do
|
18
|
+
users = GSGraph::User.new('me', :access_token => 'access_token').family
|
19
|
+
users.first.should == GSGraph::User.new(
|
20
|
+
'720112389',
|
21
|
+
:access_token => 'access_token',
|
22
|
+
:name => 'TD Lee',
|
23
|
+
:relationship => 'brother'
|
24
|
+
)
|
25
|
+
users.each do |user|
|
26
|
+
user.should be_instance_of(GSGraph::User)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Feed, '#feed' do
|
4
|
+
context 'when included by GSGraph::User' do
|
5
|
+
context 'when no access_token given' do
|
6
|
+
it 'should return public posts on the user\'s wall as GSGraph::Post' do
|
7
|
+
mock_graph :get, 'arjun/feed', 'users/feed/arjun_public' do
|
8
|
+
posts = GSGraph::User.new('arjun').feed
|
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
|
+
|
34
|
+
context 'when access_token is given' do
|
35
|
+
it 'should return posts on the user\'s wall as GSGraph::Post' do
|
36
|
+
mock_graph :get, 'arjun/feed', 'users/feed/arjun_private', :access_token => 'access_token' do
|
37
|
+
posts = GSGraph::User.new('arjun').feed(:access_token => 'access_token')
|
38
|
+
posts.first.should == GSGraph::Post.new(
|
39
|
+
'7901103_121392141207495',
|
40
|
+
:access_token => 'access_token',
|
41
|
+
:from => {
|
42
|
+
:id => '7901103',
|
43
|
+
:name => 'Arjun Banker'
|
44
|
+
},
|
45
|
+
: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',
|
46
|
+
:link => 'http://www.ted.com/talks/wade_davis_on_endangered_cultures.html',
|
47
|
+
:name => 'Wade Davis on endangered cultures | Video on TED.com',
|
48
|
+
:caption => 'www.ted.com',
|
49
|
+
: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.',
|
50
|
+
:icon => 'http://static.ak.fbcdn.net/rsrc.php/z9XZ8/hash/976ulj6z.gif',
|
51
|
+
:created_time => '2010-04-25T04:05:32+0000',
|
52
|
+
:updated_time => '2010-04-25T04:05:32+0000',
|
53
|
+
:privacy => {
|
54
|
+
:value => 'EVERYONE'
|
55
|
+
}
|
56
|
+
)
|
57
|
+
posts.each do |post|
|
58
|
+
post.should be_instance_of(GSGraph::Post)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe GSGraph::Connections::Feed, '#feed!' do
|
67
|
+
context 'when included by GSGraph::User' do
|
68
|
+
context 'when no access_token given' do
|
69
|
+
it 'should raise GSGraph::Exception' do
|
70
|
+
mock_graph :post, 'matake/feed', 'users/feed/post_without_access_token', :status => [500, 'Internal Server Error'] do
|
71
|
+
lambda do
|
72
|
+
GSGraph::User.new('matake').feed!(:message => 'hello')
|
73
|
+
end.should raise_exception(GSGraph::Exception)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
context 'when invalid access_token is given' do
|
79
|
+
it 'should raise GSGraph::Exception' do
|
80
|
+
mock_graph :post, 'matake/feed', 'users/feed/post_with_invalid_access_token', :status => [500, 'Internal Server Error'] do
|
81
|
+
lambda do
|
82
|
+
GSGraph::User.new('matake', :access_token => 'invalid').feed!(:message => 'hello')
|
83
|
+
end.should raise_exception(GSGraph::Exception)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
context 'when valid access_token is given' do
|
89
|
+
it 'should return generated post' do
|
90
|
+
mock_graph :post, 'matake/feed', 'users/feed/post_with_valid_access_token' do
|
91
|
+
post = GSGraph::User.new('matake', :access_token => 'valid').feed!(:message => 'hello')
|
92
|
+
post.identifier.should == '579612276_401071652276'
|
93
|
+
post.message.should == 'hello'
|
94
|
+
post.access_token.should == 'valid'
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
context 'when place is given as page_id' do
|
100
|
+
it 'should have Place' do
|
101
|
+
mock_graph :post, 'matake/feed', 'users/feed/post_with_valid_access_token', :access_token => 'access_token', :params => {
|
102
|
+
:message => 'hello',
|
103
|
+
:place => 'place_page_id'
|
104
|
+
} do
|
105
|
+
post = GSGraph::User.new('matake', :access_token => 'access_token').feed!(:message => 'hello', :place => 'place_page_id')
|
106
|
+
post.place.should == GSGraph::Page.new('place_page_id')
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
context 'when place is given as GSGraph::Place' do
|
112
|
+
it 'should have Place' do
|
113
|
+
mock_graph :post, 'matake/feed', 'users/feed/post_with_valid_access_token', :access_token => 'access_token', :params => {
|
114
|
+
:message => 'hello',
|
115
|
+
:place => 'place_page_id'
|
116
|
+
} do
|
117
|
+
place = GSGraph::Place.new('place_page_id')
|
118
|
+
post = GSGraph::User.new('matake', :access_token => 'access_token').feed!(:message => 'hello', :place => place)
|
119
|
+
post.place.should == place
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::FormerParticipants, '#former_participants' do
|
4
|
+
it 'should return former_participants as GSGraph::User' do
|
5
|
+
mock_graph :get, '12345/former_participants', 'thread/former_participants/private', :access_token => 'access_token', :params => {
|
6
|
+
:no_cache => 'true'
|
7
|
+
} do
|
8
|
+
former_participants = GSGraph::Thread.new(12345, :access_token => 'access_token').former_participants(:no_cache => true)
|
9
|
+
former_participants.each do |former_participant|
|
10
|
+
former_participant.should be_instance_of(GSGraph::User)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe 'cached messages' do
|
16
|
+
context 'when cached' do
|
17
|
+
let(:thread) { GSGraph::Thread.new(12345, :access_token => 'access_token', :former_participants => {}) }
|
18
|
+
|
19
|
+
it 'should use cache' do
|
20
|
+
lambda do
|
21
|
+
thread.former_participants
|
22
|
+
end.should_not request_to '12345/former_participants?access_token=access_token'
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'when options are specified' do
|
26
|
+
it 'should not use cache' do
|
27
|
+
lambda do
|
28
|
+
thread.former_participants(:no_cache => true)
|
29
|
+
end.should request_to '12345/former_participants?access_token=access_token&no_cache=true'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'otherwise' do
|
35
|
+
let(:thread) { GSGraph::Thread.new(12345, :access_token => 'access_token') }
|
36
|
+
|
37
|
+
it 'should not use cache' do
|
38
|
+
lambda do
|
39
|
+
thread.former_participants
|
40
|
+
end.should request_to '12345/former_participants?access_token=access_token'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::FriendLists do
|
4
|
+
describe '#friend_lists' do
|
5
|
+
it 'should return an array of GSGraph::FriendList' do
|
6
|
+
mock_graph :get, 'matake/friendlists', 'users/friend_lists/matake', :access_token => 'access_token' do
|
7
|
+
friend_lists = GSGraph::User.new('matake', :access_token => 'access_token').friend_lists
|
8
|
+
friend_lists.each do |friend_list|
|
9
|
+
friend_list.should be_instance_of(GSGraph::FriendList)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#friend_list!' do
|
16
|
+
it 'should return GSGraph::FriendList' do
|
17
|
+
mock_graph :post, 'me/friendlists', 'users/friend_lists/created', :access_token => 'access_token', :params => {
|
18
|
+
:name => 'test'
|
19
|
+
} do
|
20
|
+
friend_list = GSGraph::User.me('access_token').friend_list! :name => 'test'
|
21
|
+
friend_list.should be_instance_of GSGraph::FriendList
|
22
|
+
friend_list.name.should == 'test'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::FriendRequests do
|
4
|
+
it 'should return an Array of FriendRequest' do
|
5
|
+
mock_graph :get, 'me/friendrequests', 'users/friend_requests/sample', :access_token => 'access_token' do
|
6
|
+
friend_requests = GSGraph::User.me('access_token').friend_requests
|
7
|
+
friend_requests.total_count.should == 1
|
8
|
+
friend_requests.unread_count.should == 1
|
9
|
+
friend_requests.updated_time.should == Time.parse('2011-10-31T03:38:55+0000')
|
10
|
+
friend_request = friend_requests.first
|
11
|
+
friend_request.should be_a GSGraph::FriendRequest
|
12
|
+
friend_request.from.should be_a GSGraph::User
|
13
|
+
friend_request.to.should be_a GSGraph::User
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Friends, '#friends' 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, 'arjun/friends', 'users/friends/arjun_public', :status => [401, 'Unauthorized'] do
|
8
|
+
lambda do
|
9
|
+
GSGraph::User.new('arjun').friends
|
10
|
+
end.should raise_exception(GSGraph::Unauthorized)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'when identifier is not me' do
|
16
|
+
it 'should raise GSGraph::Unauthorized' do
|
17
|
+
mock_graph :get, 'arjun/friends', 'users/friends/arjun_private', :access_token => 'access_token', :status => [401, 'Unauthorized'] do
|
18
|
+
lambda do
|
19
|
+
GSGraph::User.new('arjun', :access_token => 'access_token').friends
|
20
|
+
end.should raise_exception(GSGraph::Unauthorized)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'when identifier is me and no access_token is given' do
|
26
|
+
it 'should raise GSGraph::Unauthorized' do
|
27
|
+
mock_graph :get, 'me/friends', 'users/friends/me_public', :status => [401, 'Unauthorized'] do
|
28
|
+
lambda do
|
29
|
+
GSGraph::User.new('me').friends
|
30
|
+
end.should raise_exception(GSGraph::Unauthorized)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'when identifier is me and access_token is given' do
|
36
|
+
it 'should return friends as GSGraph::User' do
|
37
|
+
mock_graph :get, 'me/friends', 'users/friends/me_private', :access_token => 'access_token' do
|
38
|
+
users = GSGraph::User.new('me', :access_token => 'access_token').friends
|
39
|
+
users.first.should == GSGraph::User.new(
|
40
|
+
'6401',
|
41
|
+
:access_token => 'access_token',
|
42
|
+
:name => 'Kirk McMurray'
|
43
|
+
)
|
44
|
+
users.each do |user|
|
45
|
+
user.should be_instance_of(GSGraph::User)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Activities, '#activities' do
|
4
|
+
it 'should return games as GSGraph::Page' do
|
5
|
+
mock_graph :get, 'matake/games', 'users/games/matake_private', :access_token => 'access_token' do
|
6
|
+
games = GSGraph::User.new('matake', :access_token => 'access_token').games
|
7
|
+
games.class.should == GSGraph::Connection
|
8
|
+
games.first.should == GSGraph::Page.new(
|
9
|
+
'101392683235776',
|
10
|
+
:access_token => 'access_token',
|
11
|
+
:name => 'FarmVille Cows',
|
12
|
+
:category => 'Game',
|
13
|
+
:created_time => '2011-01-05T13:37:40+0000'
|
14
|
+
)
|
15
|
+
games.each do |game|
|
16
|
+
game.should be_instance_of(GSGraph::Page)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Groups, '#groups' 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/groups', 'users/groups/matake_public', :status => [401, 'Unauthorized'] do
|
8
|
+
lambda do
|
9
|
+
GSGraph::User.new('matake').groups
|
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 groups as GSGraph::Group' do
|
17
|
+
mock_graph :get, 'matake/groups', 'users/groups/matake_private', :access_token => 'access_token' do
|
18
|
+
groups = GSGraph::User.new('matake', :access_token => 'access_token').groups
|
19
|
+
groups.first.should == GSGraph::Group.new(
|
20
|
+
'115286585902',
|
21
|
+
:access_token => 'access_token',
|
22
|
+
:name => 'iPhone 3G S'
|
23
|
+
)
|
24
|
+
groups.each do |group|
|
25
|
+
group.should be_instance_of(GSGraph::Group)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe GSGraph::Connections::Home, '#home' do
|
5
|
+
context 'when included by GSGraph::User' do
|
6
|
+
context 'when no access_token given' do
|
7
|
+
it 'should raise GSGraph::Exception' do
|
8
|
+
mock_graph :get, 'arjun/home', 'users/home/arjun_public', :status => [400, 'BadRequest'] do
|
9
|
+
lambda do
|
10
|
+
GSGraph::User.new('arjun').home
|
11
|
+
end.should raise_exception(GSGraph::Exception)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'when identifier is not me' do
|
17
|
+
it 'should raise GSGraph::Exception' do
|
18
|
+
mock_graph :get, 'arjun/home', 'users/home/arjun_private', :access_token => 'access_token', :status => [400, 'BadRequest'] do
|
19
|
+
lambda do
|
20
|
+
GSGraph::User.new('arjun', :access_token => 'access_token').home
|
21
|
+
end.should raise_exception(GSGraph::Exception)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'when identifier is me and no access_token is given' do
|
27
|
+
it 'should raise GSGraph::Unauthorized' do
|
28
|
+
mock_graph :get, 'me/home', 'users/home/me_public', :status => [401, 'Unauthorized'] do
|
29
|
+
lambda do
|
30
|
+
GSGraph::User.new('me').home
|
31
|
+
end.should raise_exception(GSGraph::Unauthorized)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'when identifier is me and access_token is given' do
|
37
|
+
it 'should return public posts in the user\'s news feed as GSGraph::Post' do
|
38
|
+
mock_graph :get, 'me/home', 'users/home/me_private', :access_token => 'access_token' do
|
39
|
+
posts = GSGraph::User.new('me', :access_token => 'access_token').home
|
40
|
+
posts.first.should == GSGraph::Post.new(
|
41
|
+
'634033380_112599768777073',
|
42
|
+
:access_token => 'access_token',
|
43
|
+
:from => {
|
44
|
+
:id => '634033380',
|
45
|
+
:name => 'nishikokura hironobu'
|
46
|
+
},
|
47
|
+
:message => "こちらこそありがとうございました!僕はctrl+無変換ですwRT @_eskm: @pandeiro245 こないだの日曜はありがとうございました!面白い内容でした。ちなみにfnrirってCapsLockで起動ですが、英数変換と同じボタンでどうしてます?起動を違うボタンに変更",
|
48
|
+
:icon => 'http://photos-h.ak.fbcdn.net/photos-ak-sf2p/v43/23/2231777543/app_2_2231777543_2528.gif',
|
49
|
+
:created_time => '2010-04-27T13:06:14+0000',
|
50
|
+
:updated_time => '2010-04-27T13:06:14+0000',
|
51
|
+
:privacy => {
|
52
|
+
:value => 'EVERYONE'
|
53
|
+
}
|
54
|
+
)
|
55
|
+
posts.each do |post|
|
56
|
+
post.should be_instance_of(GSGraph::Post)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Inbox, '#inbox' do
|
4
|
+
context 'before message platform transition' do
|
5
|
+
it 'should return threads as GSGraph::Thread::BeforeTransition' do
|
6
|
+
mock_graph :get, 'me/inbox', 'users/inbox/before_transition', :access_token => 'access_token' do
|
7
|
+
threads = GSGraph::User.me('access_token').inbox
|
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,104 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Insights do
|
4
|
+
describe '#insights' do
|
5
|
+
context 'when included by GSGraph::Page' do
|
6
|
+
context 'when no access_token given' do
|
7
|
+
it 'should raise GSGraph::Unauthorized' do
|
8
|
+
mock_graph :get, 'GSGraph/insights', 'pages/insights/GSGraph_public', :status => [401, 'Unauthorized'] do
|
9
|
+
lambda do
|
10
|
+
GSGraph::Page.new('GSGraph').insights
|
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 insights as GSGraph::Insight' do
|
18
|
+
mock_graph :get, 'GSGraph/insights', 'pages/insights/GSGraph_private', :access_token => 'access_token' do
|
19
|
+
insights = GSGraph::Page.new('GSGraph').insights(:access_token => 'access_token')
|
20
|
+
insights.class.should == GSGraph::Connection
|
21
|
+
insights.first.should == GSGraph::Insight.new(
|
22
|
+
'117513961602338/insights/page_fan_adds_unique/day',
|
23
|
+
:access_token => 'access_token',
|
24
|
+
:name => 'page_fan_adds_unique',
|
25
|
+
:description => 'Daily New Likes of your Page (Unique Users)',
|
26
|
+
:period => 'day',
|
27
|
+
:values => [{
|
28
|
+
:value => 1,
|
29
|
+
:end_time => '2010-11-27T08:00:00+0000'
|
30
|
+
}]
|
31
|
+
)
|
32
|
+
insights.each do |insight|
|
33
|
+
insight.should be_instance_of(GSGraph::Insight)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'when metrics is given' do
|
40
|
+
it 'should treat metrics as connection scope' do
|
41
|
+
mock_graph :get, 'GSGraph/insights/page_like_adds', 'pages/insights/page_like_adds/GSGraph_private', :access_token => 'access_token' do
|
42
|
+
insights = GSGraph::Page.new('GSGraph').insights(:access_token => 'access_token', :metrics => :page_like_adds)
|
43
|
+
insights.options.should == {
|
44
|
+
:connection_scope => 'page_like_adds',
|
45
|
+
:access_token => 'access_token'
|
46
|
+
}
|
47
|
+
insights.first.should == GSGraph::Insight.new(
|
48
|
+
'117513961602338/insights/page_like_adds/day',
|
49
|
+
:access_token => 'access_token',
|
50
|
+
:name => 'page_like_adds',
|
51
|
+
:description => 'Daily Likes of your Page\'s content (Total Count)',
|
52
|
+
:period => 'day',
|
53
|
+
:values => [{
|
54
|
+
:value => 0,
|
55
|
+
:end_time => '2010-12-09T08:00:00+0000'
|
56
|
+
}, {
|
57
|
+
:value => 0,
|
58
|
+
:end_time => '2010-12-10T08:00:00+0000'
|
59
|
+
}, {
|
60
|
+
:value => 0,
|
61
|
+
:end_time => '2010-12-11T08:00:00+0000'
|
62
|
+
}]
|
63
|
+
)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'should support period also' do
|
68
|
+
mock_graph :get, 'GSGraph/insights/page_like_adds/day', 'pages/insights/page_like_adds/day/GSGraph_private', :access_token => 'access_token' do
|
69
|
+
insights = GSGraph::Page.new('GSGraph').insights(:access_token => 'access_token', :metrics => :page_like_adds, :period => :day)
|
70
|
+
insights.options.should == {
|
71
|
+
:connection_scope => 'page_like_adds/day',
|
72
|
+
:access_token => 'access_token'
|
73
|
+
}
|
74
|
+
insights.first.should == GSGraph::Insight.new(
|
75
|
+
'117513961602338/insights/page_like_adds/day',
|
76
|
+
:access_token => 'access_token',
|
77
|
+
:name => 'page_like_adds',
|
78
|
+
:description => 'Daily Likes of your Page\'s content (Total Count)',
|
79
|
+
:period => 'day',
|
80
|
+
:values => [{
|
81
|
+
:value => 1,
|
82
|
+
:end_time => '2010-12-09T08:00:00+0000'
|
83
|
+
}, {
|
84
|
+
:value => 1,
|
85
|
+
:end_time => '2010-12-10T08:00:00+0000'
|
86
|
+
}, {
|
87
|
+
:value => 1,
|
88
|
+
:end_time => '2010-12-11T08:00:00+0000'
|
89
|
+
}]
|
90
|
+
)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'should used for pagination' do
|
95
|
+
mock_graph :get, 'GSGraph/insights/page_like_adds/day', 'pages/insights/page_like_adds/day/GSGraph_private', :access_token => 'access_token' do
|
96
|
+
insights = GSGraph::Page.new('GSGraph').insights(:access_token => 'access_token', :metrics => :page_like_adds, :period => :day)
|
97
|
+
expect { insights.next }.to request_to 'GSGraph/insights/page_like_adds/day?access_token=access_token&since=1292065709&until=1292324909'
|
98
|
+
expect { insights.previous }.to request_to 'GSGraph/insights/page_like_adds/day?access_token=access_token&since=1291547309&until=1291806509'
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|