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,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::AdGroups, '#ad_creatives' do
|
4
|
+
context 'when included by GSGraph::AdGroup' do
|
5
|
+
context 'when access_token is given' do
|
6
|
+
it 'should return ad_creatives as GSGraph::AdCreative' do
|
7
|
+
mock_graph :get, '22334455/adcreatives', 'ad_groups/ad_creatives/22334455_ad_creatives', :access_token => 'access_token' do
|
8
|
+
ad_creatives = GSGraph::AdGroup.new('22334455', :access_token => 'access_token').ad_creatives
|
9
|
+
ad_creatives.size.should == 1
|
10
|
+
ad_creative = ad_creatives.first
|
11
|
+
ad_creative.identifier.should == "6003590469668"
|
12
|
+
ad_creative.view_tag.should == ""
|
13
|
+
ad_creative.alt_view_tags.should == []
|
14
|
+
ad_creative.creative_id.should == "6003590469668"
|
15
|
+
ad_creative.type.should == 1
|
16
|
+
ad_creative.title.should == "Some Creative"
|
17
|
+
ad_creative.body.should == "The Body"
|
18
|
+
ad_creative.image_hash.should == "4c34b48cdcbf5dd3055acb717343a9d6"
|
19
|
+
ad_creative.link_url.should == "http://www.google.com/"
|
20
|
+
ad_creative.name.should == "Creative Name"
|
21
|
+
ad_creative.run_status.should == 1
|
22
|
+
ad_creative.preview_url.should == "http://www.gamestamper.com/ads/api/creative_preview.php?cid=6003590469668"
|
23
|
+
ad_creative.count_current_adgroups.should == 1
|
24
|
+
ad_creative.image_url.should == "https://www.google.com/image.png"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::AdGroupStats, '#ad_group_stats' do
|
4
|
+
context 'when included by GSGraph::AdAccount' do
|
5
|
+
context 'when access_token is given' do
|
6
|
+
it 'should return ad_group_stats as GSGraph::AdGroupStat' do
|
7
|
+
mock_graph :get, 'act_11223344/adgroupstats', 'ad_accounts/ad_group_stats/test_ad_group_stats', :access_token => 'access_token' do
|
8
|
+
ad_group_stats = GSGraph::AdAccount.new('act_11223344', :access_token => 'access_token').ad_group_stats
|
9
|
+
|
10
|
+
ad_group_stats.size.should == 3
|
11
|
+
ad_group_stats.total_count.should == 3081
|
12
|
+
ad_group_stats.each { |ad_group_stat| ad_group_stat.should be_instance_of(GSGraph::AdGroupStat) }
|
13
|
+
ad_group_stats.first.should == GSGraph::AdGroupStat.new(
|
14
|
+
"6002647798444/stats/0/1315607403",
|
15
|
+
:impressions => 232641,
|
16
|
+
:clicks => 534,
|
17
|
+
:spent => 18885,
|
18
|
+
:social_impressions => 22676,
|
19
|
+
:social_clicks => 81,
|
20
|
+
:social_spent => 1548,
|
21
|
+
:unique_impressions => 0,
|
22
|
+
:social_unique_impressions => 0,
|
23
|
+
:unique_clicks => 0,
|
24
|
+
:social_unique_clicks => 0,
|
25
|
+
:actions => 140,
|
26
|
+
:connections => 0,
|
27
|
+
:adgroup_id => 6002647798444,
|
28
|
+
:start_time => nil,
|
29
|
+
:end_time => "2011-09-09T22:30:03+0000",
|
30
|
+
:access_token => "access_token"
|
31
|
+
)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'when paginating' do
|
36
|
+
it 'should use ad_group_stats as method name' do
|
37
|
+
mock_graph :get, 'act_11223344/adgroupstats', 'ad_accounts/ad_group_stats/test_ad_group_stats', :access_token => 'access_token' do
|
38
|
+
ad_group_stats = GSGraph::AdAccount.new('act_11223344', :access_token => 'access_token').ad_group_stats
|
39
|
+
ad_group_stats.owner.should_receive :ad_group_stats
|
40
|
+
ad_group_stats.next
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should use adcampaignstats as connection name' do
|
45
|
+
mock_graph :get, 'act_11223344/adgroupstats', 'ad_accounts/ad_group_stats/test_ad_group_stats', :access_token => 'access_token' do
|
46
|
+
ad_group_stats = GSGraph::AdAccount.new('act_11223344', :access_token => 'access_token').ad_group_stats
|
47
|
+
expect { ad_group_stats.next }.to request_to 'act_11223344/adgroupstats'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::AdGroups, '#ad_groups' do
|
4
|
+
context 'when included by GSGraph::AdCampaign' do
|
5
|
+
context 'when access_token is given' do
|
6
|
+
it 'should return ad_groups as GSGraph::AdGroup' do
|
7
|
+
mock_graph :get, '22334455/adgroups', 'ad_campaigns/ad_groups/22334455_ad_groups', :access_token => 'access_token' do
|
8
|
+
ad_groups = GSGraph::AdCampaign.new('22334455', :access_token => 'access_token').ad_groups
|
9
|
+
ad_groups.size.should == 2
|
10
|
+
ad_groups.each { |ad_group| ad_group.should be_instance_of(GSGraph::AdGroup) }
|
11
|
+
ad_groups.first.should == GSGraph::AdGroup.new(
|
12
|
+
"6003570493888",
|
13
|
+
:access_token => 'access_token',
|
14
|
+
:ad_id => 6003570493888,
|
15
|
+
:campaign_id => 22334455,
|
16
|
+
:name => "My Ad 1",
|
17
|
+
:adgroup_status => 1,
|
18
|
+
:bid_type => 1,
|
19
|
+
:max_bid => "120",
|
20
|
+
:adgroup_id => 6003570493888,
|
21
|
+
:end_time => nil,
|
22
|
+
:start_time => nil,
|
23
|
+
:updated_time => Time.parse("2011-08-17T20:41:39+0000"),
|
24
|
+
:bid_info => {"1" => "120"},
|
25
|
+
:creative_ids => [6003570493444],
|
26
|
+
:targeting => {
|
27
|
+
"age_min" => 18,
|
28
|
+
"age_max" => 65,
|
29
|
+
"countries" => ["US"],
|
30
|
+
"education_statuses" => [3],
|
31
|
+
"college_networks" => [
|
32
|
+
{"name" => "Emory", "id" => "16777243"},
|
33
|
+
{"name" => "Georgia Tech", "id" => "16777345"}
|
34
|
+
]
|
35
|
+
}
|
36
|
+
)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe GSGraph::Connections::AdGroups, '#ad_group!' do
|
44
|
+
context 'when included by GSGraph::AdAccount' do
|
45
|
+
it 'should return generated ad_group' do
|
46
|
+
mock_graph :post, 'act_22334455/adgroups', 'ad_accounts/ad_groups/post_with_valid_access_token' do
|
47
|
+
ad_group = GSGraph::AdAccount.new('act_22334455', :access_token => 'valid').ad_group!(
|
48
|
+
:name => "Test Ad 1",
|
49
|
+
:campaign_id => 66778899,
|
50
|
+
:bid_type => 1,
|
51
|
+
:max_bid => 100,
|
52
|
+
:start_time => Time.parse("2011-09-10T12:00:00+00:00"),
|
53
|
+
:end_time => Time.parse("2011-09-20T16:00:00-04:00")
|
54
|
+
)
|
55
|
+
|
56
|
+
ad_group.identifier.should == 112233445566
|
57
|
+
ad_group.campaign_id.should == 66778899
|
58
|
+
ad_group.name.should == "Test Ad 1"
|
59
|
+
ad_group.bid_type.should == 1
|
60
|
+
ad_group.max_bid.should == 100
|
61
|
+
ad_group.start_time.should == Time.parse("2011-09-10T12:00:00+00:00")
|
62
|
+
ad_group.end_time.should == Time.parse("2011-09-20T16:00:00-04:00")
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'should handle the redownload parameter' do
|
67
|
+
mock_graph :post, 'act_22334455/adgroups', 'ad_accounts/ad_groups/post_with_redownload' do
|
68
|
+
ad_group = GSGraph::AdAccount.new('act_22334455', :access_token => 'valid').ad_group!(
|
69
|
+
:name => "Test Ad 2",
|
70
|
+
:campaign_id => 11223344,
|
71
|
+
:bid_type => 1,
|
72
|
+
:max_bid => 100,
|
73
|
+
:start_time => Time.parse("2012-02-20T00:00:00Z"),
|
74
|
+
:end_time => Time.parse("2012-02-23T00:00:00Z"),
|
75
|
+
:redownload => true
|
76
|
+
)
|
77
|
+
|
78
|
+
ad_group.identifier.should == "22334455"
|
79
|
+
ad_group.campaign_id.should == 11223344
|
80
|
+
ad_group.name.should == "Test Ad 2"
|
81
|
+
ad_group.bid_type.should == 1
|
82
|
+
ad_group.max_bid.should == 100
|
83
|
+
ad_group.start_time.should == Time.parse("2012-02-20T00:00:00Z")
|
84
|
+
ad_group.end_time.should == Time.parse("2012-02-23T00:00:00Z")
|
85
|
+
|
86
|
+
# ad_status is not sent, only received
|
87
|
+
ad_group.adgroup_status.should == 4
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::AdPreviews, '#ad_previews' do
|
4
|
+
context 'when included by GSGraph::AdAccount' do
|
5
|
+
context 'when access_token is given' do
|
6
|
+
it 'should return ad_preview as GSGraph::AdPreview' do
|
7
|
+
mock_graph :post, 'act_123456789/generatepreviews', 'ad_accounts/previews/test_ad_previews' do
|
8
|
+
ad_account = GSGraph::AdAccount.new('act_123456789', :access_token => 'access_token')
|
9
|
+
ad_preview = ad_account.ad_previews(:access_token => 'access_token', :creative => {})
|
10
|
+
ad_preview.should be_instance_of(GSGraph::AdPreview)
|
11
|
+
ad_preview.preview_data[:body].should == '<h1>hello world</h1>'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Admins do
|
4
|
+
let(:page) { GSGraph::Page.new('GSGraph', :access_token => 'page_token') }
|
5
|
+
context 'when given user is admin' do
|
6
|
+
it 'should be true' do
|
7
|
+
mock_graph :get, 'GSGraph/admins/matake', 'pages/admins/sample', :access_token => 'page_token' do
|
8
|
+
page.admin?(GSGraph::User.new('matake')).should be_true
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
context 'otherwise' do
|
14
|
+
it 'should be false' do
|
15
|
+
mock_graph :get, 'GSGraph/admins/nov.matake', 'pages/admins/blank', :access_token => 'page_token' do
|
16
|
+
page.admin?(GSGraph::User.new('nov.matake')).should be_false
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe GSGraph::Connections::Albums, '#albums' do
|
5
|
+
context 'when included by GSGraph::User' do
|
6
|
+
context 'when no access_token given' do
|
7
|
+
it 'should raise GSGraph::Unauthorized' do
|
8
|
+
mock_graph :get, 'matake/albums', 'users/albums/matake_public', :status => [401, 'Unauthorized'] do
|
9
|
+
lambda do
|
10
|
+
GSGraph::User.new('matake').albums
|
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 albums as GSGraph::Album' do
|
18
|
+
mock_graph :get, 'matake/albums', 'users/albums/matake_private', :access_token => 'access_token' do
|
19
|
+
albums = GSGraph::User.new('matake', :access_token => 'access_token').albums
|
20
|
+
albums.first.should == GSGraph::Album.new(
|
21
|
+
'19351532276',
|
22
|
+
:access_token => 'access_token',
|
23
|
+
:from => {
|
24
|
+
:id => '579612276',
|
25
|
+
:name => 'Nov Matake'
|
26
|
+
},
|
27
|
+
:name => 'モバイルアップロード',
|
28
|
+
:description => 'hello facebookers!',
|
29
|
+
:link => 'http://www.gamestamper.com/album.php?aid=25463&id=579612276',
|
30
|
+
:location => 'NYC',
|
31
|
+
:count => 3,
|
32
|
+
:privacy => 'everyone',
|
33
|
+
:created_time => '2008-07-27T11:38:15+0000',
|
34
|
+
:updated_time => '2009-02-07T16:09:53+0000'
|
35
|
+
)
|
36
|
+
albums.each do |album|
|
37
|
+
album.should be_instance_of(GSGraph::Album)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe GSGraph::Connections::Albums, '#album!' do
|
46
|
+
context 'when included by GSGraph::User' do
|
47
|
+
it 'should return generated album' do
|
48
|
+
mock_graph :post, 'matake/albums', 'users/albums/post_with_valid_access_token', :access_token => 'valid', :params => {
|
49
|
+
:name => 'GSGraph test',
|
50
|
+
:message => 'test test test'
|
51
|
+
} do
|
52
|
+
album = GSGraph::User.new('matake', :access_token => 'valid').album!(
|
53
|
+
:name => 'GSGraph test',
|
54
|
+
:message => 'test test test'
|
55
|
+
)
|
56
|
+
album.identifier.should == 401096332276
|
57
|
+
album.access_token.should == 'valid'
|
58
|
+
album.name.should == 'GSGraph test'
|
59
|
+
album.description.should == 'test test test'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::AppNotifications do
|
4
|
+
let(:app) do
|
5
|
+
_app_ = GSGraph::Application.new('app_id', :secret => 'app_secret')
|
6
|
+
_app_.should_receive(:get_access_token).and_return(
|
7
|
+
Rack::OAuth2::AccessToken::Legacy.new(:access_token => 'app_access_token')
|
8
|
+
)
|
9
|
+
_app_
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '#notify!' do
|
13
|
+
it 'should return success json' do
|
14
|
+
mock_graph :post, 'matake/notifications', 'success', :params => {
|
15
|
+
:template => 'hello'
|
16
|
+
}, :access_token => 'app_access_token' do
|
17
|
+
user = GSGraph::User.new('matake')
|
18
|
+
response = app.notify! user, :template => 'hello'
|
19
|
+
response.should == {'success' => true}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::AppRequests do
|
4
|
+
describe '#app_requests' do
|
5
|
+
it 'should return an Array of GSGraph::AppRequest' do
|
6
|
+
mock_graph :get, 'me/apprequests', 'users/app_requests/me_private', :access_token => 'access_token' do
|
7
|
+
app_requests = GSGraph::User.me('access_token').app_requests
|
8
|
+
app_requests.each do |app_request|
|
9
|
+
app_request.should be_instance_of GSGraph::AppRequest
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#app_request!' do
|
16
|
+
it 'should return GSGraph::AppRequest' do
|
17
|
+
mock_graph :post, 'me/apprequests', 'users/app_requests/created', :access_token => 'access_token', :params => {
|
18
|
+
:message => 'Message', :data => 'Data'
|
19
|
+
} do
|
20
|
+
app_request = GSGraph::User.me('access_token').app_request! :message => 'Message', :data => 'Data'
|
21
|
+
app_request.should be_instance_of GSGraph::AppRequest
|
22
|
+
app_request.identifier.should == "158192394305537_579612276"
|
23
|
+
app_request.message.should == 'Message'
|
24
|
+
app_request.data.should == 'Data'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Attending do
|
4
|
+
let(:event) do
|
5
|
+
GSGraph::Event.new('smartday', :access_token => 'access_token')
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#attending' do
|
9
|
+
it 'should return attending users as GSGraph::User' do
|
10
|
+
mock_graph :get, 'smartday/attending', 'events/attending/smartday_private', :access_token => 'access_token' do
|
11
|
+
event.attending.each do |user|
|
12
|
+
user.should be_instance_of(GSGraph::User)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '#attending?' do
|
19
|
+
context 'when attending' do
|
20
|
+
it 'should return true' do
|
21
|
+
mock_graph :get, 'smartday/attending/uid', 'events/invited/attending', :access_token => 'access_token' do
|
22
|
+
event.attending?(
|
23
|
+
GSGraph::User.new('uid')
|
24
|
+
).should be_true
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'otherwise' do
|
30
|
+
it 'should return false' do
|
31
|
+
mock_graph :get, 'smartday/attending/uid', 'empty', :access_token => 'access_token' do
|
32
|
+
event.attending?(
|
33
|
+
GSGraph::User.new('uid')
|
34
|
+
).should be_false
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#attend!' do
|
41
|
+
it 'should return true' do
|
42
|
+
mock_graph :post, 'smartday/attending', 'events/attending/post_with_valid_access_token', :access_token => 'access_token' do
|
43
|
+
event.attend!.should be_true
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Connections::Banned do
|
4
|
+
let(:app) { GSGraph::Application.new('app_id', :secret => 'app_secret') }
|
5
|
+
let(:user) { GSGraph::User.new('uid') }
|
6
|
+
|
7
|
+
describe '#banned' do
|
8
|
+
it 'should return an Array of GSGraph::User' do
|
9
|
+
mock_graph :post, 'oauth/access_token', 'app_token_response' do
|
10
|
+
mock_graph :get, 'app_id/banned', 'applications/banned/list', :access_token => 'app_token' do
|
11
|
+
users = app.banned
|
12
|
+
users.each do |user|
|
13
|
+
user.should be_a GSGraph::User
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#banned?' do
|
21
|
+
context 'when banned' do
|
22
|
+
it 'should retrun true' do
|
23
|
+
mock_graph :post, 'oauth/access_token', 'app_token_response' do
|
24
|
+
mock_graph :get, 'app_id/banned/uid', 'applications/banned/banned_user', :access_token => 'app_token' do
|
25
|
+
app.banned?(user).should be_true
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'otherwise' do
|
32
|
+
it 'should retrun false' do
|
33
|
+
mock_graph :post, 'oauth/access_token', 'app_token_response' do
|
34
|
+
mock_graph :get, 'app_id/banned/uid', 'empty', :access_token => 'app_token' do
|
35
|
+
app.banned?(user).should be_false
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '#ban!' do
|
43
|
+
it 'should return true' do
|
44
|
+
mock_graph :post, 'oauth/access_token', 'app_token_response' do
|
45
|
+
mock_graph :post, 'app_id/banned', 'true', :access_token => 'app_token', :params => {
|
46
|
+
:uid => 'uid'
|
47
|
+
} do
|
48
|
+
app.ban!(user).should be_true
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe '#unban!' do
|
55
|
+
it 'should return true' do
|
56
|
+
mock_graph :post, 'oauth/access_token', 'app_token_response' do
|
57
|
+
mock_graph :delete, 'app_id/banned/uid', 'true', :access_token => 'app_token' do
|
58
|
+
app.unban!(user).should be_true
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|