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,71 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::AdConnectionObject, '.new' do
|
4
|
+
it 'should setup all supported attributes' do
|
5
|
+
attributes = {
|
6
|
+
:id => 354545238888,
|
7
|
+
:name => "MyPage",
|
8
|
+
:url => "http://www.gamestamper.com/MyPage",
|
9
|
+
:type => 1,
|
10
|
+
:tabs =>
|
11
|
+
{
|
12
|
+
"http://www.gamestamper.com/MyPage?sk=wall" => "Wall",
|
13
|
+
"http://www.gamestamper.com/MyPage?sk=info" => "Info",
|
14
|
+
"http://www.gamestamper.com/MyPage?sk=friendactivity" => "Friend Activity",
|
15
|
+
"http://www.gamestamper.com/MyPage?sk=photos" => "Photos",
|
16
|
+
"http://www.gamestamper.com/MyPage?sk=app_2373072222" => "Discussions"
|
17
|
+
},
|
18
|
+
:picture => "http://profile.ak.fbcdn.net/hprofile-ak-snc4/41591_354545238178_3195000_s.jpg"
|
19
|
+
}
|
20
|
+
ad_connection = GSGraph::AdConnectionObject.new(attributes.delete(:id), attributes)
|
21
|
+
ad_connection.identifier.should == 354545238888
|
22
|
+
ad_connection.name.should == "MyPage"
|
23
|
+
ad_connection.url.should == "http://www.gamestamper.com/MyPage"
|
24
|
+
ad_connection.type.should == 1
|
25
|
+
ad_connection.should be_page
|
26
|
+
ad_connection.object.should be_instance_of(GSGraph::Page)
|
27
|
+
ad_connection.object.identifier.should == 354545238888
|
28
|
+
ad_connection.picture.should == "http://profile.ak.fbcdn.net/hprofile-ak-snc4/41591_354545238178_3195000_s.jpg"
|
29
|
+
ad_connection.tabs.should be_instance_of(Hash)
|
30
|
+
ad_connection.tabs["http://www.gamestamper.com/MyPage?sk=wall"].should == "Wall"
|
31
|
+
|
32
|
+
application_attributes = {
|
33
|
+
:id => 354545238889,
|
34
|
+
:is_game => false,
|
35
|
+
:name => "MyApp",
|
36
|
+
:og_actions => [{
|
37
|
+
:connected_objects => ["planes"],
|
38
|
+
:display_name => "Yaw",
|
39
|
+
:name => "app_name_space:yaw",
|
40
|
+
:properties => []
|
41
|
+
}],
|
42
|
+
:og_namespace => "app_name_space",
|
43
|
+
:og_objects => [{
|
44
|
+
:display_name => "Plane",
|
45
|
+
:name => "planes",
|
46
|
+
:properties => []
|
47
|
+
}],
|
48
|
+
:picture => "https://fbcdn-profile-a.akamaihd.net/static-ak/rsrc.php/v1/y0/r/XsEg9L6Ie5_.jpg",
|
49
|
+
:supported_platforms => [2],
|
50
|
+
:tabs => [],
|
51
|
+
:type => 2,
|
52
|
+
:url => "http://apps.gamestamper.com/test_app/"
|
53
|
+
}
|
54
|
+
|
55
|
+
ad_connection = GSGraph::AdConnectionObject.new(application_attributes.delete(:id), application_attributes)
|
56
|
+
ad_connection.identifier.should == 354545238889
|
57
|
+
ad_connection.is_game.should == false
|
58
|
+
ad_connection.name.should == "MyApp"
|
59
|
+
ad_connection.og_actions.should be_instance_of(Array)
|
60
|
+
ad_connection.og_actions.first.should be_instance_of(Hash)
|
61
|
+
ad_connection.og_namespace.should == "app_name_space"
|
62
|
+
ad_connection.og_objects.should be_instance_of(Array)
|
63
|
+
ad_connection.og_objects.first.should be_instance_of(Hash)
|
64
|
+
ad_connection.object.identifier.should == 354545238889
|
65
|
+
ad_connection.picture.should == "https://fbcdn-profile-a.akamaihd.net/static-ak/rsrc.php/v1/y0/r/XsEg9L6Ie5_.jpg"
|
66
|
+
ad_connection.supported_platforms.should == [2]
|
67
|
+
ad_connection.tabs.should == []
|
68
|
+
ad_connection.type.should == 2
|
69
|
+
ad_connection.url.should == "http://apps.gamestamper.com/test_app/"
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::AdCreative, '.new' do
|
4
|
+
|
5
|
+
it 'should setup all supported attributes' do
|
6
|
+
attributes = {
|
7
|
+
:id => '6003590469668',
|
8
|
+
:view_tag => "",
|
9
|
+
:alt_view_tags => [],
|
10
|
+
:creative_id => "6003590469668",
|
11
|
+
:type => 1,
|
12
|
+
:title => "Some Creative",
|
13
|
+
:body => "The Body",
|
14
|
+
:image_hash => "4c34b48cdcbf5dd3055acb717343a9d6",
|
15
|
+
:link_url => "http://www.google.com/",
|
16
|
+
:name => "Creative Name",
|
17
|
+
:run_status => 1,
|
18
|
+
:preview_url => "http://www.gamestamper.com/ads/api/creative_preview.php?cid=6003590469668",
|
19
|
+
:count_current_adgroups => 1,
|
20
|
+
:object_id => 12345,
|
21
|
+
:story_id => 54321,
|
22
|
+
:image_url => "https://www.google.com/image.png",
|
23
|
+
:url_tags => "url=tags",
|
24
|
+
:related_fan_page => 5799040003,
|
25
|
+
:auto_update => 1,
|
26
|
+
:action_spec => '{"action.type":["flightsim:fly"], "application":[174829001234]}',
|
27
|
+
:query_templates => ["6"]
|
28
|
+
}
|
29
|
+
ad_creative = GSGraph::AdCreative.new(attributes.delete(:id), attributes)
|
30
|
+
ad_creative.identifier.should == "6003590469668"
|
31
|
+
ad_creative.view_tag.should == ""
|
32
|
+
ad_creative.alt_view_tags.should == []
|
33
|
+
ad_creative.creative_id.should == "6003590469668"
|
34
|
+
ad_creative.type.should == 1
|
35
|
+
ad_creative.title.should == "Some Creative"
|
36
|
+
ad_creative.body.should == "The Body"
|
37
|
+
ad_creative.image_hash.should == "4c34b48cdcbf5dd3055acb717343a9d6"
|
38
|
+
ad_creative.link_url.should == "http://www.google.com/"
|
39
|
+
ad_creative.name.should == "Creative Name"
|
40
|
+
ad_creative.run_status.should == 1
|
41
|
+
ad_creative.preview_url.should == "http://www.gamestamper.com/ads/api/creative_preview.php?cid=6003590469668"
|
42
|
+
ad_creative.count_current_adgroups.should == 1
|
43
|
+
ad_creative.facebook_object_id.should == 12345
|
44
|
+
ad_creative.image_url.should == "https://www.google.com/image.png"
|
45
|
+
ad_creative.url_tags.should == "url=tags"
|
46
|
+
ad_creative.related_fan_page.should == 5799040003
|
47
|
+
ad_creative.auto_update.should == 1
|
48
|
+
ad_creative.action_spec.should == '{"action.type":["flightsim:fly"], "application":[174829001234]}'
|
49
|
+
ad_creative.query_templates.should == ["6"]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
describe GSGraph::AdCreative, '.fetch' do
|
55
|
+
it 'should get the ad creative' do
|
56
|
+
mock_graph :get, '6003590469668', 'ad_creatives/test_ad_creative', :access_token => 'access_token' do
|
57
|
+
ad_creative = GSGraph::AdCreative.fetch('6003590469668', :access_token => 'access_token')
|
58
|
+
ad_creative.identifier.should == "6003590469668"
|
59
|
+
ad_creative.view_tag.should == ""
|
60
|
+
ad_creative.alt_view_tags.should == []
|
61
|
+
ad_creative.creative_id.should == "6003590469668"
|
62
|
+
ad_creative.type.should == 1
|
63
|
+
ad_creative.title.should == "Some Creative"
|
64
|
+
ad_creative.body.should == "The Body"
|
65
|
+
ad_creative.image_hash.should == "4c34b48cdcbf5dd3055acb717343a9d6"
|
66
|
+
ad_creative.link_url.should == "http://www.google.com/"
|
67
|
+
ad_creative.name.should == "Creative Name"
|
68
|
+
ad_creative.run_status.should == 1
|
69
|
+
ad_creative.preview_url.should == "http://www.gamestamper.com/ads/api/creative_preview.php?cid=6003590469668"
|
70
|
+
ad_creative.count_current_adgroups.should == 1
|
71
|
+
ad_creative.image_url.should == "https://www.google.com/image.png"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe GSGraph::AdCreative, '.update' do
|
77
|
+
it "should return true from facebook" do
|
78
|
+
mock_graph :post, '6003590469668', 'true', :body => "New Body" do
|
79
|
+
attributes = {
|
80
|
+
:id => '6003590469668',
|
81
|
+
:body => "The Body"
|
82
|
+
}
|
83
|
+
ad_creative = GSGraph::AdCreative.new(attributes.delete(:id), attributes)
|
84
|
+
ad_creative.update(:body => "New Body").should be_true
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::AdGroup, '.new' do
|
4
|
+
attr_accessor :ad_id, :campaign_id, :name, :adgroup_status, :bid_type, :max_bid, :adgroup_id, :end_time, :start_time, :updated_time
|
5
|
+
it 'should setup all supported attributes' do
|
6
|
+
attributes = {
|
7
|
+
:id => '6003590469668',
|
8
|
+
:ad_id => 6003590469668,
|
9
|
+
:campaign_id => 6003590468467,
|
10
|
+
:name => 'Ad Group 1',
|
11
|
+
:adgroup_status => 1,
|
12
|
+
:bid_type => 1,
|
13
|
+
:max_bid => 1000,
|
14
|
+
:adgroup_id => 6003590469668,
|
15
|
+
:end_time => "2011-09-10T00:00:00+00:00",
|
16
|
+
:start_time => "2011-09-01T12:00:00-07:00",
|
17
|
+
:updated_time => "2011-09-04T16:00:00+00:00",
|
18
|
+
:view_tags => ["http://example.com"]
|
19
|
+
}
|
20
|
+
ad_group = GSGraph::AdGroup.new(attributes.delete(:id), attributes)
|
21
|
+
ad_group.identifier.should == "6003590469668"
|
22
|
+
ad_group.ad_id.should == 6003590469668
|
23
|
+
ad_group.campaign_id.should == 6003590468467
|
24
|
+
ad_group.name.should == "Ad Group 1"
|
25
|
+
ad_group.adgroup_status.should == 1
|
26
|
+
ad_group.bid_type.should == 1
|
27
|
+
ad_group.max_bid.should == 1000
|
28
|
+
ad_group.adgroup_id.should == 6003590469668
|
29
|
+
ad_group.end_time.should == Time.parse("2011-09-10T00:00:00+00:00")
|
30
|
+
ad_group.start_time.should == Time.parse("2011-09-01T12:00:00-07:00")
|
31
|
+
ad_group.updated_time.should == Time.parse("2011-09-04T16:00:00+00:00")
|
32
|
+
ad_group.view_tags.should == ["http://example.com"]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
describe GSGraph::AdGroup, '.fetch' do
|
38
|
+
it 'should get the ad group' do
|
39
|
+
mock_graph :get, '6003590469668', 'ad_groups/test_ad_group', :access_token => 'access_token' do
|
40
|
+
ad_group = GSGraph::AdGroup.fetch('6003590469668', :access_token => 'access_token')
|
41
|
+
|
42
|
+
ad_group.identifier.should == "6003590469668"
|
43
|
+
ad_group.ad_id.should == 6003590469668
|
44
|
+
ad_group.campaign_id.should == 6003590468467
|
45
|
+
ad_group.name.should == "Ad Group 1"
|
46
|
+
ad_group.adgroup_status.should == 1
|
47
|
+
ad_group.bid_type.should == 1
|
48
|
+
ad_group.max_bid.should == 1000
|
49
|
+
ad_group.adgroup_id.should == 6003590469668
|
50
|
+
ad_group.end_time.should == Time.parse("2011-09-10T00:00:00+00:00")
|
51
|
+
ad_group.start_time.should == Time.parse("2011-09-01T12:00:00-07:00")
|
52
|
+
ad_group.updated_time.should == Time.parse("2011-09-04T16:00:00+00:00")
|
53
|
+
ad_group.view_tags.should == ["http://example.com"]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe GSGraph::AdGroup, '.update' do
|
59
|
+
context "without the redownload parameter" do
|
60
|
+
it "should return true from facebook" do
|
61
|
+
mock_graph :post, '6003590469668', 'true', :max_bid => 500 do
|
62
|
+
attributes = {
|
63
|
+
:id => '6003590469668',
|
64
|
+
:max_bid => 1000
|
65
|
+
}
|
66
|
+
ad_group = GSGraph::AdGroup.new(attributes.delete(:id), attributes)
|
67
|
+
ad_group.update(:max_bid => 500).should be_true
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
context "with the redownload parameter" do
|
74
|
+
it "should update the AdGroup with the new data from facebook" do
|
75
|
+
mock_graph :post, "6004165047777", 'ad_groups/test_ad_group_update_with_redownload', :max_bid => 500, :redownload => true do
|
76
|
+
attributes = {
|
77
|
+
:id => "6004165047777",
|
78
|
+
:adgroup_id => "6004165047777",
|
79
|
+
:adgroup_status => 1,
|
80
|
+
:max_bid => 1000
|
81
|
+
}
|
82
|
+
|
83
|
+
ad_group = GSGraph::AdGroup.new(attributes.delete(:id), attributes)
|
84
|
+
ad_group.adgroup_status.should == 1
|
85
|
+
|
86
|
+
ad_group.update(:max_bid => 500, :redownload => true)
|
87
|
+
|
88
|
+
ad_group.max_bid.should == 500
|
89
|
+
|
90
|
+
# Our test assumes that adgroup_status has changed on Facebook's side and is passed back different
|
91
|
+
ad_group.adgroup_status.should == 4
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::AdKeyword, '.search' do
|
4
|
+
it 'should perform a search' do
|
5
|
+
mock_graph :get, 'search', 'ad_keywords/buffy_search', :params => {:q => 'buffy', :type => 'adkeyword'} do
|
6
|
+
ad_keywords = GSGraph::AdKeyword.search('buffy')
|
7
|
+
|
8
|
+
ad_keywords.size.should == 8
|
9
|
+
ad_keywords.each {|kw| kw.should be_instance_of(GSGraph::AdKeyword)}
|
10
|
+
ad_keywords.first.should == GSGraph::AdKeyword.new(
|
11
|
+
6003357305127,
|
12
|
+
:name => "#Buffy the Vampire Slayer (TV series)",
|
13
|
+
:description => "Audience: 1,300,000"
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe GSGraph::AdKeyword, '.topic_keyword?' do
|
20
|
+
it 'should be true for topic keywords' do
|
21
|
+
GSGraph::AdKeyword.new(12345, {:name => "#Topics Have Hashes", :description => "Audience: 1,000"}).topic_keyword?.should be_true
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should be false for non-topic keywords" do
|
25
|
+
GSGraph::AdKeyword.new(12345, {:name => "No Hash Here"}).topic_keyword?.should be_false
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::AdKeywordSuggestion, '.search' do
|
4
|
+
it 'should perform a search' do
|
5
|
+
mock_graph :get, 'search', 'ad_keyword_suggestions/buffy_suggestions', :params => {:keyword_list => 'buffy+the+vampire+slayer', :type => 'adkeywordsuggestion'} do
|
6
|
+
ad_keywords = GSGraph::AdKeywordSuggestion.search('buffy+the+vampire+slayer')
|
7
|
+
|
8
|
+
ad_keywords.size.should == 8
|
9
|
+
ad_keywords.each {|kw| kw.should be_instance_of(GSGraph::AdKeywordSuggestion)}
|
10
|
+
ad_keywords.first.should == GSGraph::AdKeywordSuggestion.new(
|
11
|
+
6003134100700,
|
12
|
+
:name => "#Angel (TV series)",
|
13
|
+
:description => "Audience: 675,000"
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::AdKeywordValid, '.search' do
|
4
|
+
it 'should perform a search' do
|
5
|
+
mock_graph :get, 'search', 'ad_keyword_valids/tige_search', :params => {:keyword_list => 'tige', :type => 'adkeywordvalid'} do
|
6
|
+
valid_results = GSGraph::AdKeywordValid.search('tige')
|
7
|
+
|
8
|
+
valid_results.size.should == 1
|
9
|
+
valid_results.first.should be_instance_of(GSGraph::AdKeywordValid)
|
10
|
+
valid_results.first.should_not be_valid
|
11
|
+
valid_results.first.name.should == "tige"
|
12
|
+
|
13
|
+
valid_results.first.suggestions.size.should == 1
|
14
|
+
valid_results.first.suggestions.first.should be_instance_of(GSGraph::AdKeyword)
|
15
|
+
valid_results.first.suggestions.first.name.should == "#Tigerstyle"
|
16
|
+
valid_results.first.suggestions.first.should be_topic_keyword
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::AdUser do
|
4
|
+
subject { ad_user }
|
5
|
+
let(:ad_user) { GSGraph::AdUser.new(attributes[:uid], attributes) }
|
6
|
+
let(:role) { GSGraph::AdUser::ROLES[:admin] }
|
7
|
+
let(:permissions) { [1,3,4,7] }
|
8
|
+
let :attributes do
|
9
|
+
{
|
10
|
+
:uid => '123456',
|
11
|
+
:permissions => permissions,
|
12
|
+
:role => role
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should setup all supported attributes' do
|
17
|
+
ad_user.identifier.should == "123456"
|
18
|
+
ad_user.permissions.should == permissions
|
19
|
+
ad_user.role.should == role
|
20
|
+
end
|
21
|
+
|
22
|
+
describe 'role' do
|
23
|
+
GSGraph::AdUser::ROLES.keys.each do |role|
|
24
|
+
context "when #{role} role given" do
|
25
|
+
let(:role) { GSGraph::AdUser::ROLES[role] }
|
26
|
+
its(:"#{role}_access?") { should be_true }
|
27
|
+
(GSGraph::AdUser::ROLES.keys - [role]).each do |no_access|
|
28
|
+
its(:"#{no_access}_access?") { should be_false }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'permissions' do
|
35
|
+
GSGraph::AdUser::PERMISSIONS.keys.each do |permission|
|
36
|
+
context "when #{permission} permission given" do
|
37
|
+
let(:permissions) { [GSGraph::AdUser::PERMISSIONS[permission]] }
|
38
|
+
its(:"#{permission}_access?") { should be_true }
|
39
|
+
(GSGraph::AdUser::PERMISSIONS.keys - [permission]).each do |no_access|
|
40
|
+
its(:"#{no_access}_access?") { should be_false }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe ".fetch" do
|
47
|
+
let(:ad_user) do
|
48
|
+
GSGraph::AdUser.new(
|
49
|
+
"579612276",
|
50
|
+
:permissions => permissions,
|
51
|
+
:role => role
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should fetch the regular User and add the AdUser attributes" do
|
56
|
+
mock_graph :get, '579612276', 'users/me_private', :access_token => 'access_token' do
|
57
|
+
fetched_user = ad_user.fetch(:access_token => 'access_token')
|
58
|
+
|
59
|
+
fetched_user.identifier.should == "579612276"
|
60
|
+
fetched_user.first_name = "Nov"
|
61
|
+
fetched_user.last_name = "Matake"
|
62
|
+
fetched_user.permissions.should == permissions
|
63
|
+
fetched_user.role.should == role
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Album do
|
4
|
+
describe '.new' do
|
5
|
+
it 'should setup all supported attributes' do
|
6
|
+
attributes = {
|
7
|
+
:id => '12345',
|
8
|
+
:from => {
|
9
|
+
:id => '23456',
|
10
|
+
:name => 'nov matake'
|
11
|
+
},
|
12
|
+
:name => 'album 1',
|
13
|
+
:description => 'an album for gs_graph test',
|
14
|
+
:location => 'Tokyo, Japan',
|
15
|
+
:link => 'http://www.gamestamper.com/album/12345',
|
16
|
+
:count => 10,
|
17
|
+
:cover_photo => '10150146072661729',
|
18
|
+
:type => 'normal',
|
19
|
+
:created_time => '2009-12-29T15:24:50+0000',
|
20
|
+
:updated_time => '2010-01-02T15:37:41+0000',
|
21
|
+
:comments => {
|
22
|
+
:data => [{
|
23
|
+
:id => '909694472945_418735',
|
24
|
+
:from => {
|
25
|
+
:id => '520739622',
|
26
|
+
:name => 'Alison Marie Weber',
|
27
|
+
},
|
28
|
+
:message => 'Love all the pix!',
|
29
|
+
:created_time => '2009-08-15T14:57:36+0000'
|
30
|
+
}]
|
31
|
+
}
|
32
|
+
}
|
33
|
+
album = GSGraph::Album.new(attributes.delete(:id), attributes)
|
34
|
+
album.identifier.should == '12345'
|
35
|
+
album.from.should == GSGraph::User.new('23456', :name => 'nov matake')
|
36
|
+
album.name.should == 'album 1'
|
37
|
+
album.description.should == 'an album for gs_graph test'
|
38
|
+
album.location.should == 'Tokyo, Japan'
|
39
|
+
album.link.should == 'http://www.gamestamper.com/album/12345'
|
40
|
+
album.cover_photo.should == GSGraph::Photo.new('10150146072661729')
|
41
|
+
album.count.should == 10
|
42
|
+
album.type.should == 'normal'
|
43
|
+
album.created_time.should == Time.parse('2009-12-29T15:24:50+0000')
|
44
|
+
album.updated_time.should == Time.parse('2010-01-02T15:37:41+0000')
|
45
|
+
album.comments.should == [GSGraph::Comment.new(
|
46
|
+
'909694472945_418735',
|
47
|
+
:from => {
|
48
|
+
:id => '520739622',
|
49
|
+
:name => 'Alison Marie Weber',
|
50
|
+
},
|
51
|
+
:message => 'Love all the pix!',
|
52
|
+
:created_time => '2009-08-15T14:57:36+0000'
|
53
|
+
)]
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'should support page as from' do
|
57
|
+
page_album = GSGraph::Album.new('12345', :from => {
|
58
|
+
:id => '23456',
|
59
|
+
:name => 'Smart.fm',
|
60
|
+
:category => 'Web Site'
|
61
|
+
})
|
62
|
+
page_album.from.should == GSGraph::Page.new('23456', :name => 'Smart.fm', :category => 'Web Site')
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe '#picture' do
|
67
|
+
let(:album) { GSGraph::Album.new('12345') }
|
68
|
+
subject { album.picture }
|
69
|
+
|
70
|
+
context 'when access token is given' do
|
71
|
+
before { album.access_token = 'access_token' }
|
72
|
+
it { should == File.join(GSGraph::graph_url, '12345/picture?access_token=access_token') }
|
73
|
+
it 'should support size' do
|
74
|
+
album.picture(:small).should == File.join(GSGraph::graph_url, '12345/picture?type=small&access_token=access_token')
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
context 'when no access token' do
|
79
|
+
it { should == File.join(GSGraph::graph_url, '12345/picture') }
|
80
|
+
end
|
81
|
+
|
82
|
+
context 'when no redirect' do
|
83
|
+
before { album.access_token = 'access_token' }
|
84
|
+
it 'should return GSGraph::Picture' do
|
85
|
+
mock_graph :get, '12345/picture', 'albums/picture/success', :access_token => 'access_token', :params => {
|
86
|
+
:redirect => 'false'
|
87
|
+
} do
|
88
|
+
album.picture(:redirect => false).should be_instance_of GSGraph::Picture
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|