palidanx-fb_graph 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. data/.document +5 -0
  2. data/.gitignore +21 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +308 -0
  5. data/Rakefile +49 -0
  6. data/VERSION +1 -0
  7. data/assets/fb_graph.ai +1726 -6
  8. data/assets/fb_graph.png +0 -0
  9. data/fb_graph.gemspec +327 -0
  10. data/lib/fb_graph.rb +75 -0
  11. data/lib/fb_graph/album.rb +133 -0
  12. data/lib/fb_graph/application.rb +57 -0
  13. data/lib/fb_graph/auth.rb +52 -0
  14. data/lib/fb_graph/auth/cookie.rb +43 -0
  15. data/lib/fb_graph/checkin.rb +44 -0
  16. data/lib/fb_graph/collection.rb +44 -0
  17. data/lib/fb_graph/comment.rb +20 -0
  18. data/lib/fb_graph/comparison.rb +9 -0
  19. data/lib/fb_graph/connection.rb +30 -0
  20. data/lib/fb_graph/connections.rb +3 -0
  21. data/lib/fb_graph/connections/accounts.rb +58 -0
  22. data/lib/fb_graph/connections/activities.rb +14 -0
  23. data/lib/fb_graph/connections/albums.rb +96 -0
  24. data/lib/fb_graph/connections/attending.rb +18 -0
  25. data/lib/fb_graph/connections/books.rb +14 -0
  26. data/lib/fb_graph/connections/checkins.rb +22 -0
  27. data/lib/fb_graph/connections/comments.rb +39 -0
  28. data/lib/fb_graph/connections/declined.rb +18 -0
  29. data/lib/fb_graph/connections/events.rb +21 -0
  30. data/lib/fb_graph/connections/feed.rb +90 -0
  31. data/lib/fb_graph/connections/friends.rb +14 -0
  32. data/lib/fb_graph/connections/groups.rb +14 -0
  33. data/lib/fb_graph/connections/home.rb +14 -0
  34. data/lib/fb_graph/connections/insights.rb +13 -0
  35. data/lib/fb_graph/connections/interests.rb +14 -0
  36. data/lib/fb_graph/connections/invited.rb +14 -0
  37. data/lib/fb_graph/connections/likes.rb +16 -0
  38. data/lib/fb_graph/connections/links.rb +21 -0
  39. data/lib/fb_graph/connections/maybe.rb +18 -0
  40. data/lib/fb_graph/connections/members.rb +14 -0
  41. data/lib/fb_graph/connections/movies.rb +14 -0
  42. data/lib/fb_graph/connections/music.rb +14 -0
  43. data/lib/fb_graph/connections/noreply.rb +14 -0
  44. data/lib/fb_graph/connections/notes.rb +21 -0
  45. data/lib/fb_graph/connections/photos.rb +21 -0
  46. data/lib/fb_graph/connections/picture.rb +14 -0
  47. data/lib/fb_graph/connections/posts.rb +14 -0
  48. data/lib/fb_graph/connections/statuses.rb +14 -0
  49. data/lib/fb_graph/connections/subscriptions.rb +53 -0
  50. data/lib/fb_graph/connections/tagged.rb +14 -0
  51. data/lib/fb_graph/connections/television.rb +14 -0
  52. data/lib/fb_graph/connections/videos.rb +14 -0
  53. data/lib/fb_graph/education.rb +25 -0
  54. data/lib/fb_graph/event.rb +47 -0
  55. data/lib/fb_graph/group.rb +27 -0
  56. data/lib/fb_graph/insight.rb +14 -0
  57. data/lib/fb_graph/link.rb +28 -0
  58. data/lib/fb_graph/node.rb +121 -0
  59. data/lib/fb_graph/note.rb +28 -0
  60. data/lib/fb_graph/page.rb +41 -0
  61. data/lib/fb_graph/photo.rb +41 -0
  62. data/lib/fb_graph/post.rb +50 -0
  63. data/lib/fb_graph/searchable.rb +25 -0
  64. data/lib/fb_graph/searchable/result.rb +31 -0
  65. data/lib/fb_graph/status.rb +23 -0
  66. data/lib/fb_graph/subscription.rb +14 -0
  67. data/lib/fb_graph/tag.rb +16 -0
  68. data/lib/fb_graph/user.rb +89 -0
  69. data/lib/fb_graph/venue.rb +17 -0
  70. data/lib/fb_graph/video.rb +28 -0
  71. data/lib/fb_graph/work.rb +35 -0
  72. data/spec/fake_json/albums/photos/matake_private.json +97 -0
  73. data/spec/fake_json/albums/photos/post_with_valid_access_token.json +1 -0
  74. data/spec/fake_json/applications/subscriptions/fb_graph_private.json +12 -0
  75. data/spec/fake_json/checkins/search_private.json +54 -0
  76. data/spec/fake_json/checkins/search_public.json +6 -0
  77. data/spec/fake_json/events/attending/post_with_valid_access_token.json +1 -0
  78. data/spec/fake_json/events/attending/smartday_private.json +44 -0
  79. data/spec/fake_json/events/declined/post_with_valid_access_token.json +1 -0
  80. data/spec/fake_json/events/declined/smartday_private.json +720 -0
  81. data/spec/fake_json/events/invited/smartday_private.json +7092 -0
  82. data/spec/fake_json/events/maybe/post_with_valid_access_token.json +1 -0
  83. data/spec/fake_json/events/maybe/smartday_private.json +956 -0
  84. data/spec/fake_json/events/noreply/smartday_private.json +896 -0
  85. data/spec/fake_json/groups/members/emacs_private.json +1996 -0
  86. data/spec/fake_json/pages/checkins/gowalla_private.json +113 -0
  87. data/spec/fake_json/pages/checkins/gowalla_public.json +6 -0
  88. data/spec/fake_json/pages/notes/post_with_valid_access_token.json +1 -0
  89. data/spec/fake_json/pages/platform_private.json +13 -0
  90. data/spec/fake_json/pages/platform_public.json +13 -0
  91. data/spec/fake_json/pages/statuses/platform_private.json +258 -0
  92. data/spec/fake_json/pages/statuses/platform_public.json +6 -0
  93. data/spec/fake_json/posts/comments/post_with_invalid_access_token.json +1 -0
  94. data/spec/fake_json/posts/comments/post_with_valid_access_token.json +1 -0
  95. data/spec/fake_json/posts/comments/post_without_access_token.json +1 -0
  96. data/spec/fake_json/posts/likes/post_with_invalid_access_token.json +1 -0
  97. data/spec/fake_json/posts/likes/post_with_valid_access_token.json +1 -0
  98. data/spec/fake_json/posts/likes/post_without_access_token.json +1 -0
  99. data/spec/fake_json/posts/platform_private.json +97 -0
  100. data/spec/fake_json/posts/platform_public.json +52 -0
  101. data/spec/fake_json/users/accounts/matake_private.json +14 -0
  102. data/spec/fake_json/users/accounts/matake_private_with_manage_pages_permission.json +16 -0
  103. data/spec/fake_json/users/accounts/matake_public.json +6 -0
  104. data/spec/fake_json/users/activities/arjun_private.json +24 -0
  105. data/spec/fake_json/users/activities/arjun_public.json +6 -0
  106. data/spec/fake_json/users/albums/matake_private.json +36 -0
  107. data/spec/fake_json/users/albums/matake_public.json +6 -0
  108. data/spec/fake_json/users/albums/post_with_valid_access_token.json +1 -0
  109. data/spec/fake_json/users/arjun_private.json +109 -0
  110. data/spec/fake_json/users/arjun_public.json +12 -0
  111. data/spec/fake_json/users/books/matake_private.json +9 -0
  112. data/spec/fake_json/users/books/matake_public.json +6 -0
  113. data/spec/fake_json/users/checkins/mattt_private.json +389 -0
  114. data/spec/fake_json/users/checkins/mattt_public.json +6 -0
  115. data/spec/fake_json/users/events/matake_private.json +71 -0
  116. data/spec/fake_json/users/events/matake_public.json +6 -0
  117. data/spec/fake_json/users/events/post_with_valid_access_token.json +1 -0
  118. data/spec/fake_json/users/feed/arjun_private.json +520 -0
  119. data/spec/fake_json/users/feed/arjun_public.json +520 -0
  120. data/spec/fake_json/users/feed/post_with_invalid_access_token.json +1 -0
  121. data/spec/fake_json/users/feed/post_with_valid_access_token.json +1 -0
  122. data/spec/fake_json/users/feed/post_without_access_token.json +1 -0
  123. data/spec/fake_json/users/friends/arjun_private.json +6 -0
  124. data/spec/fake_json/users/friends/arjun_public.json +6 -0
  125. data/spec/fake_json/users/friends/me_private.json +524 -0
  126. data/spec/fake_json/users/friends/me_public.json +6 -0
  127. data/spec/fake_json/users/groups/matake_private.json +48 -0
  128. data/spec/fake_json/users/groups/matake_public.json +6 -0
  129. data/spec/fake_json/users/home/arjun_private.json +6 -0
  130. data/spec/fake_json/users/home/arjun_public.json +6 -0
  131. data/spec/fake_json/users/home/me_private.json +460 -0
  132. data/spec/fake_json/users/home/me_private_next.json +382 -0
  133. data/spec/fake_json/users/home/me_private_previous.json +36 -0
  134. data/spec/fake_json/users/home/me_public.json +6 -0
  135. data/spec/fake_json/users/interests/matake_private.json +14 -0
  136. data/spec/fake_json/users/likes/arjun_private.json +1394 -0
  137. data/spec/fake_json/users/likes/arjun_public.json +6 -0
  138. data/spec/fake_json/users/links/matake_private.json +221 -0
  139. data/spec/fake_json/users/links/post_with_valid_access_token.json +1 -0
  140. data/spec/fake_json/users/me_private.json +128 -0
  141. data/spec/fake_json/users/me_public.json +6 -0
  142. data/spec/fake_json/users/movies/matake_private.json +9 -0
  143. data/spec/fake_json/users/music/matake_private.json +34 -0
  144. data/spec/fake_json/users/notes/matake_private.json +308 -0
  145. data/spec/fake_json/users/posts/arjun_private.json +386 -0
  146. data/spec/fake_json/users/posts/arjun_public.json +386 -0
  147. data/spec/fake_json/users/statuses/arjun_private.json +233 -0
  148. data/spec/fake_json/users/statuses/arjun_public.json +6 -0
  149. data/spec/fake_json/users/tagged/arjun_private.json +308 -0
  150. data/spec/fake_json/users/tagged/arjun_public.json +308 -0
  151. data/spec/fake_json/users/television/matake_private.json +9 -0
  152. data/spec/fake_json/users/videos/kirk_private.json +41 -0
  153. data/spec/fb_graph/album_spec.rb +61 -0
  154. data/spec/fb_graph/application_spec.rb +23 -0
  155. data/spec/fb_graph/auth_spec.rb +35 -0
  156. data/spec/fb_graph/checkin_spec.rb +29 -0
  157. data/spec/fb_graph/collection_spec.rb +45 -0
  158. data/spec/fb_graph/comment_spec.rb +31 -0
  159. data/spec/fb_graph/connection_spec.rb +38 -0
  160. data/spec/fb_graph/connections/accounts_spec.rb +47 -0
  161. data/spec/fb_graph/connections/activities_spec.rb +34 -0
  162. data/spec/fb_graph/connections/albums_spec.rb +60 -0
  163. data/spec/fb_graph/connections/attending_spec.rb +24 -0
  164. data/spec/fb_graph/connections/books_spec.rb +33 -0
  165. data/spec/fb_graph/connections/checkins_spec.rb +109 -0
  166. data/spec/fb_graph/connections/comments_spec.rb +85 -0
  167. data/spec/fb_graph/connections/declined_spec.rb +24 -0
  168. data/spec/fb_graph/connections/events_spec.rb +53 -0
  169. data/spec/fb_graph/connections/feed_spec.rb +102 -0
  170. data/spec/fb_graph/connections/friends_spec.rb +50 -0
  171. data/spec/fb_graph/connections/groups_spec.rb +32 -0
  172. data/spec/fb_graph/connections/home_spec.rb +58 -0
  173. data/spec/fb_graph/connections/interests_spec.rb +14 -0
  174. data/spec/fb_graph/connections/invited_spec.rb +14 -0
  175. data/spec/fb_graph/connections/likes_spec.rb +33 -0
  176. data/spec/fb_graph/connections/links_spec.rb +33 -0
  177. data/spec/fb_graph/connections/maybe_spec.rb +24 -0
  178. data/spec/fb_graph/connections/members_spec.rb +14 -0
  179. data/spec/fb_graph/connections/movies_spec.rb +14 -0
  180. data/spec/fb_graph/connections/music_spec.rb +14 -0
  181. data/spec/fb_graph/connections/noreply_spec.rb +14 -0
  182. data/spec/fb_graph/connections/notes_spec.rb +32 -0
  183. data/spec/fb_graph/connections/photos_spec.rb +30 -0
  184. data/spec/fb_graph/connections/picture_spec.rb +29 -0
  185. data/spec/fb_graph/connections/posts_spec.rb +35 -0
  186. data/spec/fb_graph/connections/statuses_spec.rb +74 -0
  187. data/spec/fb_graph/connections/subscriptions_spec.rb +18 -0
  188. data/spec/fb_graph/connections/tagged_spec.rb +42 -0
  189. data/spec/fb_graph/connections/television_spec.rb +14 -0
  190. data/spec/fb_graph/connections/videos_spec.rb +14 -0
  191. data/spec/fb_graph/education_spec.rb +61 -0
  192. data/spec/fb_graph/event_spec.rb +50 -0
  193. data/spec/fb_graph/group_spec.rb +46 -0
  194. data/spec/fb_graph/insight_spec.rb +17 -0
  195. data/spec/fb_graph/link_spec.rb +43 -0
  196. data/spec/fb_graph/node_spec.rb +13 -0
  197. data/spec/fb_graph/note_spec.rb +37 -0
  198. data/spec/fb_graph/page_spec.rb +56 -0
  199. data/spec/fb_graph/photo_spec.rb +60 -0
  200. data/spec/fb_graph/post_spec.rb +71 -0
  201. data/spec/fb_graph/status_spec.rb +31 -0
  202. data/spec/fb_graph/subscription_spec.rb +5 -0
  203. data/spec/fb_graph/tag_spec.rb +20 -0
  204. data/spec/fb_graph/user_spec.rb +139 -0
  205. data/spec/fb_graph/venue_spec.rb +23 -0
  206. data/spec/fb_graph/video_spec.rb +37 -0
  207. data/spec/fb_graph/work_spec.rb +67 -0
  208. data/spec/helpers/fake_json_helper.rb +11 -0
  209. data/spec/spec.opts +3 -0
  210. data/spec/spec_helper.rb +18 -0
  211. metadata +414 -0
