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
data/assets/fb_graph.png
ADDED
Binary file
|
data/gs_graph.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "gs_graph"
|
3
|
+
s.version = File.read("VERSION").delete("\n\r")
|
4
|
+
s.authors = ["nov matake"]
|
5
|
+
s.description = %q{A full-stack GameStamper Graph API wrapper in Ruby.}
|
6
|
+
s.summary = %q{A full-stack GameStamper Graph API wrapper in Ruby.}
|
7
|
+
s.email = "nov@matake.jp"
|
8
|
+
s.extra_rdoc_files = ["LICENSE", "README.rdoc"]
|
9
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
10
|
+
s.homepage = "http://github.com/rockycaamano/gs_graph"
|
11
|
+
s.require_paths = ["lib"]
|
12
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
13
|
+
s.files = `git ls-files`.split("\n")
|
14
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
15
|
+
s.add_runtime_dependency "httpclient", ">= 2.2.0.2"
|
16
|
+
s.add_runtime_dependency "rack-oauth2", ">= 0.14.4"
|
17
|
+
s.add_runtime_dependency "tzinfo"
|
18
|
+
s.add_runtime_dependency "multi_json", ">= 1.3"
|
19
|
+
s.add_development_dependency "rake", ">= 0.8"
|
20
|
+
if RUBY_VERSION >= '1.9'
|
21
|
+
s.add_development_dependency "cover_me", ">= 1.2.0"
|
22
|
+
else
|
23
|
+
s.add_development_dependency "rcov", ">= 0.9"
|
24
|
+
end
|
25
|
+
s.add_development_dependency "rspec", ">= 2"
|
26
|
+
s.add_development_dependency "gs_graph-mock", ">= 0.1.1"
|
27
|
+
s.add_development_dependency "actionpack", ">= 3.0.6"
|
28
|
+
end
|
data/lib/gs_graph.rb
ADDED
@@ -0,0 +1,174 @@
|
|
1
|
+
require 'httpclient'
|
2
|
+
require 'rack/oauth2'
|
3
|
+
require 'patch/rack/oauth2/util'
|
4
|
+
require 'patch/rack/oauth2/client'
|
5
|
+
require 'patch/rack/oauth2/access_token'
|
6
|
+
|
7
|
+
module GSGraph
|
8
|
+
VERSION = ::File.read(
|
9
|
+
::File.join(::File.dirname(__FILE__), '../VERSION')
|
10
|
+
).delete("\n\r")
|
11
|
+
@@graph = "https://graph.gamestamper.com"
|
12
|
+
@@www = "http://www.gamestamper.com"
|
13
|
+
|
14
|
+
def self.setup(session, request)
|
15
|
+
if (!request[:gsgraph].blank?)
|
16
|
+
session[:gsgraph] = request[:gsgraph]
|
17
|
+
end
|
18
|
+
|
19
|
+
if (!request[:gswww].blank?)
|
20
|
+
session[:gswww] = request[:gswww]
|
21
|
+
end
|
22
|
+
|
23
|
+
if (!session[:gsgraph].blank?)
|
24
|
+
@@graph = session[:gsgraph]
|
25
|
+
end
|
26
|
+
|
27
|
+
if (!session[:gswww].blank?)
|
28
|
+
@@www = session[:gswww]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.graph_url
|
33
|
+
return @@graph
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.www_url
|
37
|
+
return @@www
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.logger
|
41
|
+
@@logger
|
42
|
+
end
|
43
|
+
def self.logger=(logger)
|
44
|
+
@@logger = logger
|
45
|
+
end
|
46
|
+
self.logger = Logger.new(STDOUT)
|
47
|
+
self.logger.progname = 'GSGraph'
|
48
|
+
|
49
|
+
def self.debugging?
|
50
|
+
@@debugging
|
51
|
+
end
|
52
|
+
def self.debugging=(boolean)
|
53
|
+
Rack::OAuth2.debugging = boolean
|
54
|
+
@@debugging = boolean
|
55
|
+
end
|
56
|
+
def self.debug!
|
57
|
+
Rack::OAuth2.debug!
|
58
|
+
self.debugging = true
|
59
|
+
end
|
60
|
+
def self.debug(&block)
|
61
|
+
rack_oauth2_original = Rack::OAuth2.debugging?
|
62
|
+
original = self.debugging?
|
63
|
+
debug!
|
64
|
+
yield
|
65
|
+
ensure
|
66
|
+
Rack::OAuth2.debugging = rack_oauth2_original
|
67
|
+
self.debugging = original
|
68
|
+
end
|
69
|
+
self.debugging = false
|
70
|
+
|
71
|
+
def self.http_client
|
72
|
+
_http_client_ = HTTPClient.new(
|
73
|
+
:agent_name => "GSGraph (#{VERSION})"
|
74
|
+
)
|
75
|
+
_http_client_.request_filter << Debugger::RequestFilter.new if debugging?
|
76
|
+
http_config.try(:call, _http_client_)
|
77
|
+
_http_client_
|
78
|
+
end
|
79
|
+
def self.http_config(&block)
|
80
|
+
Rack::OAuth2.http_config &block unless Rack::OAuth2.http_config
|
81
|
+
@@http_config ||= block
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
require 'gs_graph/exception'
|
86
|
+
require 'gs_graph/debugger'
|
87
|
+
|
88
|
+
require 'gs_graph/auth'
|
89
|
+
require 'gs_graph/comparison'
|
90
|
+
require 'gs_graph/serialization'
|
91
|
+
require 'gs_graph/collection'
|
92
|
+
require 'gs_graph/connection'
|
93
|
+
require 'gs_graph/connections'
|
94
|
+
require 'gs_graph/searchable'
|
95
|
+
|
96
|
+
require 'gs_graph/action'
|
97
|
+
require 'gs_graph/age_range'
|
98
|
+
require 'gs_graph/device'
|
99
|
+
require 'gs_graph/education'
|
100
|
+
require 'gs_graph/location'
|
101
|
+
require 'gs_graph/picture'
|
102
|
+
require 'gs_graph/poke'
|
103
|
+
require 'gs_graph/privacy'
|
104
|
+
require 'gs_graph/role'
|
105
|
+
require 'gs_graph/subscription'
|
106
|
+
require 'gs_graph/targeting'
|
107
|
+
require 'gs_graph/venue'
|
108
|
+
require 'gs_graph/work'
|
109
|
+
|
110
|
+
require 'gs_graph/node'
|
111
|
+
require 'gs_graph/open_graph'
|
112
|
+
require 'gs_graph/achievement'
|
113
|
+
require 'gs_graph/ad_account'
|
114
|
+
require 'gs_graph/ad_campaign'
|
115
|
+
require 'gs_graph/ad_campaign_stat'
|
116
|
+
require 'gs_graph/ad_connection_object'
|
117
|
+
require 'gs_graph/ad_creative'
|
118
|
+
require 'gs_graph/ad_group'
|
119
|
+
require 'gs_graph/ad_group_stat'
|
120
|
+
require 'gs_graph/ad_keyword'
|
121
|
+
require 'gs_graph/ad_keyword_suggestion'
|
122
|
+
require 'gs_graph/ad_keyword_valid'
|
123
|
+
require 'gs_graph/broad_targeting_category'
|
124
|
+
require 'gs_graph/reach_estimate.rb'
|
125
|
+
require 'gs_graph/ad_preview.rb'
|
126
|
+
require 'gs_graph/album'
|
127
|
+
require 'gs_graph/app_request'
|
128
|
+
require 'gs_graph/application'
|
129
|
+
require 'gs_graph/checkin'
|
130
|
+
require 'gs_graph/comment'
|
131
|
+
require 'gs_graph/doc'
|
132
|
+
require 'gs_graph/domain'
|
133
|
+
require 'gs_graph/event'
|
134
|
+
require 'gs_graph/friend_list'
|
135
|
+
require 'gs_graph/friend_request'
|
136
|
+
require 'gs_graph/group'
|
137
|
+
require 'gs_graph/image'
|
138
|
+
require 'gs_graph/insight'
|
139
|
+
require 'gs_graph/link'
|
140
|
+
require 'gs_graph/message'
|
141
|
+
require 'gs_graph/milestone'
|
142
|
+
require 'gs_graph/note'
|
143
|
+
require 'gs_graph/notification'
|
144
|
+
require 'gs_graph/order'
|
145
|
+
require 'gs_graph/page'
|
146
|
+
require 'gs_graph/photo'
|
147
|
+
require 'gs_graph/cover'
|
148
|
+
require 'gs_graph/place'
|
149
|
+
require 'gs_graph/post'
|
150
|
+
require 'gs_graph/promotable_post'
|
151
|
+
require 'gs_graph/property'
|
152
|
+
require 'gs_graph/question'
|
153
|
+
require 'gs_graph/question_option'
|
154
|
+
require 'gs_graph/score'
|
155
|
+
require 'gs_graph/status'
|
156
|
+
require 'gs_graph/tab'
|
157
|
+
require 'gs_graph/tag'
|
158
|
+
require 'gs_graph/tagged_object'
|
159
|
+
require 'gs_graph/thread'
|
160
|
+
require 'gs_graph/user'
|
161
|
+
require 'gs_graph/user_achievement'
|
162
|
+
require 'gs_graph/video'
|
163
|
+
require 'gs_graph/offer'
|
164
|
+
|
165
|
+
# Load after GSGraph::User
|
166
|
+
require 'gs_graph/ad_user'
|
167
|
+
require 'gs_graph/test_user'
|
168
|
+
|
169
|
+
require 'gs_graph/klass'
|
170
|
+
require 'gs_graph/project'
|
171
|
+
|
172
|
+
require 'gs_graph/query'
|
173
|
+
|
174
|
+
require 'patch/rack/oauth2/access_token/introspectable'
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module GSGraph
|
2
|
+
class Achievement < Node
|
3
|
+
attr_accessor :type, :application, :title, :url, :description, :image, :images, :data, :updated_time, :context, :points, :display_order
|
4
|
+
|
5
|
+
def initialize(identifier, attributes = {})
|
6
|
+
super
|
7
|
+
|
8
|
+
# TODO: Handle data, context in smarter way.
|
9
|
+
[:type, :title, :url, :description, :data, :context].each do |key|
|
10
|
+
GSGraph send "#{key}=", attributes[key]
|
11
|
+
end
|
12
|
+
|
13
|
+
if self.data
|
14
|
+
@points = self.data[:points]
|
15
|
+
end
|
16
|
+
|
17
|
+
if self.context
|
18
|
+
@display_order = self.context[:display_order]
|
19
|
+
end
|
20
|
+
|
21
|
+
@images = []
|
22
|
+
if _images_ = attributes[:image]
|
23
|
+
_images_.each do |_image_|
|
24
|
+
@images << _image_[:url]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
@image = @images.first
|
28
|
+
|
29
|
+
if application = attributes[:application]
|
30
|
+
application[:link] = application[:url] # for some reason, FB uses "url" only here..
|
31
|
+
@application = Application.new(application[:id], application)
|
32
|
+
end
|
33
|
+
|
34
|
+
if attributes[:updated_time]
|
35
|
+
@updated_time = Time.parse(attributes[:updated_time]).utc
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def destroy(options = {})
|
40
|
+
options[:access_token] ||= self.access_token
|
41
|
+
application.unregister_achievement!(url, options)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module GSGraph
|
2
|
+
class AdAccount < Node
|
3
|
+
include Connections::AdCampaigns
|
4
|
+
include Connections::AdGroups
|
5
|
+
include Connections::AdCampaignStats
|
6
|
+
include Connections::AdGroupStats
|
7
|
+
include Connections::BroadTargetingCategories
|
8
|
+
include Connections::ReachEstimates
|
9
|
+
include Connections::AdConnectionObjects
|
10
|
+
include Connections::AdPreviews
|
11
|
+
|
12
|
+
ATTRS = [
|
13
|
+
:account_id,
|
14
|
+
:name,
|
15
|
+
:account_status,
|
16
|
+
:daily_spend_limit,
|
17
|
+
:users,
|
18
|
+
:currency,
|
19
|
+
:timezone_id,
|
20
|
+
:timezone_name,
|
21
|
+
:capabilities,
|
22
|
+
:account_groups,
|
23
|
+
:is_personal,
|
24
|
+
:business_name,
|
25
|
+
:business_street,
|
26
|
+
:business_street2,
|
27
|
+
:business_city,
|
28
|
+
:business_state,
|
29
|
+
:business_zip,
|
30
|
+
:business_country_code,
|
31
|
+
:vat_status,
|
32
|
+
:agency_client_declaration,
|
33
|
+
:spend_cap,
|
34
|
+
:amount_spent
|
35
|
+
]
|
36
|
+
|
37
|
+
attr_accessor *ATTRS
|
38
|
+
|
39
|
+
def initialize(identifier, attributes = {})
|
40
|
+
super
|
41
|
+
|
42
|
+
ATTRS.each do |field|
|
43
|
+
send("#{field}=", attributes[field.to_sym])
|
44
|
+
end
|
45
|
+
|
46
|
+
if attributes[:users]
|
47
|
+
self.users = attributes[:users].collect { |u| GSGraph::AdUser.new(u["uid"], u) }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module GSGraph
|
2
|
+
class AdCampaign < Node
|
3
|
+
include Connections::AdGroups
|
4
|
+
|
5
|
+
attr_accessor :campaign_id, :account_id, :name, :start_time, :end_time, :updated_time, :daily_budget, :daily_imps, :campaign_status, :lifetime_budget, :lifetime_imps
|
6
|
+
|
7
|
+
def initialize(identifier, attributes = {})
|
8
|
+
super
|
9
|
+
set_attrs(attributes)
|
10
|
+
end
|
11
|
+
|
12
|
+
def update(options)
|
13
|
+
response = super(options)
|
14
|
+
|
15
|
+
if options[:redownload]
|
16
|
+
attributes = options.merge(response[:data][:campaigns][identifier]).with_indifferent_access
|
17
|
+
set_attrs(attributes)
|
18
|
+
end
|
19
|
+
|
20
|
+
response
|
21
|
+
end
|
22
|
+
|
23
|
+
protected
|
24
|
+
|
25
|
+
def set_attrs(attributes)
|
26
|
+
%w(campaign_id account_id name daily_budget daily_imps campaign_status lifetime_budget lifetime_imps).each do |field|
|
27
|
+
send("#{field}=", attributes[field.to_sym])
|
28
|
+
end
|
29
|
+
|
30
|
+
%w(start_time end_time updated_time).each do |field|
|
31
|
+
if val = attributes[field.to_sym]
|
32
|
+
# Handles integer timestamps and ISO8601 strings
|
33
|
+
time = Time.parse(val) rescue Time.at(val.to_i)
|
34
|
+
send("#{field}=", time)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module GSGraph
|
2
|
+
class AdCampaignStat < Node
|
3
|
+
attr_accessor :start_time, :end_time, :campaign_id, :impressions, :clicks, :spent, :social_impressions, :social_clicks, :social_spent,
|
4
|
+
:actions, :unique_impressions, :social_unique_impressions, :unique_clicks, :social_unique_clicks, :connections
|
5
|
+
|
6
|
+
def initialize(identifier, attributes = {})
|
7
|
+
super
|
8
|
+
|
9
|
+
%w(campaign_id impressions clicks spent social_impressions social_clicks social_spent actions unique_impressions social_unique_impressions unique_clicks social_unique_clicks connections).each do |field|
|
10
|
+
send("#{field}=", attributes[field.to_sym])
|
11
|
+
end
|
12
|
+
|
13
|
+
%w(start_time end_time).each do |field|
|
14
|
+
if val = attributes[field.to_sym]
|
15
|
+
# Handles integer timestamps and ISO8601 strings
|
16
|
+
time = Time.parse(val) rescue Time.at(val.to_i)
|
17
|
+
send("#{field}=", time)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module GSGraph
|
2
|
+
class AdConnectionObject < Node
|
3
|
+
attr_accessor :name, :url, :type, :tabs, :picture, :object, :is_game, :og_actions, :og_namespace, :og_objects, :supported_platforms
|
4
|
+
|
5
|
+
TYPES = {
|
6
|
+
:page => 1,
|
7
|
+
:application => 2,
|
8
|
+
:event => 3,
|
9
|
+
:place => 6,
|
10
|
+
:domain => 7
|
11
|
+
}
|
12
|
+
|
13
|
+
SUPPORTED_PLATFORM_TYPES = {
|
14
|
+
:web => 1,
|
15
|
+
:canvas => 2,
|
16
|
+
:mobile_web => 3,
|
17
|
+
:iphone => 4,
|
18
|
+
:ipad => 5,
|
19
|
+
:android => 6
|
20
|
+
}
|
21
|
+
|
22
|
+
def initialize(identifier, attributes = {})
|
23
|
+
super
|
24
|
+
|
25
|
+
%w(name url type tabs picture).each do |field|
|
26
|
+
send("#{field}=", attributes[field.to_sym])
|
27
|
+
end
|
28
|
+
|
29
|
+
if self.type == TYPES[:application]
|
30
|
+
%w(is_game og_actions og_namespace og_objects supported_platforms).each do |field|
|
31
|
+
send("#{field}=", attributes[field.to_sym])
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
self.object = if page?
|
36
|
+
GSGraph::Page.new(identifier)
|
37
|
+
elsif application?
|
38
|
+
GSGraph::Application.new(identifier)
|
39
|
+
elsif event?
|
40
|
+
GSGraph::Event.new(identifier)
|
41
|
+
elsif place?
|
42
|
+
GSGraph::Place.new(identifier)
|
43
|
+
elsif domain?
|
44
|
+
GSGraph::Domain.new(identifier)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Defines methods for page?, application?, event? and so forth
|
49
|
+
TYPES.keys.each do |object_type|
|
50
|
+
define_method("#{object_type}?") { type == TYPES[object_type] }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module GSGraph
|
2
|
+
class AdCreative < Node
|
3
|
+
|
4
|
+
ATTRS = [
|
5
|
+
:id,
|
6
|
+
:view_tag,
|
7
|
+
:alt_view_tags,
|
8
|
+
:creative_id,
|
9
|
+
:type,
|
10
|
+
:title,
|
11
|
+
:body,
|
12
|
+
:image_hash,
|
13
|
+
:link_url,
|
14
|
+
:name,
|
15
|
+
:run_status,
|
16
|
+
:preview_url,
|
17
|
+
:count_current_adgroups,
|
18
|
+
:facebook_object_id, # can't use object_id since it's a core ruby method
|
19
|
+
:story_id,
|
20
|
+
:image_url,
|
21
|
+
:url_tags,
|
22
|
+
:related_fan_page,
|
23
|
+
:auto_update,
|
24
|
+
:action_spec,
|
25
|
+
:query_templates
|
26
|
+
]
|
27
|
+
|
28
|
+
attr_accessor *ATTRS
|
29
|
+
def initialize(identifier, attributes = {})
|
30
|
+
super
|
31
|
+
set_attrs(attributes)
|
32
|
+
end
|
33
|
+
|
34
|
+
protected
|
35
|
+
|
36
|
+
def set_attrs(attributes)
|
37
|
+
ATTRS.each do |field|
|
38
|
+
send("#{field}=", attributes[field.to_sym])
|
39
|
+
end
|
40
|
+
self.facebook_object_id = attributes[:object_id]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|