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,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::OpenGraph::ApplicationContext do
|
4
|
+
let :application_with_namespace do
|
5
|
+
GSGraph::Application.new('app_id', :namespace => 'fbgraph')
|
6
|
+
end
|
7
|
+
let :application_without_namespace do
|
8
|
+
GSGraph::Application.new('app_id')
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '#og_action' do
|
12
|
+
context 'with namespace' do
|
13
|
+
it 'should return "APP_NAMESPACE:ACTION_NAME" without fetching application info' do
|
14
|
+
application_with_namespace.og_action('action_name').should == 'fbgraph:action_name'
|
15
|
+
application_with_namespace.og_action(:action_name).should == 'fbgraph:action_name'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'without namespace' do
|
20
|
+
it 'should return "APP_NAMESPACE:ACTION_NAME" with fetching application info' do
|
21
|
+
mock_graph :get, 'app_id', 'applications/fbgraphsample' do
|
22
|
+
application_without_namespace.og_action('action_name').should == 'fbgraphsample:action_name'
|
23
|
+
application_without_namespace.og_action(:action_name).should == 'fbgraphsample:action_name'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::OpenGraph::Object do
|
4
|
+
subject do
|
5
|
+
GSGraph::OpenGraph::Object.new attributes[:id], attributes
|
6
|
+
end
|
7
|
+
let :attributes do
|
8
|
+
MultiJson.load(json).with_indifferent_access
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'with play action' do
|
12
|
+
let :json do
|
13
|
+
<<-JSON
|
14
|
+
{
|
15
|
+
"url": "http:\/\/samples.ogp.me\/163382137069945",
|
16
|
+
"type": "game",
|
17
|
+
"title": "Sample Game",
|
18
|
+
"image": [{
|
19
|
+
"url": "http:\/\/static.ak.fbcdn.net\/images\/devsite\/attachment_blank.png"
|
20
|
+
}],
|
21
|
+
"description": "",
|
22
|
+
"updated_time": "2011-10-10T08:28:48+0000",
|
23
|
+
"id": "10150267719331290",
|
24
|
+
"application": {
|
25
|
+
"id": "115190258555800",
|
26
|
+
"name": "Open Graph",
|
27
|
+
"url": "http:\/\/www.gamestamper.com\/apps\/application.php?id=115190258555800"
|
28
|
+
}
|
29
|
+
}
|
30
|
+
JSON
|
31
|
+
end
|
32
|
+
its(:url) { should == 'http://samples.ogp.me/163382137069945' }
|
33
|
+
its(:type) { should == 'game' }
|
34
|
+
its(:title) { should == 'Sample Game' }
|
35
|
+
its(:image) { should == 'http://static.ak.fbcdn.net/images/devsite/attachment_blank.png' }
|
36
|
+
its(:images) { should == ['http://static.ak.fbcdn.net/images/devsite/attachment_blank.png'] }
|
37
|
+
its(:description) { should == '' }
|
38
|
+
its(:updated_time) { should == Time.parse('2011-10-10T08:28:48+0000') }
|
39
|
+
its(:application) do
|
40
|
+
should == GSGraph::Application.new(attributes[:application][:id], attributes[:application])
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'with custom action' do
|
45
|
+
let :json do
|
46
|
+
<<-JSON
|
47
|
+
{
|
48
|
+
"url": "http:\/\/samples.ogp.me\/264755040233381",
|
49
|
+
"type": "fbgraphsample:custom_object",
|
50
|
+
"title": "Custom Object",
|
51
|
+
"image": [{
|
52
|
+
"url": "https:\/\/s-static.ak.fbcdn.net\/images\/devsite\/attachment_blank.png"
|
53
|
+
}],
|
54
|
+
"description": "Custom Object for GSGraph testing",
|
55
|
+
"updated_time": "2011-10-26T02:12:08+0000",
|
56
|
+
"id": "10150362170052970",
|
57
|
+
"application": {
|
58
|
+
"id": "134145643294322",
|
59
|
+
"name": "gem sample",
|
60
|
+
"url": "http:\/\/www.gamestamper.com\/apps\/application.php?id=134145643294322"
|
61
|
+
}
|
62
|
+
}
|
63
|
+
JSON
|
64
|
+
end
|
65
|
+
its(:url) { should == 'http://samples.ogp.me/264755040233381' }
|
66
|
+
its(:type) { should == 'fbgraphsample:custom_object' }
|
67
|
+
its(:title) { should == 'Custom Object' }
|
68
|
+
its(:image) { should == 'https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png' }
|
69
|
+
its(:images) { should == ['https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png'] }
|
70
|
+
its(:description) { should == 'Custom Object for GSGraph testing' }
|
71
|
+
its(:updated_time) { should == Time.parse('2011-10-26T02:12:08+0000') }
|
72
|
+
its(:application) do
|
73
|
+
should == GSGraph::Application.new(attributes[:application][:id], attributes[:application])
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::OpenGraph::UserContext do
|
4
|
+
let(:me) { GSGraph::User.me('access_token') }
|
5
|
+
let(:app) { GSGraph::Application.new('app_id', :namespace => 'fbgraphsample') }
|
6
|
+
|
7
|
+
describe '#og_actions' do
|
8
|
+
it 'should return an array of GSGraph::OpenGraph::Action' do
|
9
|
+
mock_graph :get, 'me/fbgraphsample:custom_action', 'open_graph/custom_actions', :access_token => 'access_token' do
|
10
|
+
actions = me.og_actions(
|
11
|
+
app.og_action('custom_action')
|
12
|
+
)
|
13
|
+
actions.each do |action|
|
14
|
+
action.should be_instance_of GSGraph::OpenGraph::Action
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#og_action!' do
|
21
|
+
it 'should return GSGraph::OpenGraph::Action' do
|
22
|
+
mock_graph :post, 'me/fbgraphsample:custom_action', 'open_graph/created', :access_token => 'access_token', :params => {
|
23
|
+
:custom_object => 'http://samples.ogp.me/264755040233381'
|
24
|
+
} do
|
25
|
+
action = me.og_action!(
|
26
|
+
app.og_action(:custom_action),
|
27
|
+
:custom_object => 'http://samples.ogp.me/264755040233381'
|
28
|
+
)
|
29
|
+
action.should be_instance_of GSGraph::OpenGraph::Action
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Order do
|
4
|
+
subject { order }
|
5
|
+
let(:order) { GSGraph::Order.new attributes[:id], attributes }
|
6
|
+
let :attributes do
|
7
|
+
{
|
8
|
+
:id => '9005539514450',
|
9
|
+
:from => {
|
10
|
+
:name => 'Nov Matake',
|
11
|
+
:id => '579612276'
|
12
|
+
},
|
13
|
+
:to => {
|
14
|
+
:name => 'Nov Matake',
|
15
|
+
:id => '579612276'
|
16
|
+
},
|
17
|
+
:amount => 2,
|
18
|
+
:status => 'settled',
|
19
|
+
:application => {
|
20
|
+
:name => 'gem sample',
|
21
|
+
:id => '134145643294322'
|
22
|
+
},
|
23
|
+
:created_time => '2011-09-01T04:34:35+0000',
|
24
|
+
:updated_time => '2011-09-01T04:34:38+0000'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
its(:identifier) { should == '9005539514450' }
|
29
|
+
its(:from) { should == GSGraph::User.new('579612276', :name => 'Nov Matake') }
|
30
|
+
its(:to) { should == GSGraph::User.new('579612276', :name => 'Nov Matake') }
|
31
|
+
its(:application) { should == GSGraph::Application.new('134145643294322', :name => 'gem sample') }
|
32
|
+
its(:amount) { should == 2 }
|
33
|
+
its(:status) { should == 'settled' }
|
34
|
+
its(:created_time) { should == Time.parse('2011-09-01T04:34:35+0000') }
|
35
|
+
its(:updated_time) { should == Time.parse('2011-09-01T04:34:38+0000') }
|
36
|
+
|
37
|
+
describe '#settle!' do
|
38
|
+
it do
|
39
|
+
expect { order.settle! }.to request_to order.identifier, :post
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'I have never succeeded this call yet'
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '#refund!' do
|
46
|
+
it do
|
47
|
+
expect { order.refund! }.to request_to order.identifier, :post
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should return true' do
|
51
|
+
mock_graph :post, order.identifier, 'true', :access_token => 'access_token', :params => {
|
52
|
+
:status => 'refunded'
|
53
|
+
} do
|
54
|
+
order.refunded!(:access_token => 'access_token').should be_true
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe '#cancel!' do
|
60
|
+
it do
|
61
|
+
expect { order.cancel! }.to request_to order.identifier, :post
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'I have never succeeded this call yet'
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe GSGraph::Page do
|
5
|
+
context 'for local_business category' do
|
6
|
+
let :page do
|
7
|
+
mock_graph :get, 'local_business', 'pages/categories/local_business' do
|
8
|
+
GSGraph::Page.new('local_business').fetch
|
9
|
+
end
|
10
|
+
end
|
11
|
+
subject { page }
|
12
|
+
|
13
|
+
[
|
14
|
+
:attire,
|
15
|
+
:culinary_team,
|
16
|
+
:general_manager,
|
17
|
+
:link,
|
18
|
+
:phone,
|
19
|
+
:price_range,
|
20
|
+
:public_transit
|
21
|
+
].each do |key|
|
22
|
+
its(key) { should be_instance_of String }
|
23
|
+
end
|
24
|
+
|
25
|
+
[
|
26
|
+
:parking,
|
27
|
+
:payment_options,
|
28
|
+
:restaurant_services,
|
29
|
+
:restaurant_specialties
|
30
|
+
].each do |key|
|
31
|
+
its(key) { should be_instance_of Array }
|
32
|
+
describe key do
|
33
|
+
it 'should be an Array of Symbol' do
|
34
|
+
page.send(key).should_not be_blank
|
35
|
+
page.send(key).all? do |value|
|
36
|
+
value.should be_instance_of Symbol
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
its(:hours) { should be_instance_of Hash }
|
43
|
+
its(:hours) do
|
44
|
+
should == {
|
45
|
+
:mon => [{
|
46
|
+
:open => Time.parse('1970-01-01 10:00:00 UTC'),
|
47
|
+
:close => Time.parse('1970-01-01 20:00:00 UTC')
|
48
|
+
}],
|
49
|
+
:tue=>[{
|
50
|
+
:open => Time.parse('1970-01-01 10:00:00 UTC'),
|
51
|
+
:close => Time.parse('1970-01-01 20:00:00 UTC')
|
52
|
+
}]
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
its(:location) do
|
57
|
+
should == GSGraph::Venue.new(
|
58
|
+
:street => '新田辺',
|
59
|
+
:city => 'Kyoto',
|
60
|
+
:country => 'Japan',
|
61
|
+
:zip => '513001'
|
62
|
+
)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context 'for local_business category with hours as Fixnums' do
|
67
|
+
let :page do
|
68
|
+
mock_graph :get, 'local_business', 'pages/categories/local_business_fixnum' do
|
69
|
+
GSGraph::Page.new('local_business').fetch
|
70
|
+
end
|
71
|
+
end
|
72
|
+
subject { page }
|
73
|
+
|
74
|
+
its(:hours) { should be_instance_of Hash }
|
75
|
+
its(:hours) do
|
76
|
+
should == {
|
77
|
+
:mon => [{
|
78
|
+
:open => Time.parse('1970-01-01 10:00:00 UTC'),
|
79
|
+
:close => Time.parse('1970-01-01 20:00:00 UTC')
|
80
|
+
}],
|
81
|
+
:tue=>[{
|
82
|
+
:open => Time.parse('1970-01-01 10:00:00 UTC'),
|
83
|
+
:close => Time.parse('1970-01-01 20:00:00 UTC')
|
84
|
+
}]
|
85
|
+
}
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Page do
|
4
|
+
context 'for people category' do
|
5
|
+
let :page do
|
6
|
+
mock_graph :get, 'movie', 'pages/categories/movie' do
|
7
|
+
GSGraph::Page.new('movie').fetch
|
8
|
+
end
|
9
|
+
end
|
10
|
+
subject { page }
|
11
|
+
|
12
|
+
[
|
13
|
+
:directed_by,
|
14
|
+
:genre,
|
15
|
+
:plot_outline,
|
16
|
+
:produced_by,
|
17
|
+
:screenplay_by,
|
18
|
+
:starring,
|
19
|
+
:studio,
|
20
|
+
:written_by
|
21
|
+
].each do |key|
|
22
|
+
its(key) { should be_instance_of String }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Page do
|
4
|
+
context 'for music category' do
|
5
|
+
let :page do
|
6
|
+
mock_graph :get, 'music', 'pages/categories/music' do
|
7
|
+
GSGraph::Page.new('music').fetch
|
8
|
+
end
|
9
|
+
end
|
10
|
+
subject { page }
|
11
|
+
|
12
|
+
[
|
13
|
+
:artists_we_like,
|
14
|
+
:band_interests,
|
15
|
+
:band_members,
|
16
|
+
:booking_agent,
|
17
|
+
:current_location,
|
18
|
+
:influences,
|
19
|
+
:press_contact,
|
20
|
+
:record_label
|
21
|
+
].each do |key|
|
22
|
+
its(key) { should be_instance_of String }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Page do
|
4
|
+
context 'for person category' do
|
5
|
+
let :page do
|
6
|
+
mock_graph :get, 'person', 'pages/categories/person'do
|
7
|
+
GSGraph::Page.new('person').fetch
|
8
|
+
end
|
9
|
+
end
|
10
|
+
subject { page }
|
11
|
+
|
12
|
+
[
|
13
|
+
:affiliation,
|
14
|
+
:bio,
|
15
|
+
:personal_info,
|
16
|
+
:personal_interests
|
17
|
+
].each do |key|
|
18
|
+
its(key) { should be_instance_of String }
|
19
|
+
end
|
20
|
+
|
21
|
+
its(:birthday) { should == Date.new(1980, 1, 1) }
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Page do
|
4
|
+
context 'for product category' do
|
5
|
+
let :page do
|
6
|
+
mock_graph :get, 'product', 'pages/categories/product' do
|
7
|
+
GSGraph::Page.new('product').fetch
|
8
|
+
end
|
9
|
+
end
|
10
|
+
subject { page }
|
11
|
+
|
12
|
+
[
|
13
|
+
:awards,
|
14
|
+
:features,
|
15
|
+
:link,
|
16
|
+
:mission,
|
17
|
+
:mpg,
|
18
|
+
:picture,
|
19
|
+
:products
|
20
|
+
].each do |key|
|
21
|
+
its(key) { should be_instance_of String }
|
22
|
+
end
|
23
|
+
|
24
|
+
its(:built) { should == 'Since 1980' }
|
25
|
+
its(:founded) { should == '1980' }
|
26
|
+
its(:release_date) { should == Date.parse('Wed, 01 Oct 1980') }
|
27
|
+
|
28
|
+
context 'when valid date format' do
|
29
|
+
subject do
|
30
|
+
GSGraph::Page.new('12345', :built => 'May 1980', :founded => 'Oct 1980')
|
31
|
+
end
|
32
|
+
its(:built) { should == Date.parse('Thu, 01 May 1980') }
|
33
|
+
its(:founded) { should == Date.parse('Wed, 01 Oct 1980') }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Page do
|
4
|
+
let(:attributes) do
|
5
|
+
{
|
6
|
+
:id => '19292868552',
|
7
|
+
:category => 'Technology',
|
8
|
+
:likes => 578246,
|
9
|
+
:name => 'Facebook Platform',
|
10
|
+
:username => 'platform',
|
11
|
+
:talking_about_count => 3232
|
12
|
+
}
|
13
|
+
end
|
14
|
+
subject do
|
15
|
+
GSGraph::Page.new(attributes[:id], attributes)
|
16
|
+
end
|
17
|
+
|
18
|
+
its(:identifier) { should == attributes[:id] }
|
19
|
+
its(:category) { should == attributes[:category] }
|
20
|
+
its(:like_count) { should == attributes[:likes] }
|
21
|
+
its(:name) { should == attributes[:name] }
|
22
|
+
its(:username) { should == attributes[:username] }
|
23
|
+
its(:talking_about_count) { should == attributes[:talking_about_count] }
|
24
|
+
|
25
|
+
describe 'link' do
|
26
|
+
context 'when username exists' do
|
27
|
+
subject { GSGraph::Page.new(attributes[:id], attributes) }
|
28
|
+
its(:link) { should == "https://www.gamestamper.com/#{attributes[:username]}" }
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'otherwise' do
|
32
|
+
subject { GSGraph::Page.new(attributes[:id]) }
|
33
|
+
its(:link) { should == "https://www.gamestamper.com/#{attributes[:id]}" }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '.fetch' do
|
38
|
+
subject do
|
39
|
+
mock_graph :get, 'platform', 'pages/platform_public' do
|
40
|
+
GSGraph::Page.fetch('platform')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
its(:identifier) { should == '19292868552' }
|
44
|
+
its(:name) { should == 'Facebook Developers' }
|
45
|
+
its(:category) { should == 'Product/service' }
|
46
|
+
its(:like_count) { should == 237499 }
|
47
|
+
its(:talking_about_count) { should == 17811 }
|
48
|
+
its(:cover) { should be_instance_of GSGraph::Cover }
|
49
|
+
its(:is_published) { should be_true }
|
50
|
+
|
51
|
+
context 'when access_token field fetched' do
|
52
|
+
subject do
|
53
|
+
mock_graph :get, 'my_page', 'pages/with_token', :access_token => 'user_token', :params => {
|
54
|
+
:fields => 'access_token'
|
55
|
+
} do
|
56
|
+
GSGraph::Page.fetch('my_page', :fields => :access_token, :access_token => 'user_token')
|
57
|
+
end
|
58
|
+
end
|
59
|
+
its(:access_token) { should == 'page_token' }
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe '#get_access_token' do
|
64
|
+
it 'should specify fields=access_token' do
|
65
|
+
expect do
|
66
|
+
GSGraph::Page.new('GSGraph').page_access_token
|
67
|
+
end.to request_to 'GSGraph?fields=access_token', :GET
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'should return Rack::OAuth2::AccessToken::Legacy' do
|
71
|
+
mock_graph :get, 'page_id', 'pages/with_token', :access_token => 'user_token', :params => {
|
72
|
+
:fields => 'access_token'
|
73
|
+
} do
|
74
|
+
page = GSGraph::Page.new('page_id', :access_token => 'user_token')
|
75
|
+
page_token = page.get_access_token
|
76
|
+
page_token.should be_instance_of Rack::OAuth2::AccessToken::Legacy
|
77
|
+
page.access_token.should == page_token
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|