fb_graph 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -1
- data/VERSION +1 -1
- data/assets/fb_graph.ai +1726 -6
- data/assets/fb_graph.png +0 -0
- data/fb_graph.gemspec +22 -2
- data/lib/fb_graph/album.rb +8 -4
- data/lib/fb_graph/collection.rb +4 -1
- data/lib/fb_graph/comment.rb +6 -4
- data/lib/fb_graph/connections/comments.rb +8 -1
- data/lib/fb_graph/education.rb +25 -0
- data/lib/fb_graph/event.rb +10 -4
- data/lib/fb_graph/group.rb +4 -2
- data/lib/fb_graph/link.rb +5 -3
- data/lib/fb_graph/note.rb +8 -4
- data/lib/fb_graph/photo.rb +9 -5
- data/lib/fb_graph/post.rb +24 -17
- data/lib/fb_graph/status.rb +5 -3
- data/lib/fb_graph/tag.rb +3 -1
- data/lib/fb_graph/user.rb +16 -4
- data/lib/fb_graph/video.rb +11 -7
- data/lib/fb_graph/work.rb +25 -0
- data/lib/fb_graph.rb +2 -0
- data/spec/fake_json/posts/platform_private.json +97 -0
- data/spec/fake_json/posts/platform_public.json +52 -0
- data/spec/fake_json/users/books/matake_private.json +9 -0
- data/spec/fake_json/users/books/matake_public.json +6 -0
- data/spec/fb_graph/album_spec.rb +2 -2
- data/spec/fb_graph/collection_spec.rb +7 -8
- data/spec/fb_graph/comment_spec.rb +31 -0
- data/spec/fb_graph/connections/activities_spec.rb +18 -14
- data/spec/fb_graph/connections/albums_spec.rb +25 -21
- data/spec/fb_graph/connections/books_spec.rb +32 -0
- data/spec/fb_graph/connections/events_spec.rb +20 -17
- data/spec/fb_graph/connections/feed_spec.rb +23 -22
- data/spec/fb_graph/connections/friends_spec.rb +29 -22
- data/spec/fb_graph/connections/groups_spec.rb +17 -14
- data/spec/fb_graph/connections/home_spec.rb +37 -30
- data/spec/fb_graph/connections/likes_spec.rb +18 -14
- data/spec/fb_graph/connections/picture_spec.rb +2 -2
- data/spec/fb_graph/connections/posts_spec.rb +23 -22
- data/spec/fb_graph/connections/statuses_spec.rb +45 -37
- data/spec/fb_graph/connections/tagged_spec.rb +30 -29
- data/spec/fb_graph/education_spec.rb +61 -0
- data/spec/fb_graph/event_spec.rb +3 -3
- data/spec/fb_graph/group_spec.rb +1 -1
- data/spec/fb_graph/link_spec.rb +1 -1
- data/spec/fb_graph/note_spec.rb +2 -2
- data/spec/fb_graph/photo_spec.rb +2 -2
- data/spec/fb_graph/post_spec.rb +63 -2
- data/spec/fb_graph/status_spec.rb +1 -1
- data/spec/fb_graph/tag_spec.rb +21 -0
- data/spec/fb_graph/user_spec.rb +64 -22
- data/spec/fb_graph/venue_spec.rb +23 -0
- data/spec/fb_graph/video_spec.rb +2 -2
- data/spec/fb_graph/work_spec.rb +52 -0
- metadata +23 -3
data/assets/fb_graph.png
ADDED
Binary file
|
data/fb_graph.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{fb_graph}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.8"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["nov matake"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-05-10}
|
13
13
|
s.description = %q{A Ruby wrapper for Facebook Graph API}
|
14
14
|
s.email = %q{nov@matake.jp}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -23,6 +23,8 @@ Gem::Specification.new do |s|
|
|
23
23
|
"README.rdoc",
|
24
24
|
"Rakefile",
|
25
25
|
"VERSION",
|
26
|
+
"assets/fb_graph.ai",
|
27
|
+
"assets/fb_graph.png",
|
26
28
|
"fb_graph.gemspec",
|
27
29
|
"lib/fb_graph.rb",
|
28
30
|
"lib/fb_graph/album.rb",
|
@@ -58,6 +60,7 @@ Gem::Specification.new do |s|
|
|
58
60
|
"lib/fb_graph/connections/tagged.rb",
|
59
61
|
"lib/fb_graph/connections/television.rb",
|
60
62
|
"lib/fb_graph/connections/videos.rb",
|
63
|
+
"lib/fb_graph/education.rb",
|
61
64
|
"lib/fb_graph/event.rb",
|
62
65
|
"lib/fb_graph/group.rb",
|
63
66
|
"lib/fb_graph/link.rb",
|
@@ -71,16 +74,21 @@ Gem::Specification.new do |s|
|
|
71
74
|
"lib/fb_graph/user.rb",
|
72
75
|
"lib/fb_graph/venue.rb",
|
73
76
|
"lib/fb_graph/video.rb",
|
77
|
+
"lib/fb_graph/work.rb",
|
74
78
|
"spec/fake_json/pages/platform_private.json",
|
75
79
|
"spec/fake_json/pages/platform_public.json",
|
76
80
|
"spec/fake_json/pages/statuses/platform_private.json",
|
77
81
|
"spec/fake_json/pages/statuses/platform_public.json",
|
82
|
+
"spec/fake_json/posts/platform_private.json",
|
83
|
+
"spec/fake_json/posts/platform_public.json",
|
78
84
|
"spec/fake_json/users/activities/arjun_private.json",
|
79
85
|
"spec/fake_json/users/activities/arjun_public.json",
|
80
86
|
"spec/fake_json/users/albums/matake_private.json",
|
81
87
|
"spec/fake_json/users/albums/matake_public.json",
|
82
88
|
"spec/fake_json/users/arjun_private.json",
|
83
89
|
"spec/fake_json/users/arjun_public.json",
|
90
|
+
"spec/fake_json/users/books/matake_private.json",
|
91
|
+
"spec/fake_json/users/books/matake_public.json",
|
84
92
|
"spec/fake_json/users/events/matake_private.json",
|
85
93
|
"spec/fake_json/users/events/matake_public.json",
|
86
94
|
"spec/fake_json/users/feed/arjun_private.json",
|
@@ -109,8 +117,10 @@ Gem::Specification.new do |s|
|
|
109
117
|
"spec/fake_json/users/tagged/arjun_public.json",
|
110
118
|
"spec/fb_graph/album_spec.rb",
|
111
119
|
"spec/fb_graph/collection_spec.rb",
|
120
|
+
"spec/fb_graph/comment_spec.rb",
|
112
121
|
"spec/fb_graph/connections/activities_spec.rb",
|
113
122
|
"spec/fb_graph/connections/albums_spec.rb",
|
123
|
+
"spec/fb_graph/connections/books_spec.rb",
|
114
124
|
"spec/fb_graph/connections/events_spec.rb",
|
115
125
|
"spec/fb_graph/connections/feed_spec.rb",
|
116
126
|
"spec/fb_graph/connections/friends_spec.rb",
|
@@ -121,6 +131,7 @@ Gem::Specification.new do |s|
|
|
121
131
|
"spec/fb_graph/connections/posts_spec.rb",
|
122
132
|
"spec/fb_graph/connections/statuses_spec.rb",
|
123
133
|
"spec/fb_graph/connections/tagged_spec.rb",
|
134
|
+
"spec/fb_graph/education_spec.rb",
|
124
135
|
"spec/fb_graph/event_spec.rb",
|
125
136
|
"spec/fb_graph/group_spec.rb",
|
126
137
|
"spec/fb_graph/link_spec.rb",
|
@@ -130,8 +141,11 @@ Gem::Specification.new do |s|
|
|
130
141
|
"spec/fb_graph/photo_spec.rb",
|
131
142
|
"spec/fb_graph/post_spec.rb",
|
132
143
|
"spec/fb_graph/status_spec.rb",
|
144
|
+
"spec/fb_graph/tag_spec.rb",
|
133
145
|
"spec/fb_graph/user_spec.rb",
|
146
|
+
"spec/fb_graph/venue_spec.rb",
|
134
147
|
"spec/fb_graph/video_spec.rb",
|
148
|
+
"spec/fb_graph/work_spec.rb",
|
135
149
|
"spec/fb_graph_spec.rb",
|
136
150
|
"spec/helpers/fake_json_helper.rb",
|
137
151
|
"spec/spec.opts",
|
@@ -145,8 +159,10 @@ Gem::Specification.new do |s|
|
|
145
159
|
s.test_files = [
|
146
160
|
"spec/fb_graph/album_spec.rb",
|
147
161
|
"spec/fb_graph/collection_spec.rb",
|
162
|
+
"spec/fb_graph/comment_spec.rb",
|
148
163
|
"spec/fb_graph/connections/activities_spec.rb",
|
149
164
|
"spec/fb_graph/connections/albums_spec.rb",
|
165
|
+
"spec/fb_graph/connections/books_spec.rb",
|
150
166
|
"spec/fb_graph/connections/events_spec.rb",
|
151
167
|
"spec/fb_graph/connections/feed_spec.rb",
|
152
168
|
"spec/fb_graph/connections/friends_spec.rb",
|
@@ -157,6 +173,7 @@ Gem::Specification.new do |s|
|
|
157
173
|
"spec/fb_graph/connections/posts_spec.rb",
|
158
174
|
"spec/fb_graph/connections/statuses_spec.rb",
|
159
175
|
"spec/fb_graph/connections/tagged_spec.rb",
|
176
|
+
"spec/fb_graph/education_spec.rb",
|
160
177
|
"spec/fb_graph/event_spec.rb",
|
161
178
|
"spec/fb_graph/group_spec.rb",
|
162
179
|
"spec/fb_graph/link_spec.rb",
|
@@ -166,8 +183,11 @@ Gem::Specification.new do |s|
|
|
166
183
|
"spec/fb_graph/photo_spec.rb",
|
167
184
|
"spec/fb_graph/post_spec.rb",
|
168
185
|
"spec/fb_graph/status_spec.rb",
|
186
|
+
"spec/fb_graph/tag_spec.rb",
|
169
187
|
"spec/fb_graph/user_spec.rb",
|
188
|
+
"spec/fb_graph/venue_spec.rb",
|
170
189
|
"spec/fb_graph/video_spec.rb",
|
190
|
+
"spec/fb_graph/work_spec.rb",
|
171
191
|
"spec/fb_graph_spec.rb",
|
172
192
|
"spec/helpers/fake_json_helper.rb",
|
173
193
|
"spec/spec_helper.rb"
|
data/lib/fb_graph/album.rb
CHANGED
@@ -9,9 +9,9 @@ module FbGraph
|
|
9
9
|
super
|
10
10
|
if (from = options[:from])
|
11
11
|
@from = if from[:category]
|
12
|
-
FbGraph::Page.new(from.delete(:id), from)
|
12
|
+
FbGraph::Page.new(from.delete(:id), from)
|
13
13
|
else
|
14
|
-
FbGraph::User.new(from.delete(:id), from)
|
14
|
+
FbGraph::User.new(from.delete(:id), from)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
@name = options[:name]
|
@@ -19,8 +19,12 @@ module FbGraph
|
|
19
19
|
@location = options[:location]
|
20
20
|
@link = options[:link]
|
21
21
|
@count = options[:count]
|
22
|
-
|
23
|
-
|
22
|
+
if options[:created_time]
|
23
|
+
@created_time = Time.parse(options[:created_time])
|
24
|
+
end
|
25
|
+
if options[:updated_time]
|
26
|
+
@updated_time = Time.parse(options[:updated_time])
|
27
|
+
end
|
24
28
|
end
|
25
29
|
end
|
26
30
|
end
|
data/lib/fb_graph/collection.rb
CHANGED
@@ -3,6 +3,9 @@ module FbGraph
|
|
3
3
|
attr_reader :previous, :next
|
4
4
|
|
5
5
|
def initialize(collection)
|
6
|
+
# allow nil input
|
7
|
+
collection ||= {:data => []}
|
8
|
+
|
6
9
|
result = replace(collection[:data])
|
7
10
|
@previous, @next = {}, {}
|
8
11
|
if (paging = collection[:paging])
|
@@ -25,7 +28,7 @@ module FbGraph
|
|
25
28
|
params[key] = URI.unescape(value)
|
26
29
|
end
|
27
30
|
params.delete_if do |k, v|
|
28
|
-
|
31
|
+
!['limit', 'offset', 'until', 'since'].include?(k)
|
29
32
|
end
|
30
33
|
end
|
31
34
|
end
|
data/lib/fb_graph/comment.rb
CHANGED
@@ -6,13 +6,15 @@ module FbGraph
|
|
6
6
|
super
|
7
7
|
if (from = options[:from])
|
8
8
|
@from = if from[:category]
|
9
|
-
FbGraph::Page.new(from.delete(:id), from)
|
9
|
+
FbGraph::Page.new(from.delete(:id), from)
|
10
10
|
else
|
11
|
-
FbGraph::User.new(from.delete(:id), from)
|
11
|
+
FbGraph::User.new(from.delete(:id), from)
|
12
12
|
end
|
13
13
|
end
|
14
|
-
@message
|
15
|
-
|
14
|
+
@message = options[:message]
|
15
|
+
if options[:created_time]
|
16
|
+
@created_time = Time.parse(options[:created_time])
|
17
|
+
end
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
@@ -2,7 +2,14 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module Comments
|
4
4
|
def comments(options = {})
|
5
|
-
comments =
|
5
|
+
comments = if options.blank?
|
6
|
+
# Note:
|
7
|
+
# "comments" is a connection, but included in fetched "post" object
|
8
|
+
# this improves performance when rendering the stream with comments
|
9
|
+
@_comments_
|
10
|
+
else
|
11
|
+
FbGraph::Collection.new(get(options.merge(:connection => 'comments')))
|
12
|
+
end
|
6
13
|
comments.map! do |comment|
|
7
14
|
Comment.new(comment.delete(:id), comment)
|
8
15
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module FbGraph
|
2
|
+
class Education
|
3
|
+
include FbGraph::Comparison
|
4
|
+
|
5
|
+
attr_accessor :school, :degree, :year, :concentration
|
6
|
+
|
7
|
+
def initialize(attributes = {})
|
8
|
+
if (school = attributes[:school])
|
9
|
+
@school = FbGraph::Page.new(school.delete(:id), school)
|
10
|
+
end
|
11
|
+
if (degree = attributes[:degree])
|
12
|
+
@degree = FbGraph::Page.new(degree.delete(:id), degree)
|
13
|
+
end
|
14
|
+
if (year = attributes[:year])
|
15
|
+
@year = FbGraph::Page.new(year.delete(:id), year)
|
16
|
+
end
|
17
|
+
@concentration = []
|
18
|
+
if attributes[:concentration]
|
19
|
+
attributes[:concentration].each do |concentration|
|
20
|
+
@concentration << FbGraph::Page.new(concentration.delete(:id), concentration)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/fb_graph/event.rb
CHANGED
@@ -17,14 +17,20 @@ module FbGraph
|
|
17
17
|
end
|
18
18
|
@name = options[:name]
|
19
19
|
@description = options[:description]
|
20
|
-
|
21
|
-
|
20
|
+
if options[:start_time]
|
21
|
+
@start_time = Time.parse(options[:start_time])
|
22
|
+
end
|
23
|
+
if options[:end_time]
|
24
|
+
@end_time = Time.parse(options[:end_time])
|
25
|
+
end
|
22
26
|
@location = options[:location]
|
27
|
+
@privacy = options[:privacy]
|
23
28
|
if options[:venue]
|
24
29
|
@venue = FbGraph::Venue.new(options[:venue])
|
25
30
|
end
|
26
|
-
|
27
|
-
|
31
|
+
if options[:updated_time]
|
32
|
+
@updated_time = Time.parse(options[:updated_time])
|
33
|
+
end
|
28
34
|
end
|
29
35
|
end
|
30
36
|
end
|
data/lib/fb_graph/group.rb
CHANGED
@@ -14,11 +14,13 @@ module FbGraph
|
|
14
14
|
@name = options[:name]
|
15
15
|
@description = options[:description]
|
16
16
|
@link = options[:link]
|
17
|
+
@privacy = options[:privacy]
|
17
18
|
if options[:venue]
|
18
19
|
@venue = FbGraph::Venue.new(options[:venue])
|
19
20
|
end
|
20
|
-
|
21
|
-
|
21
|
+
if options[:updated_time]
|
22
|
+
@updated_time = Time.parse(options[:updated_time])
|
23
|
+
end
|
22
24
|
end
|
23
25
|
end
|
24
26
|
end
|
data/lib/fb_graph/link.rb
CHANGED
@@ -8,14 +8,16 @@ module FbGraph
|
|
8
8
|
super
|
9
9
|
if (from = options[:from])
|
10
10
|
@from = if from[:category]
|
11
|
-
FbGraph::Page.new(from.delete(:id), from)
|
11
|
+
FbGraph::Page.new(from.delete(:id), from)
|
12
12
|
else
|
13
|
-
FbGraph::User.new(from.delete(:id), from)
|
13
|
+
FbGraph::User.new(from.delete(:id), from)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
@link = options[:link]
|
17
17
|
@message = options[:message]
|
18
|
-
|
18
|
+
if options[:updated_time]
|
19
|
+
@updated_time = Time.parse(options[:updated_time])
|
20
|
+
end
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
data/lib/fb_graph/note.rb
CHANGED
@@ -8,15 +8,19 @@ module FbGraph
|
|
8
8
|
super
|
9
9
|
if (from = options[:from])
|
10
10
|
@from = if from[:category]
|
11
|
-
FbGraph::Page.new(from.delete(:id), from)
|
11
|
+
FbGraph::Page.new(from.delete(:id), from)
|
12
12
|
else
|
13
|
-
FbGraph::User.new(from.delete(:id), from)
|
13
|
+
FbGraph::User.new(from.delete(:id), from)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
@subject = options[:subject]
|
17
17
|
@message = options[:message]
|
18
|
-
|
19
|
-
|
18
|
+
if options[:created_time]
|
19
|
+
@created_time = Time.parse(options[:created_time])
|
20
|
+
end
|
21
|
+
if options[:updated_time]
|
22
|
+
@updated_time = Time.parse(options[:updated_time])
|
23
|
+
end
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end
|
data/lib/fb_graph/photo.rb
CHANGED
@@ -8,15 +8,15 @@ module FbGraph
|
|
8
8
|
super
|
9
9
|
if (from = options[:from])
|
10
10
|
@from = if from[:category]
|
11
|
-
FbGraph::Page.new(from.delete(:id), from)
|
11
|
+
FbGraph::Page.new(from.delete(:id), from)
|
12
12
|
else
|
13
|
-
FbGraph::User.new(from.delete(:id), from)
|
13
|
+
FbGraph::User.new(from.delete(:id), from)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
@tags = []
|
17
17
|
if options[:tags]
|
18
18
|
FbGraph::Collection.new(options[:tags]).each do |tag|
|
19
|
-
@tags << FbGraph::Tag.new(tag.delete(:id), tag)
|
19
|
+
@tags << FbGraph::Tag.new(tag.delete(:id), tag)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
@name = options[:name]
|
@@ -25,8 +25,12 @@ module FbGraph
|
|
25
25
|
@height = options[:height]
|
26
26
|
@width = options[:width]
|
27
27
|
@link = options[:link]
|
28
|
-
|
29
|
-
|
28
|
+
if options[:created_time]
|
29
|
+
@created_time = Time.parse(options[:created_time])
|
30
|
+
end
|
31
|
+
if options[:updated_time]
|
32
|
+
@updated_time = Time.parse(options[:updated_time])
|
33
|
+
end
|
30
34
|
end
|
31
35
|
end
|
32
36
|
end
|
data/lib/fb_graph/post.rb
CHANGED
@@ -8,34 +8,41 @@ module FbGraph
|
|
8
8
|
super
|
9
9
|
if (from = options[:from])
|
10
10
|
@from = if from[:category]
|
11
|
-
FbGraph::Page.new(from.delete(:id), from)
|
11
|
+
FbGraph::Page.new(from.delete(:id), from)
|
12
12
|
else
|
13
|
-
FbGraph::User.new(from.delete(:id), from)
|
13
|
+
FbGraph::User.new(from.delete(:id), from)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
@to = []
|
17
17
|
if options[:to]
|
18
18
|
FbGraph::Collection.new(options[:to]).each do |to|
|
19
19
|
@to << if to[:category]
|
20
|
-
FbGraph::Page.new(to.delete(:id), to)
|
20
|
+
FbGraph::Page.new(to.delete(:id), to)
|
21
21
|
else
|
22
|
-
FbGraph::User.new(to.delete(:id), to)
|
22
|
+
FbGraph::User.new(to.delete(:id), to)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
26
|
-
@message
|
27
|
-
@picture
|
28
|
-
@link
|
29
|
-
@name
|
30
|
-
@caption
|
31
|
-
@description
|
32
|
-
@source
|
33
|
-
@icon
|
34
|
-
@attribution
|
35
|
-
@actions
|
36
|
-
@likes
|
37
|
-
|
38
|
-
|
26
|
+
@message = options[:message]
|
27
|
+
@picture = options[:picture]
|
28
|
+
@link = options[:link]
|
29
|
+
@name = options[:name]
|
30
|
+
@caption = options[:caption]
|
31
|
+
@description = options[:description]
|
32
|
+
@source = options[:source]
|
33
|
+
@icon = options[:icon]
|
34
|
+
@attribution = options[:attribution]
|
35
|
+
@actions = options[:actions]
|
36
|
+
@likes = options[:likes]
|
37
|
+
if options[:created_time]
|
38
|
+
@created_time = Time.parse(options[:created_time])
|
39
|
+
end
|
40
|
+
if options[:updated_time]
|
41
|
+
@updated_time = Time.parse(options[:updated_time])
|
42
|
+
end
|
43
|
+
|
44
|
+
# cached connection
|
45
|
+
@_comments_ = FbGraph::Collection.new(options[:comments])
|
39
46
|
end
|
40
47
|
end
|
41
48
|
end
|
data/lib/fb_graph/status.rb
CHANGED
@@ -10,11 +10,13 @@ module FbGraph
|
|
10
10
|
@from = if from[:category]
|
11
11
|
FbGraph::Page.new(from.delete(:id), from)
|
12
12
|
else
|
13
|
-
FbGraph::User.new(from.delete(:id), from)
|
13
|
+
FbGraph::User.new(from.delete(:id), from)
|
14
14
|
end
|
15
15
|
end
|
16
|
-
@message
|
17
|
-
|
16
|
+
@message = options[:message]
|
17
|
+
if (updated_time = options.delete(:updated_time))
|
18
|
+
@updated_time = Time.parse(updated_time)
|
19
|
+
end
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
data/lib/fb_graph/tag.rb
CHANGED
@@ -7,7 +7,9 @@ module FbGraph
|
|
7
7
|
def initialize(identifier, options = {})
|
8
8
|
@x = options.delete(:x)
|
9
9
|
@y = options.delete(:y)
|
10
|
-
|
10
|
+
if (created_time = options.delete(:created_time))
|
11
|
+
@created_time = Time.parse(created_time)
|
12
|
+
end
|
11
13
|
@user = User.new(identifier, options)
|
12
14
|
end
|
13
15
|
end
|
data/lib/fb_graph/user.rb
CHANGED
@@ -36,11 +36,23 @@ module FbGraph
|
|
36
36
|
@first_name = options[:first_name]
|
37
37
|
@link = options[:link]
|
38
38
|
@about = options[:about]
|
39
|
-
@birthday = options[:birthday]
|
40
|
-
@work = options[:work]
|
41
|
-
@education = options[:education]
|
42
39
|
@email = options[:email]
|
43
|
-
|
40
|
+
if options[:birthday]
|
41
|
+
@birthday = Date.parse(options[:birthday])
|
42
|
+
end
|
43
|
+
@work = []
|
44
|
+
if options[:work]
|
45
|
+
options[:work].each do |work|
|
46
|
+
@work << FbGraph::Work.new(work)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
@education = []
|
50
|
+
if options[:education]
|
51
|
+
options[:education].each do |education|
|
52
|
+
@education << FbGraph::Education.new(education)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
@website = options[:website].to_s.split("\n")
|
44
56
|
end
|
45
57
|
|
46
58
|
def self.me(access_token)
|
data/lib/fb_graph/video.rb
CHANGED
@@ -8,16 +8,20 @@ module FbGraph
|
|
8
8
|
super
|
9
9
|
if (from = options[:from])
|
10
10
|
@from = if from[:category]
|
11
|
-
FbGraph::Page.new(from.delete(:id), from)
|
11
|
+
FbGraph::Page.new(from.delete(:id), from)
|
12
12
|
else
|
13
|
-
FbGraph::User.new(from.delete(:id), from)
|
13
|
+
FbGraph::User.new(from.delete(:id), from)
|
14
14
|
end
|
15
15
|
end
|
16
|
-
@message
|
17
|
-
@description
|
18
|
-
@length
|
19
|
-
|
20
|
-
|
16
|
+
@message = options[:message]
|
17
|
+
@description = options[:description]
|
18
|
+
@length = options[:length]
|
19
|
+
if options[:created_time]
|
20
|
+
@created_time = Time.parse(options[:created_time])
|
21
|
+
end
|
22
|
+
if options[:updated_time]
|
23
|
+
@updated_time = Time.parse(options[:updated_time])
|
24
|
+
end
|
21
25
|
end
|
22
26
|
end
|
23
27
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module FbGraph
|
2
|
+
class Work
|
3
|
+
include FbGraph::Comparison
|
4
|
+
|
5
|
+
attr_accessor :employer, :location, :position, :start_date, :end_date
|
6
|
+
|
7
|
+
def initialize(attributes = {})
|
8
|
+
if (employer = attributes[:employer])
|
9
|
+
@employer = FbGraph::Page.new(employer.delete(:id), employer)
|
10
|
+
end
|
11
|
+
if (location = attributes[:location])
|
12
|
+
@location = FbGraph::Page.new(location.delete(:id), location)
|
13
|
+
end
|
14
|
+
if (position = attributes[:position])
|
15
|
+
@position = FbGraph::Page.new(position.delete(:id), position)
|
16
|
+
end
|
17
|
+
if attributes[:start_date]
|
18
|
+
@start_date = Date.new(*attributes[:start_date].split('-').collect(&:to_i))
|
19
|
+
end
|
20
|
+
if attributes[:end_date] && attributes[:end_date] != '0000-00'
|
21
|
+
@end_date = Date.new(*attributes[:end_date].split('-').collect(&:to_i))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/fb_graph.rb
CHANGED
@@ -35,6 +35,7 @@ require 'fb_graph/connections'
|
|
35
35
|
require 'fb_graph/node'
|
36
36
|
require 'fb_graph/album'
|
37
37
|
require 'fb_graph/comment'
|
38
|
+
require 'fb_graph/education'
|
38
39
|
require 'fb_graph/event'
|
39
40
|
require 'fb_graph/group'
|
40
41
|
require 'fb_graph/link'
|
@@ -47,3 +48,4 @@ require 'fb_graph/tag'
|
|
47
48
|
require 'fb_graph/user'
|
48
49
|
require 'fb_graph/venue'
|
49
50
|
require 'fb_graph/video'
|
51
|
+
require 'fb_graph/work'
|
@@ -0,0 +1,97 @@
|
|
1
|
+
{
|
2
|
+
"id": "19292868552_118464504835613",
|
3
|
+
"from": {
|
4
|
+
"name": "Facebook Platform",
|
5
|
+
"category": "Technology",
|
6
|
+
"id": "19292868552"
|
7
|
+
},
|
8
|
+
"message": "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",
|
9
|
+
"created_time": "2010-04-15T17:37:03+0000",
|
10
|
+
"updated_time": "2010-04-22T18:19:13+0000",
|
11
|
+
"likes": 61,
|
12
|
+
"comments": {
|
13
|
+
"data": [
|
14
|
+
{
|
15
|
+
"id": "19292868552_118464504835613_388624",
|
16
|
+
"from": {
|
17
|
+
"name": "Sisi GeLap Qu",
|
18
|
+
"id": "1458135488"
|
19
|
+
},
|
20
|
+
"message": "hadir",
|
21
|
+
"created_time": "2010-04-15T17:37:52+0000"
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"id": "19292868552_118464504835613_390050",
|
25
|
+
"from": {
|
26
|
+
"name": "Goran Kaplovic",
|
27
|
+
"id": "1849687320"
|
28
|
+
},
|
29
|
+
"message": "Platform Fans.. would you like to launch your own facebook integrated FMyLife.com 4 free? check this out: http://facebook.com/Anekdotz",
|
30
|
+
"created_time": "2010-04-15T20:29:35+0000"
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"id": "19292868552_118464504835613_390487",
|
34
|
+
"from": {
|
35
|
+
"name": "Manuela Morales",
|
36
|
+
"id": "1259255079"
|
37
|
+
},
|
38
|
+
"message": "become a fan plz http://www.facebook.com/?sk=messages&tid=1426513385890#!/pages/Juanita-Rojas-Gabriela-Bernal/105811462793768?ref=nf <---please become a fannn \u2665",
|
39
|
+
"created_time": "2010-04-15T21:23:27+0000"
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"id": "19292868552_118464504835613_391357",
|
43
|
+
"from": {
|
44
|
+
"name": "Gotti Hase Lepit",
|
45
|
+
"id": "1151607928"
|
46
|
+
},
|
47
|
+
"message": "http://www.facebook.com/home.php#!/pages/Munchen-Germany/Lepit-Clothing/97683488231?ref=ts",
|
48
|
+
"created_time": "2010-04-15T23:24:01+0000"
|
49
|
+
},
|
50
|
+
{
|
51
|
+
"id": "19292868552_118464504835613_395097",
|
52
|
+
"from": {
|
53
|
+
"name": "Sinem \u00d6zt\u00fcrk",
|
54
|
+
"id": "1648592169"
|
55
|
+
},
|
56
|
+
"message": "yetkililerin dikkatin habibe \u00f6zt\u00fcrk budak adl\u0131 hesab\u0131m anlams\u0131zca kapat\u0131lm\u0131\u015f okadar mail \u00e7ektigime g\u00f6re bir ileriye d\u00f6n\u00fck cevap alamad\u0131m ",
|
57
|
+
"created_time": "2010-04-16T11:01:56+0000"
|
58
|
+
},
|
59
|
+
{
|
60
|
+
"id": "19292868552_118464504835613_395110",
|
61
|
+
"from": {
|
62
|
+
"name": "Sinem \u00d6zt\u00fcrk",
|
63
|
+
"id": "1648592169"
|
64
|
+
},
|
65
|
+
"message": "d\u00fcn bir yaz\u0131 yaz\u0131lm\u0131\u015f kimlik fotokopisini istiyor kay\u0131t ederken bu t\u00fcr bilgi istemmemi\u015fken kapat\u0131ktan sonra neye dayanarak bu bilgiyi isteye biliniyor ",
|
66
|
+
"created_time": "2010-04-16T11:03:27+0000"
|
67
|
+
},
|
68
|
+
{
|
69
|
+
"id": "19292868552_118464504835613_395124",
|
70
|
+
"from": {
|
71
|
+
"name": "Sinem \u00d6zt\u00fcrk",
|
72
|
+
"id": "1648592169"
|
73
|
+
},
|
74
|
+
"message": "face yeklilerinden rica ediyorum bu nas\u0131l bir yer cevap bekliyorum ben sorunum i\u00e7in nereye ba\u015f vurmam gerek adresim ba\u015fkalar\u0131 taraf\u0131ndan kullan\u0131lmad\u0131g\u0131ndan nas\u0131l emin olabilirim benim resmimde vard\u0131 belkide resmimi kullanacak \nl\u00fctfen cevap",
|
75
|
+
"created_time": "2010-04-16T11:06:01+0000"
|
76
|
+
},
|
77
|
+
{
|
78
|
+
"id": "19292868552_118464504835613_429610",
|
79
|
+
"from": {
|
80
|
+
"name": "Mubashir Tanvir Zaver \u0645\u0628\u0634\u0631\u062a\u0646\u0648\u06cc\u0631\u0632\u06cc\u0648\u0631",
|
81
|
+
"id": "1181826641"
|
82
|
+
},
|
83
|
+
"message": ".\nThe \"AMAZING\" Page:\n\nhttp://www.facebook.com/profile.php?id=1181826641&ref=profile#!/pages/AMAZING/10150157765120055?ref=ts",
|
84
|
+
"created_time": "2010-04-20T14:48:57+0000"
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"id": "19292868552_118464504835613_449320",
|
88
|
+
"from": {
|
89
|
+
"name": "Steve Boyer",
|
90
|
+
"id": "17814467"
|
91
|
+
},
|
92
|
+
"message": "These changes are amazing. Watch out world! FB is coming!",
|
93
|
+
"created_time": "2010-04-22T18:19:13+0000"
|
94
|
+
}
|
95
|
+
]
|
96
|
+
}
|
97
|
+
}
|