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,32 @@
|
|
1
|
+
module GSGraph
|
2
|
+
class Note < Node
|
3
|
+
include Connections::Comments
|
4
|
+
include Connections::Likes
|
5
|
+
include Connections::Likes::Likable
|
6
|
+
|
7
|
+
attr_accessor :from, :subject, :message, :created_time, :updated_time, :icon
|
8
|
+
|
9
|
+
def initialize(identifier, attributes = {})
|
10
|
+
super
|
11
|
+
if (from = attributes[:from])
|
12
|
+
@from = if from[:category]
|
13
|
+
Page.new(from[:id], from)
|
14
|
+
else
|
15
|
+
User.new(from[:id], from)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
@subject = attributes[:subject]
|
19
|
+
@message = attributes[:message]
|
20
|
+
if attributes[:created_time]
|
21
|
+
@created_time = Time.parse(attributes[:created_time]).utc
|
22
|
+
end
|
23
|
+
if attributes[:updated_time]
|
24
|
+
@updated_time = Time.parse(attributes[:updated_time]).utc
|
25
|
+
end
|
26
|
+
@icon = attributes[:icon]
|
27
|
+
|
28
|
+
# cached connection
|
29
|
+
cache_collection attributes, :comments
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module GSGraph
|
2
|
+
class Notification < Node
|
3
|
+
attr_accessor :application, :from, :to, :title, :message, :link, :unread, :created_time, :updated_time
|
4
|
+
|
5
|
+
def initialize(identifier, attributes = {})
|
6
|
+
super
|
7
|
+
@title = attributes[:title]
|
8
|
+
@message = attributes[:message]
|
9
|
+
@link = attributes[:link]
|
10
|
+
@unread = attributes[:unread] == 1
|
11
|
+
if (application = attributes[:application])
|
12
|
+
@application = Application.new(application[:id], application)
|
13
|
+
end
|
14
|
+
if (from = attributes[:from])
|
15
|
+
@from = User.new(from[:id], from)
|
16
|
+
end
|
17
|
+
if (to = attributes[:to])
|
18
|
+
@to = User.new(to[:id], to)
|
19
|
+
end
|
20
|
+
if attributes[:created_time]
|
21
|
+
@created_time = Time.parse(attributes[:created_time]).utc
|
22
|
+
end
|
23
|
+
if attributes[:updated_time]
|
24
|
+
@updated_time = Time.parse(attributes[:updated_time]).utc
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def read!(options = {})
|
29
|
+
post options.merge(:unread => false)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module GSGraph
|
2
|
+
class Offer < Node
|
3
|
+
extend Searchable
|
4
|
+
|
5
|
+
ATTRS = [ :from,
|
6
|
+
:title,
|
7
|
+
:created_time,
|
8
|
+
:expiration_time,
|
9
|
+
:terms,
|
10
|
+
:image_url,
|
11
|
+
:coupon_type,
|
12
|
+
:claim_limit,
|
13
|
+
:redemption_link,
|
14
|
+
:redemption_code]
|
15
|
+
|
16
|
+
attr_accessor *ATTRS
|
17
|
+
|
18
|
+
def initialize(identifier, attributes = {})
|
19
|
+
super
|
20
|
+
|
21
|
+
@from = Page.new(attributes[:from][:id], attributes[:from]) if attributes[:from]
|
22
|
+
@title = attributes[:title]
|
23
|
+
@created_time = Time.parse(attributes[:created_time]).utc if attributes[:created_time]
|
24
|
+
@expiration_time = Time.parse(attributes[:expiration_time]).utc
|
25
|
+
@terms = attributes[:terms] if attributes[:terms]
|
26
|
+
@image_url = attributes[:image_url] if attributes[:image_url]
|
27
|
+
@coupon_type = attributes[:coupon_type] if attributes[:coupon_type]
|
28
|
+
@claim_limit = attributes[:claim_limit] if attributes[:claim_limit]
|
29
|
+
@redemption_link = attributes[:redemption_link] if attributes[:redemption_link]
|
30
|
+
@redemption_code = attributes[:redemption_code] if attributes[:redemption_code]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module GSGraph
|
2
|
+
module OpenGraph
|
3
|
+
class Action < Node
|
4
|
+
include Connections::Comments
|
5
|
+
include Connections::Likes
|
6
|
+
include Connections::Likes::Likable
|
7
|
+
|
8
|
+
attr_accessor :type, :application, :from, :objects, :start_time, :end_time, :publish_time
|
9
|
+
attr_accessor :raw_attributes
|
10
|
+
|
11
|
+
def initialize(identifier, attributes = {})
|
12
|
+
super
|
13
|
+
@raw_attributes = attributes
|
14
|
+
@type = attributes[:type]
|
15
|
+
if application = attributes[:application]
|
16
|
+
@application = Application.new(application[:id], application)
|
17
|
+
end
|
18
|
+
if from = attributes[:from]
|
19
|
+
@from = User.new(from[:id], from)
|
20
|
+
end
|
21
|
+
@objects = {}
|
22
|
+
if attributes[:data]
|
23
|
+
attributes[:data].each do |key, _attributes_|
|
24
|
+
@objects[key] = case _attributes_
|
25
|
+
when Hash
|
26
|
+
Object.new _attributes_[:id], _attributes_
|
27
|
+
else
|
28
|
+
_attributes_
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
@objects = @objects.with_indifferent_access
|
33
|
+
[:start_time, :end_time, :publish_time].each do |key|
|
34
|
+
self.send "#{key}=", Time.parse(attributes[key]) if attributes[key]
|
35
|
+
end
|
36
|
+
|
37
|
+
# cached connection
|
38
|
+
cache_collections attributes, :comments, :likes
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module GSGraph
|
2
|
+
module OpenGraph
|
3
|
+
class Object < Node
|
4
|
+
attr_accessor :type, :application, :url, :title, :description, :images, :image, :site_name, :updated_time
|
5
|
+
attr_accessor :raw_attributes
|
6
|
+
|
7
|
+
def initialize(identifier, attributes = {})
|
8
|
+
super
|
9
|
+
@raw_attributes = attributes
|
10
|
+
[:type, :url, :title, :description, :site_name].each do |key|
|
11
|
+
self.send "#{key}=", attributes[key]
|
12
|
+
end
|
13
|
+
if application = attributes[:application]
|
14
|
+
@application = Application.new(application[:id], application)
|
15
|
+
end
|
16
|
+
@images = []
|
17
|
+
if attributes[:image]
|
18
|
+
attributes[:image].each do |image|
|
19
|
+
@images << image[:url]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
@image = @images.first
|
23
|
+
if attributes[:updated_time]
|
24
|
+
@updated_time = Time.parse attributes[:updated_time]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module GSGraph
|
2
|
+
module OpenGraph
|
3
|
+
module UserContext
|
4
|
+
def og_actions(action, options = {})
|
5
|
+
actions = self.connection(action, options)
|
6
|
+
actions.map! do |_action_|
|
7
|
+
Action.new _action_[:id], _action_.merge(
|
8
|
+
:access_token => options[:access_token] || self.access_token
|
9
|
+
)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def og_action!(action, options = {})
|
14
|
+
action = post options.merge(:connection => action)
|
15
|
+
Action.new action[:id], action.merge(
|
16
|
+
:access_token => options[:access_token] || self.access_token
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module GSGraph
|
2
|
+
class Order < Node
|
3
|
+
attr_accessor :application, :from, :to, :amount, :status, :country, :created_time, :updated_time
|
4
|
+
|
5
|
+
def initialize(identifier, attributes = {})
|
6
|
+
super
|
7
|
+
if app = attributes[:application]
|
8
|
+
@application = Application.new(app[:id], app)
|
9
|
+
end
|
10
|
+
if from = attributes[:from]
|
11
|
+
@from = User.new(from[:id], from)
|
12
|
+
end
|
13
|
+
if to = attributes[:to]
|
14
|
+
@to = User.new(to[:id], to)
|
15
|
+
end
|
16
|
+
@amount = attributes[:amount]
|
17
|
+
@status = attributes[:status]
|
18
|
+
@country = attributes[:country]
|
19
|
+
if attributes[:created_time]
|
20
|
+
@created_time = Time.parse(attributes[:created_time]).utc
|
21
|
+
end
|
22
|
+
if attributes[:updated_time]
|
23
|
+
@updated_time = Time.parse(attributes[:updated_time]).utc
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def settle!(options = {})
|
28
|
+
update options.merge(:status => :settled)
|
29
|
+
end
|
30
|
+
alias_method :settled!, :settle!
|
31
|
+
|
32
|
+
def refund!(options = {})
|
33
|
+
update options.merge(:status => :refunded)
|
34
|
+
end
|
35
|
+
alias_method :refunded!, :refund!
|
36
|
+
|
37
|
+
def cancel!(options = {})
|
38
|
+
update options.merge(:status => :canceled)
|
39
|
+
end
|
40
|
+
alias_method :canceled!, :cancel!
|
41
|
+
|
42
|
+
def update(attributes = {})
|
43
|
+
_attributes_ = attributes.dup
|
44
|
+
params = {
|
45
|
+
:access_token => _attributes_.delete(:access_token) || self.access_token,
|
46
|
+
:status => _attributes_.delete(:status),
|
47
|
+
:message => _attributes_.delete(:message),
|
48
|
+
:refund_funding_source => _attributes_.delete(:refund_funding_source),
|
49
|
+
:refund_reason => _attributes_.delete(:refund_reason),
|
50
|
+
:params => _attributes_
|
51
|
+
}
|
52
|
+
super params
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module GSGraph
|
2
|
+
class Page < Node
|
3
|
+
include Connections::Admins
|
4
|
+
include Connections::Albums
|
5
|
+
include Connections::Blocked
|
6
|
+
include Connections::Checkins
|
7
|
+
include Connections::Conversations
|
8
|
+
include Connections::Events
|
9
|
+
include Connections::Feed
|
10
|
+
include Connections::Groups
|
11
|
+
include Connections::Insights
|
12
|
+
include Connections::Likes
|
13
|
+
include Connections::Links
|
14
|
+
include Connections::Milestones
|
15
|
+
include Connections::Notes
|
16
|
+
include Connections::Photos
|
17
|
+
include Connections::Picture
|
18
|
+
include Connections::Picture::Updatable
|
19
|
+
include Connections::Posts
|
20
|
+
include Connections::PromotablePosts
|
21
|
+
include Connections::Questions
|
22
|
+
include Connections::Settings
|
23
|
+
include Connections::Statuses
|
24
|
+
include Connections::Tabs
|
25
|
+
include Connections::Tagged
|
26
|
+
include Connections::Videos
|
27
|
+
include Connections::Offers
|
28
|
+
extend Searchable
|
29
|
+
|
30
|
+
@@attributes = {
|
31
|
+
:raw => [:name, :username, :category, :link, :talking_about_count, :perms, :is_published, :can_post],
|
32
|
+
:custom => [:cover, :like_count]
|
33
|
+
}
|
34
|
+
|
35
|
+
attr_accessor *@@attributes.values.flatten
|
36
|
+
|
37
|
+
def initialize(identifier, attributes = {})
|
38
|
+
super
|
39
|
+
@@attributes[:raw].each do |key|
|
40
|
+
self.send :"#{key}=", attributes[key]
|
41
|
+
end
|
42
|
+
@link ||= "https://www.gamestamper.com/#{username || identifier}"
|
43
|
+
@like_count = attributes[:likes] || attributes[:fan_count]
|
44
|
+
@cover = if (cover = attributes[:cover])
|
45
|
+
Cover.new cover[:cover_id], cover
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def get_access_token(options = {})
|
50
|
+
access_token = get options.merge(:fields => "access_token")
|
51
|
+
self.access_token = Rack::OAuth2::AccessToken::Legacy.new access_token
|
52
|
+
end
|
53
|
+
alias_method :page_access_token, :get_access_token
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
require 'gs_graph/page/category_attributes'
|
@@ -0,0 +1,117 @@
|
|
1
|
+
module GSGraph
|
2
|
+
class Page
|
3
|
+
module CategoryAttributes
|
4
|
+
@@category_attributes = {}
|
5
|
+
@@category_attributes[:raw] = [
|
6
|
+
:affiliation,
|
7
|
+
:artists_we_like,
|
8
|
+
:attire,
|
9
|
+
:awards,
|
10
|
+
:band_interests,
|
11
|
+
:band_members,
|
12
|
+
:bio,
|
13
|
+
:booking_agent,
|
14
|
+
:company_overview,
|
15
|
+
:culinary_team,
|
16
|
+
:current_location,
|
17
|
+
:directed_by,
|
18
|
+
:features,
|
19
|
+
:general_info,
|
20
|
+
:general_manager,
|
21
|
+
:genre,
|
22
|
+
:hometown,
|
23
|
+
:influences,
|
24
|
+
:is_community_page,
|
25
|
+
:location,
|
26
|
+
:mission,
|
27
|
+
:mpg,
|
28
|
+
:personal_info,
|
29
|
+
:personal_interests,
|
30
|
+
:phone,
|
31
|
+
:plot_outline,
|
32
|
+
:press_contact,
|
33
|
+
:price_range,
|
34
|
+
:produced_by,
|
35
|
+
:products,
|
36
|
+
:public_transit,
|
37
|
+
:record_label,
|
38
|
+
:screenplay_by,
|
39
|
+
:starring,
|
40
|
+
:studio,
|
41
|
+
:website,
|
42
|
+
:written_by
|
43
|
+
]
|
44
|
+
@@category_attributes[:symbols] = [
|
45
|
+
:parking,
|
46
|
+
:payment_options,
|
47
|
+
:restaurant_services,
|
48
|
+
:restaurant_specialties
|
49
|
+
]
|
50
|
+
@@category_attributes[:date] = [
|
51
|
+
:birthday,
|
52
|
+
:built,
|
53
|
+
:founded,
|
54
|
+
:release_date
|
55
|
+
]
|
56
|
+
@@category_attributes[:others] = [
|
57
|
+
:checkin_count,
|
58
|
+
:hours,
|
59
|
+
:location
|
60
|
+
]
|
61
|
+
attr_accessor *@@category_attributes.values.flatten
|
62
|
+
|
63
|
+
def self.included(klass)
|
64
|
+
klass.alias_method_chain :initialize, :category_specific_attributes
|
65
|
+
end
|
66
|
+
|
67
|
+
def initialize_with_category_specific_attributes(identifier, attributes = {})
|
68
|
+
initialize_without_category_specific_attributes identifier, attributes
|
69
|
+
@@category_attributes[:raw].each do |key|
|
70
|
+
self.send :"#{key}=", attributes[key]
|
71
|
+
end
|
72
|
+
|
73
|
+
@@category_attributes[:symbols].each do |key|
|
74
|
+
self.send :"#{key}=", []
|
75
|
+
if attributes[key]
|
76
|
+
self.send :"#{key}=", attributes[key].keys.collect(&:to_sym)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
@@category_attributes[:date].each do |key|
|
80
|
+
date = if attributes[key]
|
81
|
+
begin
|
82
|
+
Date.parse attributes[key]
|
83
|
+
rescue
|
84
|
+
attributes[key]
|
85
|
+
end
|
86
|
+
end
|
87
|
+
self.send :"#{key}=", date
|
88
|
+
end
|
89
|
+
@checkin_count = attributes[:checkins]
|
90
|
+
@hours = {}
|
91
|
+
if attributes[:hours]
|
92
|
+
attributes[:hours].each do |key, value|
|
93
|
+
date, index, mode = key.split('_')
|
94
|
+
index = index.to_i - 1
|
95
|
+
date, mode = date.to_sym, mode.to_sym
|
96
|
+
if value.class == Fixnum
|
97
|
+
# The Unix "time" returned is a weird approximation of the string value.
|
98
|
+
# Example: "20:00" might be represented as 446400, which is 1970-01-05T20:00:00-08:00
|
99
|
+
time = Time.at(value).in_time_zone("Pacific Time (US & Canada)")
|
100
|
+
else
|
101
|
+
time = Time.parse(value)
|
102
|
+
end
|
103
|
+
time = Time.utc(1970, 1, 1, time.hour, time.min)
|
104
|
+
@hours[date] ||= []
|
105
|
+
@hours[date][index] ||= {}
|
106
|
+
@hours[date][index][mode] = time
|
107
|
+
end
|
108
|
+
end
|
109
|
+
if attributes[:location]
|
110
|
+
@location = Venue.new(attributes[:location])
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
include CategoryAttributes
|
116
|
+
end
|
117
|
+
end
|