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,85 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Photo, '.new' do
|
4
|
+
|
5
|
+
it 'should setup all supported attributes' do
|
6
|
+
attributes = {
|
7
|
+
:id => '12345',
|
8
|
+
:from => {
|
9
|
+
:id => '23456',
|
10
|
+
:name => 'nov matake'
|
11
|
+
},
|
12
|
+
:tags => {
|
13
|
+
:data => [{
|
14
|
+
:id => '12345',
|
15
|
+
:name => 'nov matake',
|
16
|
+
:x => 32.5,
|
17
|
+
:y => 27.7778,
|
18
|
+
:created_time => '2010-01-10T15:37:40+0000'
|
19
|
+
}]
|
20
|
+
},
|
21
|
+
:images => [{
|
22
|
+
:height => 483,
|
23
|
+
:width => 720,
|
24
|
+
:source => "https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-ash1/168119_10150146071831729_20531316728_7844072_5116892_n.jpg"
|
25
|
+
},
|
26
|
+
{
|
27
|
+
:height => 120,
|
28
|
+
:width => 180,
|
29
|
+
:source => "https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash1/168119_10150146071831729_20531316728_7844072_5116892_a.jpg"
|
30
|
+
},
|
31
|
+
{
|
32
|
+
:height => 87,
|
33
|
+
:width => 130,
|
34
|
+
:source => "https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash1/168119_10150146071831729_20531316728_7844072_5116892_s.jpg"
|
35
|
+
},
|
36
|
+
{
|
37
|
+
:height => 50,
|
38
|
+
:width => 75,
|
39
|
+
:source => "https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash1/168119_10150146071831729_20531316728_7844072_5116892_t.jpg"
|
40
|
+
}],
|
41
|
+
:name => 'photo 1',
|
42
|
+
:picture => 'http://www.gamestamper.com/matake/picture/album_size',
|
43
|
+
:icon => 'http://static.ak.fbcdn.net/rsrc.php/z2E5Y/hash/8as8iqdm.gif',
|
44
|
+
:source => 'http://www.gamestamper.com/matake/picture/original_size',
|
45
|
+
:height => 100,
|
46
|
+
:width => 200,
|
47
|
+
:link => 'http://www.gamestamper.com/photo/12345',
|
48
|
+
:created_time => '2010-01-02T15:37:40+0000',
|
49
|
+
:updated_time => '2010-01-02T15:37:41+0000'
|
50
|
+
}
|
51
|
+
photo = GSGraph::Photo.new(attributes.delete(:id), attributes)
|
52
|
+
photo.identifier.should == '12345'
|
53
|
+
photo.from.should == GSGraph::User.new('23456', :name => 'nov matake')
|
54
|
+
photo.tags.should == [GSGraph::Tag.new(
|
55
|
+
:id => '12345',
|
56
|
+
:name => 'nov matake',
|
57
|
+
:x => 32.5,
|
58
|
+
:y => 27.7778,
|
59
|
+
:created_time => '2010-01-10T15:37:40+0000'
|
60
|
+
)]
|
61
|
+
photo.images.first.should == GSGraph::Image.new(
|
62
|
+
:height => 483,
|
63
|
+
:width => 720,
|
64
|
+
:source => "https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-ash1/168119_10150146071831729_20531316728_7844072_5116892_n.jpg"
|
65
|
+
)
|
66
|
+
photo.picture.should == 'https://graph.gamestamper.com/12345/picture'
|
67
|
+
photo.icon.should == 'http://static.ak.fbcdn.net/rsrc.php/z2E5Y/hash/8as8iqdm.gif'
|
68
|
+
photo.source.should == 'http://www.gamestamper.com/matake/picture/original_size'
|
69
|
+
photo.height.should == 100
|
70
|
+
photo.width.should == 200
|
71
|
+
photo.link.should == 'http://www.gamestamper.com/photo/12345'
|
72
|
+
photo.created_time.should == Time.parse('2010-01-02T15:37:40+0000')
|
73
|
+
photo.updated_time.should == Time.parse('2010-01-02T15:37:41+0000')
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'should support page as from' do
|
77
|
+
page_photo = GSGraph::Photo.new('12345', :from => {
|
78
|
+
:id => '23456',
|
79
|
+
:name => 'Smart.fm',
|
80
|
+
:category => 'Web Site'
|
81
|
+
})
|
82
|
+
page_photo.from.should == GSGraph::Page.new('23456', :name => 'Smart.fm', :category => 'Web Site')
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
@@ -0,0 +1,238 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Post, '.new' do
|
4
|
+
it 'should setup all supported attributes' do
|
5
|
+
attributes = {
|
6
|
+
:id => "579612276_10150089741782277",
|
7
|
+
:message => "hello",
|
8
|
+
:from => {
|
9
|
+
:name => "Nov Matake",
|
10
|
+
:id => "579612276"
|
11
|
+
},
|
12
|
+
:to => {
|
13
|
+
:data => [{
|
14
|
+
:name => "Jr Nov",
|
15
|
+
:id => "1575327134"
|
16
|
+
}]
|
17
|
+
},
|
18
|
+
:with_tags => {
|
19
|
+
:data => [{
|
20
|
+
:name => "Jr Nov",
|
21
|
+
:id => "1575327134"
|
22
|
+
}]
|
23
|
+
},
|
24
|
+
:icon => "http://photos-d.ak.fbcdn.net/photos-ak-snc1/v27562/23/2231777543/app_2_2231777543_9553.gif",
|
25
|
+
:type => "status",
|
26
|
+
:object_id => "12345",
|
27
|
+
:actions => [{
|
28
|
+
:name => "Comment",
|
29
|
+
:link => "http://www.gamestamper.com/579612276/posts/10150089741782277"
|
30
|
+
}, {
|
31
|
+
:name => "Like",
|
32
|
+
:link => "http://www.gamestamper.com/579612276/posts/10150089741782277"
|
33
|
+
}, {
|
34
|
+
:name => "@nov on Twitter",
|
35
|
+
:link => "http://twitter.com/nov?utm_source=fb&utm_medium=fb&utm_campaign=nov&utm_content=19294280413614080"
|
36
|
+
}],
|
37
|
+
:application => {
|
38
|
+
:name => "Twitter",
|
39
|
+
:id => "2231777543"
|
40
|
+
},
|
41
|
+
:properties => [
|
42
|
+
{
|
43
|
+
:name => "Source",
|
44
|
+
:text => "TechCrunch Japan",
|
45
|
+
:href => "http://jp.techcrunch.com/"
|
46
|
+
},
|
47
|
+
{
|
48
|
+
:name => "Published",
|
49
|
+
:text => "2011-06-22 05:11:18 GMT"
|
50
|
+
}
|
51
|
+
],
|
52
|
+
:privacy => {
|
53
|
+
:value => "EVERYONE",
|
54
|
+
:description => "Everyone"
|
55
|
+
},
|
56
|
+
:targeting => {
|
57
|
+
:country => 'ja'
|
58
|
+
},
|
59
|
+
:created_time => "2010-12-27T07:31:30+0000",
|
60
|
+
:updated_time => "2010-12-27T07:31:30+0000"
|
61
|
+
}
|
62
|
+
post = GSGraph::Post.new(attributes.delete(:id), attributes)
|
63
|
+
post.identifier.should == '579612276_10150089741782277'
|
64
|
+
post.message.should == 'hello'
|
65
|
+
post.from.should == GSGraph::User.new("579612276", :name => 'Nov Matake')
|
66
|
+
post.to.first.should == GSGraph::User.new("1575327134", :name => 'Jr Nov')
|
67
|
+
post.with_tags.first.should == GSGraph::User.new("1575327134", :name => 'Jr Nov')
|
68
|
+
post.icon.should == 'http://photos-d.ak.fbcdn.net/photos-ak-snc1/v27562/23/2231777543/app_2_2231777543_9553.gif'
|
69
|
+
post.type.should == 'status'
|
70
|
+
post.graph_object_id.should == '12345'
|
71
|
+
post.properties.each do |property|
|
72
|
+
property.should be_a GSGraph::Property
|
73
|
+
end
|
74
|
+
post.actions.should == [
|
75
|
+
GSGraph::Action.new(
|
76
|
+
:name => "Comment",
|
77
|
+
:link => "http://www.gamestamper.com/579612276/posts/10150089741782277"
|
78
|
+
),
|
79
|
+
GSGraph::Action.new(
|
80
|
+
:name => "Like",
|
81
|
+
:link => "http://www.gamestamper.com/579612276/posts/10150089741782277"
|
82
|
+
),
|
83
|
+
GSGraph::Action.new(
|
84
|
+
:name => "@nov on Twitter",
|
85
|
+
:link => "http://twitter.com/nov?utm_source=fb&utm_medium=fb&utm_campaign=nov&utm_content=19294280413614080"
|
86
|
+
)
|
87
|
+
]
|
88
|
+
post.application.should == GSGraph::Application.new(
|
89
|
+
"2231777543",
|
90
|
+
:name => "Twitter"
|
91
|
+
)
|
92
|
+
post.privacy.should == GSGraph::Privacy.new(
|
93
|
+
:value => "EVERYONE",
|
94
|
+
:description => "Everyone"
|
95
|
+
)
|
96
|
+
post.targeting.should == GSGraph::Targeting.new(
|
97
|
+
:country => 'ja'
|
98
|
+
)
|
99
|
+
post.created_time.should == Time.parse("2010-12-27T07:31:30+0000")
|
100
|
+
post.updated_time.should == Time.parse("2010-12-27T07:31:30+0000")
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'should support GSGraph::Privacy as privacy' do
|
104
|
+
post = GSGraph::Post.new(12345, :privacy => GSGraph::Privacy.new(:value => 'EVERYONE'))
|
105
|
+
post.privacy.should == GSGraph::Privacy.new(:value => 'EVERYONE')
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'should support GSGraph::Targeting as targeting' do
|
109
|
+
post = GSGraph::Post.new(12345, :targeting => GSGraph::Targeting.new(:country => 'ja'))
|
110
|
+
post.targeting.should == GSGraph::Targeting.new(:country => 'ja')
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'should support page as from' do
|
114
|
+
page_post = GSGraph::Post.new('12345', :from => {
|
115
|
+
:id => '23456',
|
116
|
+
:name => 'Smart.fm',
|
117
|
+
:category => 'Web Site'
|
118
|
+
}, :message => 'Hello')
|
119
|
+
page_post.from.should == GSGraph::Page.new('23456', :name => 'Smart.fm', :category => 'Web Site')
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'should support page as to' do
|
123
|
+
page_post = GSGraph::Post.new('12345', :to => {:data => [
|
124
|
+
:id => '23456',
|
125
|
+
:name => 'Smart.fm',
|
126
|
+
:category => 'Web Site'
|
127
|
+
]}, :message => 'Hello')
|
128
|
+
page_post.to.first.should == GSGraph::Page.new('23456', :name => 'Smart.fm', :category => 'Web Site')
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
describe GSGraph::Post, '#fetch' do
|
133
|
+
|
134
|
+
context 'when no access_token given' do
|
135
|
+
it 'should get all attributes except some comments' do
|
136
|
+
mock_graph :get, 'platform', 'posts/platform_public' do
|
137
|
+
post = GSGraph::Post.fetch('platform')
|
138
|
+
post.identifier.should == '19292868552_118464504835613'
|
139
|
+
post.from.should == GSGraph::Page.new(
|
140
|
+
"19292868552",
|
141
|
+
:name => "Facebook Platform",
|
142
|
+
:category => "Technology"
|
143
|
+
)
|
144
|
+
post.message.should == "We're getting ready for f8! Check out the latest on the f8 Page, including a video from the first event, when Platform launched :: http://bit.ly/ahHl7j"
|
145
|
+
post.likes.should == [
|
146
|
+
GSGraph::User.new("100000785546814", :name => "Anter Saied")
|
147
|
+
]
|
148
|
+
post.likes.collection.total_count.should == 270
|
149
|
+
post.created_time.should == Time.parse("2010-04-15T17:37:03+0000")
|
150
|
+
post.updated_time.should == Time.parse("2010-04-22T18:19:13+0000")
|
151
|
+
post.comments.size.should == 4
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
context 'when access_token given' do
|
157
|
+
it 'shold get all attributes and comments' do
|
158
|
+
mock_graph :get, 'platform', 'posts/platform_private', :access_token => 'access_token' do
|
159
|
+
post = GSGraph::Post.fetch('platform', :access_token => 'access_token')
|
160
|
+
post.identifier.should == '19292868552_118464504835613'
|
161
|
+
post.from.should == GSGraph::Page.new(
|
162
|
+
"19292868552",
|
163
|
+
:name => "Facebook Platform",
|
164
|
+
:category => "Technology"
|
165
|
+
)
|
166
|
+
post.message.should == "We're getting ready for f8! Check out the latest on the f8 Page, including a video from the first event, when Platform launched :: http://bit.ly/ahHl7j"
|
167
|
+
post.created_time.should == Time.parse("2010-04-15T17:37:03+0000")
|
168
|
+
post.updated_time.should == Time.parse("2010-04-22T18:19:13+0000")
|
169
|
+
post.comments.size.should == 9
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
context 'when include "story"' do
|
175
|
+
it 'should include story and story_tags' do
|
176
|
+
mock_graph :get, 'post_id', 'posts/with_story', :access_token => 'access_token' do
|
177
|
+
post = GSGraph::Post.fetch('post_id', :access_token => 'access_token')
|
178
|
+
post.story.should == 'Nov Matake likes Instagram JP.'
|
179
|
+
post.story_tags.should be_a Array
|
180
|
+
post.story_tags.each do |story_tag|
|
181
|
+
story_tag.should be_instance_of GSGraph::TaggedObject
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
context 'when include "story"' do
|
188
|
+
it 'should include message and message_tags' do
|
189
|
+
mock_graph :get, 'post_id', 'posts/with_message', :access_token => 'access_token' do
|
190
|
+
post = GSGraph::Post.fetch('post_id', :access_token => 'access_token')
|
191
|
+
post.message.should == 'testing status message with tagged people. Jr Nov'
|
192
|
+
post.message_tags.should be_a Array
|
193
|
+
post.message_tags.each do |message_tag|
|
194
|
+
message_tag.should be_instance_of GSGraph::TaggedObject
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
context 'when include "place"' do
|
201
|
+
it 'should include place as Venue' do
|
202
|
+
mock_graph :get, 'post_id', 'posts/with_place', :access_token => 'access_token' do
|
203
|
+
post = GSGraph::Post.fetch('post_id', :access_token => 'access_token')
|
204
|
+
place = post.place
|
205
|
+
place.should be_instance_of GSGraph::Place
|
206
|
+
place.identifier.should == '100563866688613'
|
207
|
+
place.name.should == 'Kawasaki-shi, Kanagawa, Japan'
|
208
|
+
location = place.location
|
209
|
+
location.should be_instance_of GSGraph::Venue
|
210
|
+
location.latitude.should == 35.5167
|
211
|
+
location.longitude.should == 139.7
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
describe GSGraph::Post, '#to' do
|
218
|
+
subject { post.to.first }
|
219
|
+
|
220
|
+
context 'when include Event' do
|
221
|
+
let :post do
|
222
|
+
mock_graph :get, 'to_event', 'posts/to_event' do
|
223
|
+
GSGraph::Post.fetch('to_event')
|
224
|
+
end
|
225
|
+
end
|
226
|
+
it { should be_instance_of GSGraph::Event }
|
227
|
+
end
|
228
|
+
|
229
|
+
context 'when include Group' do
|
230
|
+
let :post do
|
231
|
+
mock_graph :get, 'to_group', 'posts/to_group', :access_token => 'access_token' do
|
232
|
+
GSGraph::Post.fetch('to_group', :access_token => 'access_token')
|
233
|
+
end
|
234
|
+
end
|
235
|
+
it { should be_instance_of GSGraph::Group }
|
236
|
+
end
|
237
|
+
|
238
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Privacy, '.new' do
|
4
|
+
it 'should setup all supported attributes' do
|
5
|
+
attributes = {
|
6
|
+
:value => 'CUSTOM',
|
7
|
+
:friends => 'SOME_FRIENDS',
|
8
|
+
:networks => '123,456,789',
|
9
|
+
:allow => '999,888,777',
|
10
|
+
:deny => '000,111,222'
|
11
|
+
}
|
12
|
+
privacy = GSGraph::Privacy.new(attributes)
|
13
|
+
privacy.value.should == 'CUSTOM'
|
14
|
+
privacy.friends.should == 'SOME_FRIENDS'
|
15
|
+
privacy.networks.should == '123,456,789'
|
16
|
+
privacy.allow.should == '999,888,777'
|
17
|
+
privacy.deny.should == '000,111,222'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe GSGraph::Privacy, '.to_json' do
|
22
|
+
it 'should return JSON object' do
|
23
|
+
attributes = {
|
24
|
+
:value => 'CUSTOM',
|
25
|
+
:friends => 'SOME_FRIENDS',
|
26
|
+
:networks => '123,456,789',
|
27
|
+
:allow => '999,888,777',
|
28
|
+
:deny => '000,111,222'
|
29
|
+
}
|
30
|
+
privacy = GSGraph::Privacy.new(attributes)
|
31
|
+
privacy.to_json.should == attributes.to_json
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::Project, '.new' do
|
4
|
+
|
5
|
+
it 'should setup all supported attributes' do
|
6
|
+
attributes = {
|
7
|
+
:id => 184246058253896,
|
8
|
+
:name => "Drecom Blog",
|
9
|
+
:with => [{
|
10
|
+
:id => 1064067203,
|
11
|
+
:name => "Takanori Ishikawa"
|
12
|
+
}],
|
13
|
+
:start_date => "2008-04",
|
14
|
+
:end_date => "2008-09"
|
15
|
+
}
|
16
|
+
project = GSGraph::Project.new(attributes.delete(:id), attributes)
|
17
|
+
project.with.should == [GSGraph::User.new(1064067203, :name => "Takanori Ishikawa")]
|
18
|
+
project.start_date.should == Date.new(2008, 4)
|
19
|
+
project.end_date.should == Date.new(2008, 9)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should treat 2008-00 style date' do
|
23
|
+
attributes = {
|
24
|
+
:id => 184246058253896,
|
25
|
+
:name => "Drecom Blog",
|
26
|
+
:start_date => "2008-00",
|
27
|
+
:end_date => "2009-00"
|
28
|
+
}
|
29
|
+
project = GSGraph::Project.new(attributes.delete(:id), attributes)
|
30
|
+
project.start_date.should == Date.new(2008)
|
31
|
+
project.end_date.should == Date.new(2009)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should treat 2008 style date' do
|
35
|
+
attributes = {
|
36
|
+
:id => 184246058253896,
|
37
|
+
:name => "Drecom Blog",
|
38
|
+
:start_date => "2008",
|
39
|
+
:end_date => "2009"
|
40
|
+
}
|
41
|
+
project = GSGraph::Project.new(attributes.delete(:id), attributes)
|
42
|
+
project.start_date.should == Date.new(2008)
|
43
|
+
project.end_date.should == Date.new(2009)
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GSGraph::PromotablePost do
|
4
|
+
let(:published) { GSGraph::PromotablePost.new(12345, :is_published => true) }
|
5
|
+
let(:draft) { GSGraph::PromotablePost.new(12345, :is_published => false) }
|
6
|
+
let(:scheduled) { GSGraph::PromotablePost.new(12345, :is_published => false, :scheduled_publish_time => 2.days.from_now.to_i) }
|
7
|
+
|
8
|
+
context 'when published' do
|
9
|
+
subject { published }
|
10
|
+
its(:publishable?) { should be_false }
|
11
|
+
its(:scheduled?) { should be_false }
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'when draft' do
|
15
|
+
subject { draft }
|
16
|
+
its(:publishable?) { should be_true }
|
17
|
+
its(:scheduled?) { should be_false }
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'when scheduled' do
|
21
|
+
subject { scheduled }
|
22
|
+
its(:publishable?) { should be_true }
|
23
|
+
its(:scheduled?) { should be_true }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '.publish!' do
|
27
|
+
it 'should post with is_published=true' do
|
28
|
+
mock_graph :post, '12345', 'true', :access_token => 'page_token', :params => {
|
29
|
+
:is_published => 'true'
|
30
|
+
} do
|
31
|
+
draft.publish!(:access_token => 'page_token').should be_true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe '.schedule!' do
|
37
|
+
it 'should post with scheduled_publish_time=timestamp' do
|
38
|
+
scheduled_at = 2.days.from_now
|
39
|
+
mock_graph :post, '12345', 'true', :access_token => 'page_token', :params => {
|
40
|
+
:scheduled_publish_time => scheduled_at.to_i.to_s
|
41
|
+
} do
|
42
|
+
draft.schedule!(scheduled_at, :access_token => 'page_token').should be_true
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe '.unschedule!' do
|
48
|
+
it 'should post with scheduled_publish_time=0' do
|
49
|
+
scheduled_at = 2.days.from_now
|
50
|
+
mock_graph :post, '12345', 'true', :access_token => 'page_token', :params => {
|
51
|
+
:scheduled_publish_time => '0'
|
52
|
+
} do
|
53
|
+
scheduled.unschedule!(:access_token => 'page_token').should be_true
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|