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,18 @@
|
|
1
|
+
module GSGraph
|
2
|
+
module Connections
|
3
|
+
module Notifications
|
4
|
+
def notifications(options = {})
|
5
|
+
notifications = self.connection :notifications, options
|
6
|
+
notifications.map! do |notification|
|
7
|
+
Notification.new notification[:id], notification.merge(
|
8
|
+
:access_token => options[:access_token] || self.access_token
|
9
|
+
)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def notification!(options = {})
|
14
|
+
post options.merge(:connection => :notifications)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module GSGraph
|
2
|
+
module Connections
|
3
|
+
module Offers
|
4
|
+
def offers(options = {})
|
5
|
+
offers = self.connection :offers, options
|
6
|
+
offers.map! do |offer|
|
7
|
+
Offer.new offer[:id], offer.merge(
|
8
|
+
:access_token => options[:access_token] || self.access_token
|
9
|
+
)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def offer!(options = {})
|
14
|
+
# A page access token is required to change an associated offer
|
15
|
+
offer = post options.merge(:connection => :offers).merge(:access_token => self.page_access_token)
|
16
|
+
Offer.new offer[:id], options.merge(offer).merge(
|
17
|
+
:access_token => options[:access_token] || self.access_token
|
18
|
+
)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module GSGraph
|
2
|
+
module Connections
|
3
|
+
module Outbox
|
4
|
+
def outbox(options = {})
|
5
|
+
threads = self.connection :outbox, options
|
6
|
+
threads.map! do |thread|
|
7
|
+
if thread[:comments]
|
8
|
+
Thread::BeforeTransition.new thread[:id], thread.merge(
|
9
|
+
:access_token => options[:access_token] || self.access_token
|
10
|
+
)
|
11
|
+
else
|
12
|
+
Thread.new thread[:id], thread.merge(
|
13
|
+
:access_token => options[:access_token] || self.access_token
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module GSGraph
|
2
|
+
module Connections
|
3
|
+
module Participants
|
4
|
+
def participants(options = {})
|
5
|
+
users = self.connection :participants, options
|
6
|
+
users.map! do |user|
|
7
|
+
User.new user[:id], user.merge(
|
8
|
+
:access_token => options[:access_token] || self.access_token
|
9
|
+
)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module GSGraph
|
2
|
+
module Connections
|
3
|
+
module Payments
|
4
|
+
def payments(options = {})
|
5
|
+
orders = self.connection :payments, options
|
6
|
+
orders.map! do |order|
|
7
|
+
Order.new order[:id], order.merge(
|
8
|
+
:access_token => options[:access_token] || self.access_token
|
9
|
+
)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module GSGraph
|
2
|
+
module Connections
|
3
|
+
module Permissions
|
4
|
+
def permissions(options = {})
|
5
|
+
self.connection(:permissions, options).first.try(:inject, []) do |arr, (key, value)|
|
6
|
+
arr << key.to_sym if value.to_i == 1
|
7
|
+
arr
|
8
|
+
end || []
|
9
|
+
end
|
10
|
+
|
11
|
+
def revoke!(permission = nil, options = {})
|
12
|
+
destroy options.merge(:permission => permission, :connection => :permissions)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module GSGraph
|
2
|
+
module Connections
|
3
|
+
module Photos
|
4
|
+
def photos(options = {})
|
5
|
+
photos = self.connection :photos, options
|
6
|
+
photos.map! do |photo|
|
7
|
+
Photo.new photo[:id], photo.merge(
|
8
|
+
:access_token => options[:access_token] || self.access_token
|
9
|
+
)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def photo!(options = {})
|
14
|
+
photo = post options.merge(:connection => :photos)
|
15
|
+
Photo.new photo[:id], options.merge(photo).merge(
|
16
|
+
:access_token => options[:access_token] || self.access_token
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module GSGraph
|
2
|
+
module Connections
|
3
|
+
module Picture
|
4
|
+
# User can specify size in two ways:
|
5
|
+
# 1. By type: square | small | normal | large
|
6
|
+
# 2. By width and height, so facebook return the _closest_
|
7
|
+
# match to the size you specified, if only one parameter
|
8
|
+
# is set, then facebook will return square image
|
9
|
+
# See: https://developers.gamestamper.com/docs/reference/api/user/
|
10
|
+
def picture(options_or_size = {})
|
11
|
+
options = if options_or_size.is_a?(String) || options_or_size.is_a?(Symbol)
|
12
|
+
{:type => options_or_size}
|
13
|
+
else
|
14
|
+
options_or_size
|
15
|
+
end
|
16
|
+
_endpoint_ = ["#{self.endpoint}/picture", options.to_query].delete_if(&:blank?).join('?')
|
17
|
+
|
18
|
+
if options[:redirect] == false
|
19
|
+
response = get options.merge(
|
20
|
+
:connection => :picture,
|
21
|
+
|
22
|
+
# NOTE: can be removed when addressable 2.3.3+ released with this fix
|
23
|
+
# https://github.com/sporkmonger/addressable/commit/421a88fed1d2f14426f15158f3712ab563581327
|
24
|
+
:redirect => 'false'
|
25
|
+
)
|
26
|
+
GSGraph::Picture.new response[:data]
|
27
|
+
else
|
28
|
+
_endpoint_
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
module Updatable
|
33
|
+
def picture!(options = {})
|
34
|
+
post options.merge(:connection => :picture)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module GSGraph
|
2
|
+
module Connections
|
3
|
+
module Posts
|
4
|
+
def posts(options = {})
|
5
|
+
posts = self.connection :posts, options
|
6
|
+
posts.map! do |post|
|
7
|
+
Post.new post[:id], post.merge(
|
8
|
+
:access_token => options[:access_token] || self.access_token
|
9
|
+
)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module GSGraph
|
2
|
+
module Connections
|
3
|
+
module PromotablePosts
|
4
|
+
def promotable_posts(options = {})
|
5
|
+
posts = self.connection :promotable_posts, options
|
6
|
+
posts.map! do |post|
|
7
|
+
PromotablePost.new post[:id], post.merge(
|
8
|
+
:access_token => options[:access_token] || self.access_token
|
9
|
+
)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module GSGraph
|
2
|
+
module Connections
|
3
|
+
module QuestionOptions
|
4
|
+
def question_options(options = {})
|
5
|
+
question_options = self.connection :options, options
|
6
|
+
question_options.map! do |question_option|
|
7
|
+
QuestionOption.new question_option[:id], question_option.merge(
|
8
|
+
:access_token => options[:access_token] || self.access_token
|
9
|
+
)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module GSGraph
|
2
|
+
module Connections
|
3
|
+
module Questions
|
4
|
+
def questions(options = {})
|
5
|
+
questions = self.connection :questions, options
|
6
|
+
questions.map! do |question|
|
7
|
+
Question.new question[:id], question.merge(
|
8
|
+
:access_token => options[:access_token] || self.access_token
|
9
|
+
)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def question!(options = {})
|
14
|
+
question = post options.merge(:connection => :questions)
|
15
|
+
Question.new question[:id], question.merge(
|
16
|
+
:question => options[:question],
|
17
|
+
:access_token => options[:access_token] || self.access_token
|
18
|
+
)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module GSGraph
|
2
|
+
module Connections
|
3
|
+
module ReachEstimates
|
4
|
+
def reach_estimates(options = {})
|
5
|
+
reach_estimates = self.get options.merge(:connection => :reachestimate)
|
6
|
+
ReachEstimate.new reach_estimates.merge(:access_token => options[:access_token] || self.access_token)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module GSGraph
|
2
|
+
module Connections
|
3
|
+
module Roles
|
4
|
+
def roles(options = {})
|
5
|
+
roles = self.connection :roles, options
|
6
|
+
roles.map! do |role|
|
7
|
+
Role.new role
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def admin!(user, options = {})
|
12
|
+
role! user, options.merge(:role => 'administrators')
|
13
|
+
end
|
14
|
+
|
15
|
+
def developer!(user, options = {})
|
16
|
+
role! user, options.merge(:role => 'developers')
|
17
|
+
end
|
18
|
+
|
19
|
+
def tester!(user, options = {})
|
20
|
+
role! user, options.merge(:role => 'testers')
|
21
|
+
end
|
22
|
+
|
23
|
+
def insights_user!(user, options = {})
|
24
|
+
role! user, options.merge(:role => 'insights users')
|
25
|
+
end
|
26
|
+
|
27
|
+
def role!(user, options = {})
|
28
|
+
post options.merge(:user => user.identifier, :connection => :roles)
|
29
|
+
end
|
30
|
+
|
31
|
+
def unrole!(user, options = {})
|
32
|
+
delete options.merge(:user => user.identifier, :connection => :roles)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module GSGraph
|
2
|
+
module Connections
|
3
|
+
module Scores
|
4
|
+
def scores(options = {})
|
5
|
+
scores = self.connection :scores, options
|
6
|
+
scores.map! do |score|
|
7
|
+
Score.new score[:id], score.merge(
|
8
|
+
:access_token => options[:access_token] || self.access_token
|
9
|
+
)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def score!(score, options = {})
|
14
|
+
post options.merge(:connection => :scores, :score => score)
|
15
|
+
end
|
16
|
+
|
17
|
+
def unscore!(options = {})
|
18
|
+
destroy options.merge(:connection => :scores)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module GSGraph
|
2
|
+
module Connections
|
3
|
+
module Senders
|
4
|
+
def senders(options = {})
|
5
|
+
users = self.connection :senders, options
|
6
|
+
users.map! do |user|
|
7
|
+
User.new user[:id], user.merge(
|
8
|
+
:access_token => options[:access_token] || self.access_token
|
9
|
+
)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module GSGraph
|
2
|
+
module Connections
|
3
|
+
module Settings
|
4
|
+
AVAILABLE_SETTINGS = [
|
5
|
+
:users_can_post,
|
6
|
+
:users_can_post_photos,
|
7
|
+
:users_can_tag_photos,
|
8
|
+
:users_can_post_videos
|
9
|
+
]
|
10
|
+
|
11
|
+
def self.included(klass)
|
12
|
+
AVAILABLE_SETTINGS.each do |setting|
|
13
|
+
klass.class_eval <<-SETTING
|
14
|
+
def #{setting}?(options = {})
|
15
|
+
settings(options).include? :#{setting}
|
16
|
+
end
|
17
|
+
|
18
|
+
def #{setting}!(options = {})
|
19
|
+
enable! :#{setting}, options
|
20
|
+
end
|
21
|
+
|
22
|
+
def #{setting.to_s.sub('can', 'cannot')}!(options = {})
|
23
|
+
disable! :#{setting}, options
|
24
|
+
end
|
25
|
+
SETTING
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def settings(options = {})
|
30
|
+
@settings = nil if options[:no_cache]
|
31
|
+
@settings ||= self.connection(:settings, options).inject([]) do |_settings_, _setting_|
|
32
|
+
_settings_ << _setting_[:setting].downcase.to_sym if _setting_[:value]
|
33
|
+
_settings_
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def enable!(setting, options = {})
|
38
|
+
__update_setting__ setting, true, options
|
39
|
+
end
|
40
|
+
|
41
|
+
def disable!(setting, options = {})
|
42
|
+
__update_setting__ setting, false, options
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def __update_setting__(setting, value, options = {})
|
48
|
+
succeeded = post options.merge(
|
49
|
+
:setting => setting.to_s.upcase,
|
50
|
+
:value => value,
|
51
|
+
:connection => :settings
|
52
|
+
)
|
53
|
+
if succeeded
|
54
|
+
@settings ||= []
|
55
|
+
if value
|
56
|
+
@settings << setting.to_sym
|
57
|
+
else
|
58
|
+
@settings.delete_if { |key| key == setting.to_sym }
|
59
|
+
end
|
60
|
+
end
|
61
|
+
succeeded
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module GSGraph
|
2
|
+
module Connections
|
3
|
+
module Statuses
|
4
|
+
def statuses(options = {})
|
5
|
+
statuses = self.connection :statuses, options
|
6
|
+
statuses.map! do |status|
|
7
|
+
Status.new status[:id], status.merge(
|
8
|
+
:access_token => options[:access_token] || self.access_token
|
9
|
+
)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module GSGraph
|
2
|
+
module Connections
|
3
|
+
module SubscribedTo
|
4
|
+
def subscribed_to(options = {})
|
5
|
+
subscribees = self.connection :subscribedto, options
|
6
|
+
subscribees.map! do |subscribee|
|
7
|
+
User.new subscribee[:id], subscribee.merge(
|
8
|
+
:access_token => options[:access_token] || self.access_token
|
9
|
+
)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|