@@ -0,0 +1,139 @@
1
+ require File.join(File.dirname(__FILE__), '../spec_helper')
2
+
3
+ describe FbGraph::User, '.new' do
4
+ it 'should setup all supported attributes' do
5
+ # TODO
6
+ end
7
+
8
+ it 'should support year-hidden birthday' do
9
+ user = FbGraph::User.new(12345, :birthday => '12/13')
10
+ user.birthday.year.should == 0
11
+ user.birthday.month.should == 12
12
+ user.birthday.day.should == 13
13
+ end
14
+ end
15
+
16
+ describe FbGraph::User, '.me' do
17
+ it 'should return FbGraph::User instance with access_token' do
18
+ FbGraph::User.me('access_token').should == FbGraph::User.new('me', :access_token => 'access_token')
19
+ end
20
+ end
21
+
22
+ describe FbGraph::User, '.fetch' do
23
+ before(:all) do
24
+ fake_json(:get, 'me', 'users/me_public')
25
+ fake_json(:get, 'me?access_token=access_token', 'users/me_private')
26
+ fake_json(:get, 'arjun', 'users/arjun_public')
27
+ fake_json(:get, 'arjun?access_token=access_token', 'users/arjun_private')
28
+ end
29
+
30
+ context 'with me context' do
31
+
32
+ context 'when no access_token given' do
33
+ it 'should raise FbGraph::Unauthorized' do
34
+ lambda do
35
+ FbGraph::User.fetch('me')
36
+ end.should raise_exception(FbGraph::Unauthorized)
37
+ end
38
+ end
39
+
40
+ context 'when access_token given' do
41
+ it 'should get current user profile' do
42
+ user = FbGraph::User.me('access_token').fetch
43
+ user.interested_in.should == ['female']
44
+ user.meeting_for.should == ['Friendship', 'Networking']
45
+ user.relationship_status.should == 'Married'
46
+ user.website.should == ['http://matake.jp']
47
+ user.religion.should be_nil
48
+ user.political.should be_nil
49
+ user.timezone.should == 9
50
+ user.verified.should be_true
51
+ end
52
+ end
53
+
54
+ end
55
+
56
+ context 'when no access_token given' do
57
+ it 'should get only public profile' do
58
+ user = FbGraph::User.fetch('arjun')
59
+ user.name.should == 'Arjun Banker'
60
+ user.first_name.should == 'Arjun'
61
+ user.last_name.should == 'Banker'
62
+ user.identifier.should == '7901103'
63
+ user.link.should == 'http://www.facebook.com/Arjun'
64
+ user.location.should == FbGraph::Page.new(114952118516947, :name => 'San Francisco, California')
65
+ user.gender.should == 'male'
66
+ end
67
+ end
68
+
69
+ context 'when access_token given' do
70
+ it 'should get public + private profile' do
71
+ user = FbGraph::User.fetch('arjun', :access_token => 'access_token')
72
+
73
+ # public
74
+ user.name.should == 'Arjun Banker'
75
+ user.first_name.should == 'Arjun'
76
+ user.last_name.should == 'Banker'
77
+ user.identifier.should == '7901103'
78
+ user.link.should == 'http://www.facebook.com/Arjun'
79
+ user.location.should == FbGraph::Page.new(114952118516947, :name => 'San Francisco, California')
80
+ user.gender.should == 'male'
81
+
82
+ # private
83
+ user.about.should == 'daydrea'
84
+ user.birthday.should == Date.parse('04/15/1984')
85
+ user.work.should == [
86
+ FbGraph::Work.new({
87
+ :employer => {:name => 'Facebook', :id => 20531316728},
88
+ :position => {:name => 'Software Engineer', :id => 107879555911138},
89
+ :location => {:name => 'Palo Alto, California', :id => 104022926303756},
90
+ :start_date => '2007-11'
91
+ }),
92
+ FbGraph::Work.new({
93
+ :employer => {:name => 'Zillow', :id => 113816405300191},
94
+ :position => {:name => 'Business Intelligence Analyst', :id => 105918922782444},
95
+ :start_date => '2006-03',
96
+ :end_date => '2007-10'
97
+ }),
98
+ FbGraph::Work.new({
99
+ :employer => {:name => 'Microsoft', :id => 20528438720},
100
+ :position => {:name => 'SDET', :id => 110006949022640},
101
+ :start_date => '2004-08',
102
+ :end_date => '2006-03'
103
+ }),
104
+ FbGraph::Work.new({
105
+ :employer => {:name => 'Dell', :id => 7706457055},
106
+ :position => {:name => 'Programmer Analyst', :id => 110344568993267},
107
+ :start_date => '2003-06',
108
+ :end_date => '2004-07'
109
+ })
110
+ ]
111
+ user.education.should == [
112
+ FbGraph::Education.new({
113
+ :school => {:name => 'Texas Academy Of Math And Science', :id => 107922345906866},
114
+ :year => {:name => '2001', :id => 102241906483610}
115
+ }),
116
+ FbGraph::Education.new({
117
+ :school => {:name => 'The University of Texas at Austin', :id => 24147741537},
118
+ :year => {:name => '2003', :id => 108077232558120},
119
+ :concentration => [
120
+ {:name => 'Computer Science', :id => 116831821660155}
121
+ ]
122
+ })
123
+ ]
124
+ user.email.should == nil
125
+ user.website.should == []
126
+ user.hometown.should == FbGraph::Page.new(109533479072558, :name => 'Minnetonka, Minnesota')
127
+ user.interested_in.should == ['female']
128
+ user.meeting_for.should == ['Friendship']
129
+ user.relationship_status.should == 'In a Relationship'
130
+ user.religion.should == 'zorp'
131
+ user.political.should == 'Liberal'
132
+ user.verified.should be_nil
133
+ # What's this?
134
+ # user.significant_other
135
+ user.timezone.should be_nil
136
+ user.updated_time.should == Time.parse('2010-05-29T04:29:23+0000')
137
+ end
138
+ end
139
+ end
@@ -0,0 +1,23 @@
1
+ require File.join(File.dirname(__FILE__), '../spec_helper')
2
+
3
+ describe FbGraph::Venue, '.new' do
4
+
5
+ it 'should setup all supported attributes' do
6
+ attributes = {
7
+ :street => "409 Colorado St.",
8
+ :city => "Austin",
9
+ :state => "Texas",
10
+ :country => "United States",
11
+ :latitude => 30.2669,
12
+ :longitude => -97.7428
13
+ }
14
+ venue = FbGraph::Venue.new(attributes)
15
+ venue.street.should == "409 Colorado St."
16
+ venue.city.should == "Austin"
17
+ venue.state.should == "Texas"
18
+ venue.country.should == "United States"
19
+ venue.latitude.should == 30.2669
20
+ venue.longitude.should == -97.7428
21
+ end
22
+
23
+ end
@@ -0,0 +1,37 @@
1
+ require File.join(File.dirname(__FILE__), '../spec_helper')
2
+
3
+ describe FbGraph::Video, '.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
+ :message => 'check this out!',
13
+ :description => 'Smart.fm learning engine details',
14
+ :length => 3600,
15
+ :created_time => '2010-01-02T15:37:40+0000',
16
+ :updated_time => '2010-01-02T15:37:41+0000'
17
+ }
18
+ video = FbGraph::Video.new(attributes.delete(:id), attributes)
19
+ video.identifier.should == '12345'
20
+ video.from.should == FbGraph::User.new('23456', :name => 'nov matake')
21
+ video.message.should == 'check this out!'
22
+ video.description.should == 'Smart.fm learning engine details'
23
+ video.length.should == 3600
24
+ video.created_time.should == Time.parse('2010-01-02T15:37:40+0000')
25
+ video.updated_time.should == Time.parse('2010-01-02T15:37:41+0000')
26
+ end
27
+
28
+ it 'should support page as from' do
29
+ page_video = FbGraph::Video.new('12345', :from => {
30
+ :id => '23456',
31
+ :name => 'Smart.fm',
32
+ :category => 'Web Site'
33
+ })
34
+ page_video.from.should == FbGraph::Page.new('23456', :name => 'Smart.fm', :category => 'Web Site')
35
+ end
36
+
37
+ end
@@ -0,0 +1,67 @@
1
+ require File.join(File.dirname(__FILE__), '../spec_helper')
2
+
3
+ describe FbGraph::Work, '.new' do
4
+
5
+ it 'should setup all supported attributes' do
6
+ attributes = {
7
+ :employer => {
8
+ :id => 107722015925937,
9
+ :name => "Drecom Co., Ltd."
10
+ },
11
+ :location => {
12
+ :id => 111736052177472,
13
+ :name => "Tokyo, Tokyo"
14
+ },
15
+ :position => {
16
+ :id => 111091815582753,
17
+ :name => "Web Engineer"
18
+ },
19
+ :start_date => "2007-04",
20
+ :end_date => "2008-09"
21
+ }
22
+ work = FbGraph::Work.new(attributes)
23
+ work.employer.should == FbGraph::Page.new(
24
+ 107722015925937,
25
+ :name => "Drecom Co., Ltd."
26
+ )
27
+ work.location.should == FbGraph::Page.new(
28
+ 111736052177472,
29
+ :name => "Tokyo, Tokyo"
30
+ )
31
+ work.position.should == FbGraph::Page.new(
32
+ 111091815582753,
33
+ :name => "Web Engineer"
34
+ )
35
+ work.start_date.should == Date.new(2007, 4)
36
+ work.end_date.should == Date.new(2008, 9)
37
+ end
38
+
39
+ it 'should ignore 0000-00 style date' do
40
+ attributes = {
41
+ :employer => {
42
+ :id => 105612642807396,
43
+ :name => "Cerego Japan Inc."
44
+ },
45
+ :start_date => "0000-00",
46
+ :end_date => "0000-00"
47
+ }
48
+ work = FbGraph::Work.new(attributes)
49
+ work.start_date.should be_nil
50
+ work.end_date.should be_nil
51
+ end
52
+
53
+ it 'should treat 2010-00 date ' do
54
+ attributes = {
55
+ :employer => {
56
+ :id => 105612642807396,
57
+ :name => "Cerego Japan Inc."
58
+ },
59
+ :start_date => "2008-00",
60
+ :end_date => "2010-00"
61
+ }
62
+ work = FbGraph::Work.new(attributes)
63
+ work.start_date.should == Date.new(2008, 1)
64
+ work.end_date.should == Date.new(2010, 1)
65
+ end
66
+
67
+ end
@@ -0,0 +1,11 @@
1
+ module FakeJsonHelper
2
+ def fake_json(method, path, file_path, options = {})
3
+ FakeWeb.register_uri(
4
+ method,
5
+ File.join(FbGraph::ROOT_URL, path),
6
+ options.merge(
7
+ :body => File.read(File.join(File.dirname(__FILE__), '../fake_json', "#{file_path}.json"))
8
+ )
9
+ )
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ --colour
2
+ --format
3
+ specdoc
@@ -0,0 +1,18 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+
4
+ require 'spec'
5
+ require 'spec/autorun'
6
+ require 'fb_graph'
7
+ require 'rubygems'
8
+ require 'fakeweb'
9
+ require 'helpers/fake_json_helper'
10
+ include FakeJsonHelper
11
+ FakeWeb.allow_net_connect = false
12
+
13
+
14
+ Spec::Runner.configure do |config|
15
+ config.before(:all) do
16
+
17
+ end
18
+ end
metadata ADDED
@@ -0,0 +1,414 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: palidanx-fb_graph
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 4
9
+ version: 1.0.4
10
+ platform: ruby
11
+ authors:
12
+ - nov matake
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-09-29 00:00:00 -07:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: json
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :runtime
31
+ version_requirements: *id001
32
+ - !ruby/object:Gem::Dependency
33
+ name: activesupport
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
41
+ version: "0"
42
+ type: :runtime
43
+ version_requirements: *id002
44
+ - !ruby/object:Gem::Dependency
45
+ name: rest-client
46
+ prerelease: false
47
+ requirement: &id003 !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ segments:
52
+ - 1
53
+ - 4
54
+ version: "1.4"
55
+ type: :runtime
56
+ version_requirements: *id003
57
+ - !ruby/object:Gem::Dependency
58
+ name: oauth2
59
+ prerelease: false
60
+ requirement: &id004 !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ segments:
65
+ - 0
66
+ - 0
67
+ - 10
68
+ version: 0.0.10
69
+ type: :runtime
70
+ version_requirements: *id004
71
+ - !ruby/object:Gem::Dependency
72
+ name: rspec
73
+ prerelease: false
74
+ requirement: &id005 !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ segments:
79
+ - 0
80
+ version: "0"
81
+ type: :development
82
+ version_requirements: *id005
83
+ - !ruby/object:Gem::Dependency
84
+ name: rcov
85
+ prerelease: false
86
+ requirement: &id006 !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ segments:
91
+ - 0
92
+ version: "0"
93
+ type: :development
94
+ version_requirements: *id006
95
+ - !ruby/object:Gem::Dependency
96
+ name: fakeweb
97
+ prerelease: false
98
+ requirement: &id007 !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ segments:
103
+ - 0
104
+ version: "0"
105
+ type: :development
106
+ version_requirements: *id007
107
+ description: A full-stack Facebook Graph API wrapper in Ruby (fork of original).
108
+ email: nov@matake.jp
109
+ executables: []
110
+
111
+ extensions: []
112
+
113
+ extra_rdoc_files:
114
+ - LICENSE
115
+ - README.rdoc
116
+ files:
117
+ - .document
118
+ - .gitignore
119
+ - LICENSE
120
+ - README.rdoc
121
+ - Rakefile
122
+ - VERSION
123
+ - assets/fb_graph.ai
124
+ - assets/fb_graph.png
125
+ - fb_graph.gemspec
126
+ - lib/fb_graph.rb
127
+ - lib/fb_graph/album.rb
128
+ - lib/fb_graph/application.rb
129
+ - lib/fb_graph/auth.rb
130
+ - lib/fb_graph/auth/cookie.rb
131
+ - lib/fb_graph/checkin.rb
132
+ - lib/fb_graph/collection.rb
133
+ - lib/fb_graph/comment.rb
134
+ - lib/fb_graph/comparison.rb
135
+ - lib/fb_graph/connection.rb
136
+ - lib/fb_graph/connections.rb
137
+ - lib/fb_graph/connections/accounts.rb
138
+ - lib/fb_graph/connections/activities.rb
139
+ - lib/fb_graph/connections/albums.rb
140
+ - lib/fb_graph/connections/attending.rb
141
+ - lib/fb_graph/connections/books.rb
142
+ - lib/fb_graph/connections/checkins.rb
143
+ - lib/fb_graph/connections/comments.rb
144
+ - lib/fb_graph/connections/declined.rb
145
+ - lib/fb_graph/connections/events.rb
146
+ - lib/fb_graph/connections/feed.rb
147
+ - lib/fb_graph/connections/friends.rb
148
+ - lib/fb_graph/connections/groups.rb
149
+ - lib/fb_graph/connections/home.rb
150
+ - lib/fb_graph/connections/insights.rb
151
+ - lib/fb_graph/connections/interests.rb
152
+ - lib/fb_graph/connections/invited.rb
153
+ - lib/fb_graph/connections/likes.rb
154
+ - lib/fb_graph/connections/links.rb
155
+ - lib/fb_graph/connections/maybe.rb
156
+ - lib/fb_graph/connections/members.rb
157
+ - lib/fb_graph/connections/movies.rb
158
+ - lib/fb_graph/connections/music.rb
159
+ - lib/fb_graph/connections/noreply.rb
160
+ - lib/fb_graph/connections/notes.rb
161
+ - lib/fb_graph/connections/photos.rb
162
+ - lib/fb_graph/connections/picture.rb
163
+ - lib/fb_graph/connections/posts.rb
164
+ - lib/fb_graph/connections/statuses.rb
165
+ - lib/fb_graph/connections/subscriptions.rb
166
+ - lib/fb_graph/connections/tagged.rb
167
+ - lib/fb_graph/connections/television.rb
168
+ - lib/fb_graph/connections/videos.rb
169
+ - lib/fb_graph/education.rb
170
+ - lib/fb_graph/event.rb
171
+ - lib/fb_graph/group.rb
172
+ - lib/fb_graph/insight.rb
173
+ - lib/fb_graph/link.rb
174
+ - lib/fb_graph/node.rb
175
+ - lib/fb_graph/note.rb
176
+ - lib/fb_graph/page.rb
177
+ - lib/fb_graph/photo.rb
178
+ - lib/fb_graph/post.rb
179
+ - lib/fb_graph/searchable.rb
180
+ - lib/fb_graph/searchable/result.rb
181
+ - lib/fb_graph/status.rb
182
+ - lib/fb_graph/subscription.rb
183
+ - lib/fb_graph/tag.rb
184
+ - lib/fb_graph/user.rb
185
+ - lib/fb_graph/venue.rb
186
+ - lib/fb_graph/video.rb
187
+ - lib/fb_graph/work.rb
188
+ - spec/fake_json/albums/photos/matake_private.json
189
+ - spec/fake_json/albums/photos/post_with_valid_access_token.json
190
+ - spec/fake_json/applications/subscriptions/fb_graph_private.json
191
+ - spec/fake_json/checkins/search_private.json
192
+ - spec/fake_json/checkins/search_public.json
193
+ - spec/fake_json/events/attending/post_with_valid_access_token.json
194
+ - spec/fake_json/events/attending/smartday_private.json
195
+ - spec/fake_json/events/declined/post_with_valid_access_token.json
196
+ - spec/fake_json/events/declined/smartday_private.json
197
+ - spec/fake_json/events/invited/smartday_private.json
198
+ - spec/fake_json/events/maybe/post_with_valid_access_token.json
199
+ - spec/fake_json/events/maybe/smartday_private.json
200
+ - spec/fake_json/events/noreply/smartday_private.json
201
+ - spec/fake_json/groups/members/emacs_private.json
202
+ - spec/fake_json/pages/checkins/gowalla_private.json
203
+ - spec/fake_json/pages/checkins/gowalla_public.json
204
+ - spec/fake_json/pages/notes/post_with_valid_access_token.json
205
+ - spec/fake_json/pages/platform_private.json
206
+ - spec/fake_json/pages/platform_public.json
207
+ - spec/fake_json/pages/statuses/platform_private.json
208
+ - spec/fake_json/pages/statuses/platform_public.json
209
+ - spec/fake_json/posts/comments/post_with_invalid_access_token.json
210
+ - spec/fake_json/posts/comments/post_with_valid_access_token.json
211
+ - spec/fake_json/posts/comments/post_without_access_token.json
212
+ - spec/fake_json/posts/likes/post_with_invalid_access_token.json
213
+ - spec/fake_json/posts/likes/post_with_valid_access_token.json
214
+ - spec/fake_json/posts/likes/post_without_access_token.json
215
+ - spec/fake_json/posts/platform_private.json
216
+ - spec/fake_json/posts/platform_public.json
217
+ - spec/fake_json/users/accounts/matake_private.json
218
+ - spec/fake_json/users/accounts/matake_private_with_manage_pages_permission.json
219
+ - spec/fake_json/users/accounts/matake_public.json
220
+ - spec/fake_json/users/activities/arjun_private.json
221
+ - spec/fake_json/users/activities/arjun_public.json
222
+ - spec/fake_json/users/albums/matake_private.json
223
+ - spec/fake_json/users/albums/matake_public.json
224
+ - spec/fake_json/users/albums/post_with_valid_access_token.json
225
+ - spec/fake_json/users/arjun_private.json
226
+ - spec/fake_json/users/arjun_public.json
227
+ - spec/fake_json/users/books/matake_private.json
228
+ - spec/fake_json/users/books/matake_public.json
229
+ - spec/fake_json/users/checkins/mattt_private.json
230
+ - spec/fake_json/users/checkins/mattt_public.json
231
+ - spec/fake_json/users/events/matake_private.json
232
+ - spec/fake_json/users/events/matake_public.json
233
+ - spec/fake_json/users/events/post_with_valid_access_token.json
234
+ - spec/fake_json/users/feed/arjun_private.json
235
+ - spec/fake_json/users/feed/arjun_public.json
236
+ - spec/fake_json/users/feed/post_with_invalid_access_token.json
237
+ - spec/fake_json/users/feed/post_with_valid_access_token.json
238
+ - spec/fake_json/users/feed/post_without_access_token.json
239
+ - spec/fake_json/users/friends/arjun_private.json
240
+ - spec/fake_json/users/friends/arjun_public.json
241
+ - spec/fake_json/users/friends/me_private.json
242
+ - spec/fake_json/users/friends/me_public.json
243
+ - spec/fake_json/users/groups/matake_private.json
244
+ - spec/fake_json/users/groups/matake_public.json
245
+ - spec/fake_json/users/home/arjun_private.json
246
+ - spec/fake_json/users/home/arjun_public.json
247
+ - spec/fake_json/users/home/me_private.json
248
+ - spec/fake_json/users/home/me_private_next.json
249
+ - spec/fake_json/users/home/me_private_previous.json
250
+ - spec/fake_json/users/home/me_public.json
251
+ - spec/fake_json/users/interests/matake_private.json
252
+ - spec/fake_json/users/likes/arjun_private.json
253
+ - spec/fake_json/users/likes/arjun_public.json
254
+ - spec/fake_json/users/links/matake_private.json
255
+ - spec/fake_json/users/links/post_with_valid_access_token.json
256
+ - spec/fake_json/users/me_private.json
257
+ - spec/fake_json/users/me_public.json
258
+ - spec/fake_json/users/movies/matake_private.json
259
+ - spec/fake_json/users/music/matake_private.json
260
+ - spec/fake_json/users/notes/matake_private.json
261
+ - spec/fake_json/users/posts/arjun_private.json
262
+ - spec/fake_json/users/posts/arjun_public.json
263
+ - spec/fake_json/users/statuses/arjun_private.json
264
+ - spec/fake_json/users/statuses/arjun_public.json
265
+ - spec/fake_json/users/tagged/arjun_private.json
266
+ - spec/fake_json/users/tagged/arjun_public.json
267
+ - spec/fake_json/users/television/matake_private.json
268
+ - spec/fake_json/users/videos/kirk_private.json
269
+ - spec/fb_graph/album_spec.rb
270
+ - spec/fb_graph/application_spec.rb
271
+ - spec/fb_graph/auth_spec.rb
272
+ - spec/fb_graph/checkin_spec.rb
273
+ - spec/fb_graph/collection_spec.rb
274
+ - spec/fb_graph/comment_spec.rb
275
+ - spec/fb_graph/connection_spec.rb
276
+ - spec/fb_graph/connections/accounts_spec.rb
277
+ - spec/fb_graph/connections/activities_spec.rb
278
+ - spec/fb_graph/connections/albums_spec.rb
279
+ - spec/fb_graph/connections/attending_spec.rb
280
+ - spec/fb_graph/connections/books_spec.rb
281
+ - spec/fb_graph/connections/checkins_spec.rb
282
+ - spec/fb_graph/connections/comments_spec.rb
283
+ - spec/fb_graph/connections/declined_spec.rb
284
+ - spec/fb_graph/connections/events_spec.rb
285
+ - spec/fb_graph/connections/feed_spec.rb
286
+ - spec/fb_graph/connections/friends_spec.rb
287
+ - spec/fb_graph/connections/groups_spec.rb
288
+ - spec/fb_graph/connections/home_spec.rb
289
+ - spec/fb_graph/connections/interests_spec.rb
290
+ - spec/fb_graph/connections/invited_spec.rb
291
+ - spec/fb_graph/connections/likes_spec.rb
292
+ - spec/fb_graph/connections/links_spec.rb
293
+ - spec/fb_graph/connections/maybe_spec.rb
294
+ - spec/fb_graph/connections/members_spec.rb
295
+ - spec/fb_graph/connections/movies_spec.rb
296
+ - spec/fb_graph/connections/music_spec.rb
297
+ - spec/fb_graph/connections/noreply_spec.rb
298
+ - spec/fb_graph/connections/notes_spec.rb
299
+ - spec/fb_graph/connections/photos_spec.rb
300
+ - spec/fb_graph/connections/picture_spec.rb
301
+ - spec/fb_graph/connections/posts_spec.rb
302
+ - spec/fb_graph/connections/statuses_spec.rb
303
+ - spec/fb_graph/connections/subscriptions_spec.rb
304
+ - spec/fb_graph/connections/tagged_spec.rb
305
+ - spec/fb_graph/connections/television_spec.rb
306
+ - spec/fb_graph/connections/videos_spec.rb
307
+ - spec/fb_graph/education_spec.rb
308
+ - spec/fb_graph/event_spec.rb
309
+ - spec/fb_graph/group_spec.rb
310
+ - spec/fb_graph/insight_spec.rb
311
+ - spec/fb_graph/link_spec.rb
312
+ - spec/fb_graph/node_spec.rb
313
+ - spec/fb_graph/note_spec.rb
314
+ - spec/fb_graph/page_spec.rb
315
+ - spec/fb_graph/photo_spec.rb
316
+ - spec/fb_graph/post_spec.rb
317
+ - spec/fb_graph/status_spec.rb
318
+ - spec/fb_graph/subscription_spec.rb
319
+ - spec/fb_graph/tag_spec.rb
320
+ - spec/fb_graph/user_spec.rb
321
+ - spec/fb_graph/venue_spec.rb
322
+ - spec/fb_graph/video_spec.rb
323
+ - spec/fb_graph/work_spec.rb
324
+ - spec/helpers/fake_json_helper.rb
325
+ - spec/spec.opts
326
+ - spec/spec_helper.rb
327
+ has_rdoc: true
328
+ homepage: http://github.com/palidanx/fb_graph
329
+ licenses: []
330
+
331
+ post_install_message:
332
+ rdoc_options:
333
+ - --charset=UTF-8
334
+ require_paths:
335
+ - lib
336
+ required_ruby_version: !ruby/object:Gem::Requirement
337
+ requirements:
338
+ - - ">="
339
+ - !ruby/object:Gem::Version
340
+ segments:
341
+ - 0
342
+ version: "0"
343
+ required_rubygems_version: !ruby/object:Gem::Requirement
344
+ requirements:
345
+ - - ">="
346
+ - !ruby/object:Gem::Version
347
+ segments:
348
+ - 0
349
+ version: "0"
350
+ requirements: []
351
+
352
+ rubyforge_project:
353
+ rubygems_version: 1.3.6
354
+ signing_key:
355
+ specification_version: 3
356
+ summary: A full-stack Facebook Graph API wrapper in Ruby.
357
+ test_files:
358
+ - spec/spec_helper.rb
359
+ - spec/helpers/fake_json_helper.rb
360
+ - spec/fb_graph/auth_spec.rb
361
+ - spec/fb_graph/post_spec.rb
362
+ - spec/fb_graph/photo_spec.rb
363
+ - spec/fb_graph/comment_spec.rb
364
+ - spec/fb_graph/group_spec.rb
365
+ - spec/fb_graph/application_spec.rb
366
+ - spec/fb_graph/work_spec.rb
367
+ - spec/fb_graph/venue_spec.rb
368
+ - spec/fb_graph/education_spec.rb
369
+ - spec/fb_graph/connection_spec.rb
370
+ - spec/fb_graph/event_spec.rb
371
+ - spec/fb_graph/subscription_spec.rb
372
+ - spec/fb_graph/node_spec.rb
373
+ - spec/fb_graph/user_spec.rb
374
+ - spec/fb_graph/checkin_spec.rb
375
+ - spec/fb_graph/link_spec.rb
376
+ - spec/fb_graph/tag_spec.rb
377
+ - spec/fb_graph/collection_spec.rb
378
+ - spec/fb_graph/connections/albums_spec.rb
379
+ - spec/fb_graph/connections/checkins_spec.rb
380
+ - spec/fb_graph/connections/tagged_spec.rb
381
+ - spec/fb_graph/connections/members_spec.rb
382
+ - spec/fb_graph/connections/videos_spec.rb
383
+ - spec/fb_graph/connections/posts_spec.rb
384
+ - spec/fb_graph/connections/invited_spec.rb
385
+ - spec/fb_graph/connections/picture_spec.rb
386
+ - spec/fb_graph/connections/statuses_spec.rb
387
+ - spec/fb_graph/connections/movies_spec.rb
388
+ - spec/fb_graph/connections/interests_spec.rb
389
+ - spec/fb_graph/connections/feed_spec.rb
390
+ - spec/fb_graph/connections/television_spec.rb
391
+ - spec/fb_graph/connections/maybe_spec.rb
392
+ - spec/fb_graph/connections/accounts_spec.rb
393
+ - spec/fb_graph/connections/photos_spec.rb
394
+ - spec/fb_graph/connections/groups_spec.rb
395
+ - spec/fb_graph/connections/declined_spec.rb
396
+ - spec/fb_graph/connections/books_spec.rb
397
+ - spec/fb_graph/connections/activities_spec.rb
398
+ - spec/fb_graph/connections/likes_spec.rb
399
+ - spec/fb_graph/connections/friends_spec.rb
400
+ - spec/fb_graph/connections/comments_spec.rb
401
+ - spec/fb_graph/connections/home_spec.rb
402
+ - spec/fb_graph/connections/events_spec.rb
403
+ - spec/fb_graph/connections/noreply_spec.rb
404
+ - spec/fb_graph/connections/music_spec.rb
405
+ - spec/fb_graph/connections/notes_spec.rb
406
+ - spec/fb_graph/connections/links_spec.rb
407
+ - spec/fb_graph/connections/subscriptions_spec.rb
408
+ - spec/fb_graph/connections/attending_spec.rb
409
+ - spec/fb_graph/insight_spec.rb
410
+ - spec/fb_graph/status_spec.rb
411
+ - spec/fb_graph/page_spec.rb
412
+ - spec/fb_graph/note_spec.rb
413
+ - spec/fb_graph/album_spec.rb
414
+ - spec/fb_graph/video_spec.rb