fb_graph 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/fb_graph.gemspec +37 -10
- data/lib/fb_graph/action.rb +12 -0
- data/lib/fb_graph/auth/cookie.rb +1 -1
- data/lib/fb_graph/checkin.rb +7 -6
- data/lib/fb_graph/collection.rb +5 -5
- data/lib/fb_graph/group.rb +3 -1
- data/lib/fb_graph/link.rb +1 -0
- data/lib/fb_graph/location.rb +20 -0
- data/lib/fb_graph/node.rb +2 -5
- data/lib/fb_graph/page.rb +9 -3
- data/lib/fb_graph/post.rb +22 -2
- data/lib/fb_graph/privacy.rb +27 -0
- data/lib/fb_graph/searchable/result.rb +1 -1
- data/lib/fb_graph/serialization.rb +15 -0
- data/lib/fb_graph/targeting.rb +23 -0
- data/lib/fb_graph/venue.rb +3 -6
- data/lib/fb_graph.rb +10 -4
- data/spec/fake_json/applications/test_users/created.json +5 -0
- data/spec/fake_json/applications/test_users/private.json +14 -0
- data/spec/fake_json/pages/search_fb_graph.json +9 -0
- data/spec/fake_json/pages/search_google.json +133 -0
- data/spec/fake_json/posts/no_comments.json +31 -0
- data/spec/fake_json/token_response.json +1 -0
- data/spec/fake_json/users/checkins/posted.json +1 -0
- data/spec/fb_graph/application_spec.rb +16 -1
- data/spec/fb_graph/auth/cookie_spec.rb +19 -0
- data/spec/fb_graph/auth_spec.rb +15 -0
- data/spec/fb_graph/checkin_spec.rb +6 -1
- data/spec/fb_graph/collection_spec.rb +6 -0
- data/spec/fb_graph/connections/checkins_spec.rb +18 -0
- data/spec/fb_graph/connections/comments_spec.rb +24 -1
- data/spec/fb_graph/connections/feed_spec.rb +8 -2
- data/spec/fb_graph/connections/home_spec.rb +4 -1
- data/spec/fb_graph/connections/likes_spec.rb +2 -2
- data/spec/fb_graph/connections/posts_spec.rb +4 -1
- data/spec/fb_graph/connections/subscriptions_spec.rb +31 -0
- data/spec/fb_graph/connections/tagged_spec.rb +4 -1
- data/spec/fb_graph/connections/test_users_spec.rb +49 -0
- data/spec/fb_graph/exception_spec.rb +47 -0
- data/spec/fb_graph/location_spec.rb +28 -0
- data/spec/fb_graph/node_spec.rb +27 -0
- data/spec/fb_graph/page_spec.rb +7 -0
- data/spec/fb_graph/post_spec.rb +70 -1
- data/spec/fb_graph/privacy_spec.rb +33 -0
- data/spec/fb_graph/searchable_spec.rb +31 -0
- data/spec/fb_graph/seriarization_spec.rb +29 -0
- data/spec/fb_graph/targeting_spec.rb +34 -0
- data/spec/fb_graph/test_user_spec.rb +14 -8
- data/spec/helpers/fake_json_helper.rb +8 -0
- metadata +43 -12
data/Rakefile
CHANGED
@@ -10,8 +10,8 @@ begin
|
|
10
10
|
gem.email = 'nov@matake.jp'
|
11
11
|
gem.homepage = 'http://github.com/nov/fb_graph'
|
12
12
|
gem.authors = ['nov matake']
|
13
|
-
gem.add_dependency 'json'
|
14
|
-
gem.add_dependency 'activesupport'
|
13
|
+
gem.add_dependency 'json', '>= 1.4.3'
|
14
|
+
gem.add_dependency 'activesupport', '>= 2.3'
|
15
15
|
gem.add_dependency 'rest-client', '>= 1.4'
|
16
16
|
gem.add_dependency 'oauth2', '>= 0.1.0'
|
17
17
|
gem.add_development_dependency 'rspec', '~> 1.3'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.4
|
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 = "1.2.
|
8
|
+
s.version = "1.2.4"
|
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{
|
12
|
+
s.date = %q{2011-01-03}
|
13
13
|
s.description = %q{A full-stack Facebook Graph API wrapper in Ruby.}
|
14
14
|
s.email = %q{nov@matake.jp}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
"assets/fb_graph.png",
|
27
27
|
"fb_graph.gemspec",
|
28
28
|
"lib/fb_graph.rb",
|
29
|
+
"lib/fb_graph/action.rb",
|
29
30
|
"lib/fb_graph/album.rb",
|
30
31
|
"lib/fb_graph/application.rb",
|
31
32
|
"lib/fb_graph/auth.rb",
|
@@ -76,19 +77,23 @@ Gem::Specification.new do |s|
|
|
76
77
|
"lib/fb_graph/group.rb",
|
77
78
|
"lib/fb_graph/insight.rb",
|
78
79
|
"lib/fb_graph/link.rb",
|
80
|
+
"lib/fb_graph/location.rb",
|
79
81
|
"lib/fb_graph/node.rb",
|
80
82
|
"lib/fb_graph/note.rb",
|
81
83
|
"lib/fb_graph/page.rb",
|
82
84
|
"lib/fb_graph/photo.rb",
|
83
85
|
"lib/fb_graph/place.rb",
|
84
86
|
"lib/fb_graph/post.rb",
|
87
|
+
"lib/fb_graph/privacy.rb",
|
85
88
|
"lib/fb_graph/project.rb",
|
86
89
|
"lib/fb_graph/query.rb",
|
87
90
|
"lib/fb_graph/searchable.rb",
|
88
91
|
"lib/fb_graph/searchable/result.rb",
|
92
|
+
"lib/fb_graph/serialization.rb",
|
89
93
|
"lib/fb_graph/status.rb",
|
90
94
|
"lib/fb_graph/subscription.rb",
|
91
95
|
"lib/fb_graph/tag.rb",
|
96
|
+
"lib/fb_graph/targeting.rb",
|
92
97
|
"lib/fb_graph/test_user.rb",
|
93
98
|
"lib/fb_graph/user.rb",
|
94
99
|
"lib/fb_graph/venue.rb",
|
@@ -97,6 +102,8 @@ Gem::Specification.new do |s|
|
|
97
102
|
"spec/fake_json/albums/photos/matake_private.json",
|
98
103
|
"spec/fake_json/albums/photos/post_with_valid_access_token.json",
|
99
104
|
"spec/fake_json/applications/subscriptions/fb_graph_private.json",
|
105
|
+
"spec/fake_json/applications/test_users/created.json",
|
106
|
+
"spec/fake_json/applications/test_users/private.json",
|
100
107
|
"spec/fake_json/checkins/search_private.json",
|
101
108
|
"spec/fake_json/checkins/search_public.json",
|
102
109
|
"spec/fake_json/events/attending/post_with_valid_access_token.json",
|
@@ -117,6 +124,8 @@ Gem::Specification.new do |s|
|
|
117
124
|
"spec/fake_json/pages/notes/post_with_valid_access_token.json",
|
118
125
|
"spec/fake_json/pages/platform_private.json",
|
119
126
|
"spec/fake_json/pages/platform_public.json",
|
127
|
+
"spec/fake_json/pages/search_fb_graph.json",
|
128
|
+
"spec/fake_json/pages/search_google.json",
|
120
129
|
"spec/fake_json/pages/statuses/platform_private.json",
|
121
130
|
"spec/fake_json/pages/statuses/platform_public.json",
|
122
131
|
"spec/fake_json/posts/comments/post_with_invalid_access_token.json",
|
@@ -125,12 +134,14 @@ Gem::Specification.new do |s|
|
|
125
134
|
"spec/fake_json/posts/likes/post_with_invalid_access_token.json",
|
126
135
|
"spec/fake_json/posts/likes/post_with_valid_access_token.json",
|
127
136
|
"spec/fake_json/posts/likes/post_without_access_token.json",
|
137
|
+
"spec/fake_json/posts/no_comments.json",
|
128
138
|
"spec/fake_json/posts/platform_private.json",
|
129
139
|
"spec/fake_json/posts/platform_public.json",
|
130
140
|
"spec/fake_json/query/user/with_invalid_token.json",
|
131
141
|
"spec/fake_json/query/user/with_valid_token.json",
|
132
142
|
"spec/fake_json/query/user/without_token.json",
|
133
143
|
"spec/fake_json/statuses/with_likes.json",
|
144
|
+
"spec/fake_json/token_response.json",
|
134
145
|
"spec/fake_json/true.json",
|
135
146
|
"spec/fake_json/users/accounts/matake_private.json",
|
136
147
|
"spec/fake_json/users/accounts/matake_private_with_manage_pages_permission.json",
|
@@ -146,6 +157,7 @@ Gem::Specification.new do |s|
|
|
146
157
|
"spec/fake_json/users/books/matake_public.json",
|
147
158
|
"spec/fake_json/users/checkins/mattt_private.json",
|
148
159
|
"spec/fake_json/users/checkins/mattt_public.json",
|
160
|
+
"spec/fake_json/users/checkins/posted.json",
|
149
161
|
"spec/fake_json/users/events/matake_private.json",
|
150
162
|
"spec/fake_json/users/events/matake_public.json",
|
151
163
|
"spec/fake_json/users/events/post_with_valid_access_token.json",
|
@@ -187,6 +199,7 @@ Gem::Specification.new do |s|
|
|
187
199
|
"spec/fake_json/users/videos/kirk_private.json",
|
188
200
|
"spec/fb_graph/album_spec.rb",
|
189
201
|
"spec/fb_graph/application_spec.rb",
|
202
|
+
"spec/fb_graph/auth/cookie_spec.rb",
|
190
203
|
"spec/fb_graph/auth_spec.rb",
|
191
204
|
"spec/fb_graph/checkin_spec.rb",
|
192
205
|
"spec/fb_graph/collection_spec.rb",
|
@@ -224,23 +237,30 @@ Gem::Specification.new do |s|
|
|
224
237
|
"spec/fb_graph/connections/subscriptions_spec.rb",
|
225
238
|
"spec/fb_graph/connections/tagged_spec.rb",
|
226
239
|
"spec/fb_graph/connections/television_spec.rb",
|
240
|
+
"spec/fb_graph/connections/test_users_spec.rb",
|
227
241
|
"spec/fb_graph/connections/videos_spec.rb",
|
228
242
|
"spec/fb_graph/education_spec.rb",
|
229
243
|
"spec/fb_graph/event_spec.rb",
|
244
|
+
"spec/fb_graph/exception_spec.rb",
|
230
245
|
"spec/fb_graph/friend_list_spec.rb",
|
231
246
|
"spec/fb_graph/group_spec.rb",
|
232
247
|
"spec/fb_graph/insight_spec.rb",
|
233
248
|
"spec/fb_graph/link_spec.rb",
|
249
|
+
"spec/fb_graph/location_spec.rb",
|
234
250
|
"spec/fb_graph/node_spec.rb",
|
235
251
|
"spec/fb_graph/note_spec.rb",
|
236
252
|
"spec/fb_graph/page_spec.rb",
|
237
253
|
"spec/fb_graph/photo_spec.rb",
|
238
254
|
"spec/fb_graph/post_spec.rb",
|
255
|
+
"spec/fb_graph/privacy_spec.rb",
|
239
256
|
"spec/fb_graph/project_spec.rb",
|
240
257
|
"spec/fb_graph/query/core_spec.rb",
|
258
|
+
"spec/fb_graph/searchable_spec.rb",
|
259
|
+
"spec/fb_graph/seriarization_spec.rb",
|
241
260
|
"spec/fb_graph/status_spec.rb",
|
242
261
|
"spec/fb_graph/subscription_spec.rb",
|
243
262
|
"spec/fb_graph/tag_spec.rb",
|
263
|
+
"spec/fb_graph/targeting_spec.rb",
|
244
264
|
"spec/fb_graph/test_user_spec.rb",
|
245
265
|
"spec/fb_graph/user_spec.rb",
|
246
266
|
"spec/fb_graph/venue_spec.rb",
|
@@ -252,11 +272,12 @@ Gem::Specification.new do |s|
|
|
252
272
|
]
|
253
273
|
s.homepage = %q{http://github.com/nov/fb_graph}
|
254
274
|
s.require_paths = ["lib"]
|
255
|
-
s.rubygems_version = %q{1.
|
275
|
+
s.rubygems_version = %q{1.4.1}
|
256
276
|
s.summary = %q{A full-stack Facebook Graph API wrapper in Ruby.}
|
257
277
|
s.test_files = [
|
258
278
|
"spec/fb_graph/album_spec.rb",
|
259
279
|
"spec/fb_graph/application_spec.rb",
|
280
|
+
"spec/fb_graph/auth/cookie_spec.rb",
|
260
281
|
"spec/fb_graph/auth_spec.rb",
|
261
282
|
"spec/fb_graph/checkin_spec.rb",
|
262
283
|
"spec/fb_graph/collection_spec.rb",
|
@@ -294,23 +315,30 @@ Gem::Specification.new do |s|
|
|
294
315
|
"spec/fb_graph/connections/subscriptions_spec.rb",
|
295
316
|
"spec/fb_graph/connections/tagged_spec.rb",
|
296
317
|
"spec/fb_graph/connections/television_spec.rb",
|
318
|
+
"spec/fb_graph/connections/test_users_spec.rb",
|
297
319
|
"spec/fb_graph/connections/videos_spec.rb",
|
298
320
|
"spec/fb_graph/education_spec.rb",
|
299
321
|
"spec/fb_graph/event_spec.rb",
|
322
|
+
"spec/fb_graph/exception_spec.rb",
|
300
323
|
"spec/fb_graph/friend_list_spec.rb",
|
301
324
|
"spec/fb_graph/group_spec.rb",
|
302
325
|
"spec/fb_graph/insight_spec.rb",
|
303
326
|
"spec/fb_graph/link_spec.rb",
|
327
|
+
"spec/fb_graph/location_spec.rb",
|
304
328
|
"spec/fb_graph/node_spec.rb",
|
305
329
|
"spec/fb_graph/note_spec.rb",
|
306
330
|
"spec/fb_graph/page_spec.rb",
|
307
331
|
"spec/fb_graph/photo_spec.rb",
|
308
332
|
"spec/fb_graph/post_spec.rb",
|
333
|
+
"spec/fb_graph/privacy_spec.rb",
|
309
334
|
"spec/fb_graph/project_spec.rb",
|
310
335
|
"spec/fb_graph/query/core_spec.rb",
|
336
|
+
"spec/fb_graph/searchable_spec.rb",
|
337
|
+
"spec/fb_graph/seriarization_spec.rb",
|
311
338
|
"spec/fb_graph/status_spec.rb",
|
312
339
|
"spec/fb_graph/subscription_spec.rb",
|
313
340
|
"spec/fb_graph/tag_spec.rb",
|
341
|
+
"spec/fb_graph/targeting_spec.rb",
|
314
342
|
"spec/fb_graph/test_user_spec.rb",
|
315
343
|
"spec/fb_graph/user_spec.rb",
|
316
344
|
"spec/fb_graph/venue_spec.rb",
|
@@ -321,20 +349,19 @@ Gem::Specification.new do |s|
|
|
321
349
|
]
|
322
350
|
|
323
351
|
if s.respond_to? :specification_version then
|
324
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
325
352
|
s.specification_version = 3
|
326
353
|
|
327
354
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
328
|
-
s.add_runtime_dependency(%q<json>, [">=
|
329
|
-
s.add_runtime_dependency(%q<activesupport>, [">=
|
355
|
+
s.add_runtime_dependency(%q<json>, [">= 1.4.3"])
|
356
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 2.3"])
|
330
357
|
s.add_runtime_dependency(%q<rest-client>, [">= 1.4"])
|
331
358
|
s.add_runtime_dependency(%q<oauth2>, [">= 0.1.0"])
|
332
359
|
s.add_development_dependency(%q<rspec>, ["~> 1.3"])
|
333
360
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
334
361
|
s.add_development_dependency(%q<fakeweb>, [">= 1.3.0"])
|
335
362
|
else
|
336
|
-
s.add_dependency(%q<json>, [">=
|
337
|
-
s.add_dependency(%q<activesupport>, [">=
|
363
|
+
s.add_dependency(%q<json>, [">= 1.4.3"])
|
364
|
+
s.add_dependency(%q<activesupport>, [">= 2.3"])
|
338
365
|
s.add_dependency(%q<rest-client>, [">= 1.4"])
|
339
366
|
s.add_dependency(%q<oauth2>, [">= 0.1.0"])
|
340
367
|
s.add_dependency(%q<rspec>, ["~> 1.3"])
|
@@ -342,8 +369,8 @@ Gem::Specification.new do |s|
|
|
342
369
|
s.add_dependency(%q<fakeweb>, [">= 1.3.0"])
|
343
370
|
end
|
344
371
|
else
|
345
|
-
s.add_dependency(%q<json>, [">=
|
346
|
-
s.add_dependency(%q<activesupport>, [">=
|
372
|
+
s.add_dependency(%q<json>, [">= 1.4.3"])
|
373
|
+
s.add_dependency(%q<activesupport>, [">= 2.3"])
|
347
374
|
s.add_dependency(%q<rest-client>, [">= 1.4"])
|
348
375
|
s.add_dependency(%q<oauth2>, [">= 0.1.0"])
|
349
376
|
s.add_dependency(%q<rspec>, ["~> 1.3"])
|
data/lib/fb_graph/auth/cookie.rb
CHANGED
data/lib/fb_graph/checkin.rb
CHANGED
@@ -2,7 +2,7 @@ module FbGraph
|
|
2
2
|
class Checkin < Node
|
3
3
|
extend Searchable
|
4
4
|
|
5
|
-
attr_accessor :from, :tags, :place, :message, :
|
5
|
+
attr_accessor :from, :tags, :place, :message, :application, :created_time
|
6
6
|
|
7
7
|
def initialize(identifier, attributes = {})
|
8
8
|
super
|
@@ -16,13 +16,14 @@ module FbGraph
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
if (place = attributes[:place])
|
19
|
-
@place =
|
19
|
+
@place = case place
|
20
|
+
when String, Integer
|
21
|
+
Place.new(place)
|
22
|
+
when Hash
|
23
|
+
Place.new(place.delete(:id), place)
|
24
|
+
end
|
20
25
|
end
|
21
26
|
@message = attributes[:message]
|
22
|
-
if (coordinates = attributes[:coordinates])
|
23
|
-
# NOTE: it seems this attributes isn't used now
|
24
|
-
@coordinates = Venue.new(location)
|
25
|
-
end
|
26
27
|
if (application = attributes[:application])
|
27
28
|
@application = Application.new(application.delete(:id), application)
|
28
29
|
end
|
data/lib/fb_graph/collection.rb
CHANGED
@@ -12,7 +12,7 @@ module FbGraph
|
|
12
12
|
when nil
|
13
13
|
collection = {:data => [], :count => 0}
|
14
14
|
else
|
15
|
-
raise "Invalid collection"
|
15
|
+
raise ArgumentError.new("Invalid collection")
|
16
16
|
end
|
17
17
|
|
18
18
|
# NOTE: Graph API returns {"data":{"to":[null]}} sometimes... :(
|
@@ -38,11 +38,11 @@ module FbGraph
|
|
38
38
|
params = {}
|
39
39
|
query.split('&').each do |q|
|
40
40
|
key, value = q.split('=')
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
!['limit', 'offset', 'until', 'since'].include?(k)
|
41
|
+
if ['limit', 'offset', 'until', 'since'].include?(key)
|
42
|
+
params[key.to_sym] = URI.unescape(value)
|
43
|
+
end
|
45
44
|
end
|
45
|
+
params
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
data/lib/fb_graph/group.rb
CHANGED
@@ -5,7 +5,7 @@ module FbGraph
|
|
5
5
|
include Connections::Picture
|
6
6
|
extend Searchable
|
7
7
|
|
8
|
-
attr_accessor :owner, :name, :description, :link, :venue, :privacy, :updated_time
|
8
|
+
attr_accessor :owner, :name, :description, :link, :icon, :venue, :privacy, :version, :updated_time
|
9
9
|
|
10
10
|
def initialize(identifier, attributes = {})
|
11
11
|
super
|
@@ -15,7 +15,9 @@ module FbGraph
|
|
15
15
|
@name = attributes[:name]
|
16
16
|
@description = attributes[:description]
|
17
17
|
@link = attributes[:link]
|
18
|
+
@icon = attributes[:icon]
|
18
19
|
@privacy = attributes[:privacy]
|
20
|
+
@version = attributes[:version]
|
19
21
|
if attributes[:venue]
|
20
22
|
@venue = Venue.new(attributes[:venue])
|
21
23
|
end
|
data/lib/fb_graph/link.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
module FbGraph
|
2
|
+
class Location
|
3
|
+
include Comparison
|
4
|
+
include Serialization
|
5
|
+
|
6
|
+
attr_accessor :latitude, :longitude
|
7
|
+
|
8
|
+
def initialize(attriutes = {})
|
9
|
+
@latitude = attriutes[:latitude]
|
10
|
+
@longitude = attriutes[:longitude]
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_hash
|
14
|
+
{
|
15
|
+
:latitude => self.latitude,
|
16
|
+
:longitude => self.longitude
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/fb_graph/node.rb
CHANGED
@@ -52,10 +52,7 @@ module FbGraph
|
|
52
52
|
_params_ = stringfy_access_token(params)
|
53
53
|
_endpoint_ = build_endpoint(_params_.merge!(:method => :delete))
|
54
54
|
handle_response do
|
55
|
-
|
56
|
-
# DELETE method didn't work for some reason.
|
57
|
-
# Use POST with "method=delete" for now.
|
58
|
-
RestClient.post(_endpoint_, _params_.merge!(:method => :delete))
|
55
|
+
RestClient.delete(_endpoint_)
|
59
56
|
end
|
60
57
|
end
|
61
58
|
|
@@ -66,7 +63,7 @@ module FbGraph
|
|
66
63
|
params.delete_if do |k, v|
|
67
64
|
v.blank?
|
68
65
|
end
|
69
|
-
if params.delete(:method)
|
66
|
+
if [:get, :delete].include?(params.delete(:method)) && params.present?
|
70
67
|
_endpoint_ << "?#{params.to_query}"
|
71
68
|
end
|
72
69
|
_endpoint_
|
data/lib/fb_graph/page.rb
CHANGED
@@ -16,7 +16,7 @@ module FbGraph
|
|
16
16
|
include Connections::Videos
|
17
17
|
extend Searchable
|
18
18
|
|
19
|
-
attr_accessor :name, :username, :link, :category, :founded, :company_overview, :mission, :products, :fan_count, :location, :website, :like_count, :
|
19
|
+
attr_accessor :name, :username, :link, :category, :founded, :is_community_page, :company_overview, :general_info, :mission, :products, :release_date, :fan_count, :location, :website, :like_count, :checkin_count
|
20
20
|
|
21
21
|
def initialize(identifier, attributes = {})
|
22
22
|
super
|
@@ -27,17 +27,23 @@ module FbGraph
|
|
27
27
|
if (founded = attributes[:founded])
|
28
28
|
@founded = Date.parse(founded) rescue Date.new(founded.to_i)
|
29
29
|
end
|
30
|
+
@is_community_page = attributes[:is_community_page]
|
30
31
|
@company_overview = attributes[:company_overview]
|
31
|
-
@
|
32
|
+
@general_info = attributes[:general_info]
|
33
|
+
@mission = attributes[:mission]
|
32
34
|
if (products = attributes[:products])
|
33
35
|
@products = products.split "\n"
|
34
36
|
end
|
37
|
+
if (release_date = attributes[:release_date])
|
38
|
+
@release_date = Date.parse(release_date) rescue release_date
|
39
|
+
end
|
35
40
|
@fan_count = attributes[:fan_count]
|
36
41
|
if (location = attributes[:location])
|
37
|
-
@
|
42
|
+
@location = Venue.new(location)
|
38
43
|
end
|
39
44
|
@website = attributes[:website]
|
40
45
|
@like_count = attributes[:likes]
|
46
|
+
@checkin_count = attributes[:checkins]
|
41
47
|
end
|
42
48
|
end
|
43
49
|
end
|
data/lib/fb_graph/post.rb
CHANGED
@@ -4,7 +4,7 @@ module FbGraph
|
|
4
4
|
include Connections::Likes
|
5
5
|
extend Searchable
|
6
6
|
|
7
|
-
attr_accessor :from, :to, :message, :picture, :link, :name, :caption, :description, :source, :icon, :attribution, :actions, :like_count, :created_time, :updated_time
|
7
|
+
attr_accessor :from, :to, :message, :picture, :link, :name, :caption, :description, :source, :icon, :attribution, :actions, :like_count, :type, :privacy, :targeting, :created_time, :updated_time
|
8
8
|
|
9
9
|
def initialize(identifier, attributes = {})
|
10
10
|
super
|
@@ -34,8 +34,28 @@ module FbGraph
|
|
34
34
|
@source = attributes[:source]
|
35
35
|
@icon = attributes[:icon]
|
36
36
|
@attribution = attributes[:attribution]
|
37
|
-
@actions =
|
37
|
+
@actions = []
|
38
|
+
if attributes[:actions]
|
39
|
+
attributes[:actions].each do |action|
|
40
|
+
@actions << FbGraph::Action.new(action)
|
41
|
+
end
|
42
|
+
end
|
38
43
|
@like_count = attributes[:likes]
|
44
|
+
@type = attributes[:type]
|
45
|
+
if attributes[:privacy]
|
46
|
+
@privacy = if attributes[:privacy].is_a?(Privacy)
|
47
|
+
attributes[:privacy]
|
48
|
+
else
|
49
|
+
Privacy.new(attributes[:privacy])
|
50
|
+
end
|
51
|
+
end
|
52
|
+
if attributes[:targeting]
|
53
|
+
@targeting = if attributes[:targeting].is_a?(Targeting)
|
54
|
+
attributes[:targeting]
|
55
|
+
else
|
56
|
+
Targeting.new(attributes[:targeting])
|
57
|
+
end
|
58
|
+
end
|
39
59
|
if attributes[:created_time]
|
40
60
|
@created_time = Time.parse(attributes[:created_time]).utc
|
41
61
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module FbGraph
|
2
|
+
class Privacy
|
3
|
+
include Comparison
|
4
|
+
include Serialization
|
5
|
+
|
6
|
+
attr_accessor :value, :friends, :networks, :allow, :deny
|
7
|
+
|
8
|
+
def initialize(attriutes = {})
|
9
|
+
@value = attriutes[:value]
|
10
|
+
@description = attriutes[:description]
|
11
|
+
@friends = attriutes[:friends]
|
12
|
+
@networks = attriutes[:networks]
|
13
|
+
@allow = attriutes[:allow]
|
14
|
+
@deny = attriutes[:deny]
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_hash
|
18
|
+
{
|
19
|
+
:value => self.value,
|
20
|
+
:friends => self.friends,
|
21
|
+
:networks => self.networks,
|
22
|
+
:allow => self.allow,
|
23
|
+
:deny => self.deny
|
24
|
+
}
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -21,7 +21,7 @@ module FbGraph
|
|
21
21
|
|
22
22
|
def previous(_options_ = {})
|
23
23
|
if self.collection.previous.present?
|
24
|
-
self.
|
24
|
+
self.klass.search(self.query, self.options.merge(_options_).merge(self.collection.previous))
|
25
25
|
else
|
26
26
|
self.class.new(self.query, self.klass)
|
27
27
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module FbGraph
|
2
|
+
class Targeting
|
3
|
+
include Comparison
|
4
|
+
|
5
|
+
attr_accessor :country, :city, :region, :locale
|
6
|
+
|
7
|
+
def initialize(attriutes = {})
|
8
|
+
@country = attriutes[:country]
|
9
|
+
@city = attriutes[:city]
|
10
|
+
@region = attriutes[:region]
|
11
|
+
@locale = attriutes[:locale]
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_hash
|
15
|
+
{
|
16
|
+
:country => self.country,
|
17
|
+
:city => self.city,
|
18
|
+
:region => self.region,
|
19
|
+
:locale => self.locale
|
20
|
+
}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/fb_graph/venue.rb
CHANGED
@@ -1,17 +1,14 @@
|
|
1
1
|
module FbGraph
|
2
|
-
class Venue
|
3
|
-
|
4
|
-
|
5
|
-
attr_accessor :street, :city, :state, :zip, :country, :latitude, :longitude
|
2
|
+
class Venue < Location
|
3
|
+
attr_accessor :street, :city, :state, :zip, :country
|
6
4
|
|
7
5
|
def initialize(attriutes = {})
|
6
|
+
super
|
8
7
|
@street = attriutes[:street]
|
9
8
|
@city = attriutes[:city]
|
10
9
|
@state = attriutes[:state]
|
11
10
|
@zip = attriutes[:zip]
|
12
11
|
@country = attriutes[:country]
|
13
|
-
@latitude = attriutes[:latitude]
|
14
|
-
@longitude = attriutes[:longitude]
|
15
12
|
end
|
16
13
|
end
|
17
14
|
end
|
data/lib/fb_graph.rb
CHANGED
@@ -47,17 +47,26 @@ end
|
|
47
47
|
|
48
48
|
require 'fb_graph/auth'
|
49
49
|
require 'fb_graph/comparison'
|
50
|
+
require 'fb_graph/serialization'
|
50
51
|
require 'fb_graph/collection'
|
51
52
|
require 'fb_graph/connection'
|
52
53
|
require 'fb_graph/connections'
|
53
54
|
require 'fb_graph/searchable'
|
54
55
|
|
56
|
+
require 'fb_graph/action'
|
57
|
+
require 'fb_graph/education'
|
58
|
+
require 'fb_graph/location'
|
59
|
+
require 'fb_graph/privacy'
|
60
|
+
require 'fb_graph/subscription'
|
61
|
+
require 'fb_graph/targeting'
|
62
|
+
require 'fb_graph/venue'
|
63
|
+
require 'fb_graph/work'
|
64
|
+
|
55
65
|
require 'fb_graph/node'
|
56
66
|
require 'fb_graph/album'
|
57
67
|
require 'fb_graph/application'
|
58
68
|
require 'fb_graph/checkin'
|
59
69
|
require 'fb_graph/comment'
|
60
|
-
require 'fb_graph/education'
|
61
70
|
require 'fb_graph/event'
|
62
71
|
require 'fb_graph/friend_list'
|
63
72
|
require 'fb_graph/group'
|
@@ -70,12 +79,9 @@ require 'fb_graph/place'
|
|
70
79
|
require 'fb_graph/post'
|
71
80
|
require 'fb_graph/project'
|
72
81
|
require 'fb_graph/status'
|
73
|
-
require 'fb_graph/subscription'
|
74
82
|
require 'fb_graph/tag'
|
75
83
|
require 'fb_graph/test_user'
|
76
84
|
require 'fb_graph/user'
|
77
|
-
require 'fb_graph/venue'
|
78
85
|
require 'fb_graph/video'
|
79
|
-
require 'fb_graph/work'
|
80
86
|
|
81
87
|
require 'fb_graph/query'
|
@@ -0,0 +1,5 @@
|
|
1
|
+
{
|
2
|
+
"id": "100001214726501",
|
3
|
+
"access_token": "126213067419995|2.KrbRZTK2zUTmBiNsBeYdCQ__.3600.1293260400-100001214726501|49fj0ZZ-DGHHkvoJ6p-S_rce8TQ",
|
4
|
+
"login_url": "https://www.facebook.com/platform/test_account_login.php?user_id=100001214726501&n=i6CES4b1PIdAFTK"
|
5
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"data": [
|
3
|
+
{
|
4
|
+
"id": "100001214726501",
|
5
|
+
"access_token": "126213067419995|2.KrbRZTK2zUTmBiNsBeYdCQ__.3600.1293260400-100001214726501|49fj0ZZ-DGHHkvoJ6p-S_rce8TQ",
|
6
|
+
"login_url": "https://www.facebook.com/platform/test_account_login.php?user_id=100001214726501&n=i6CES4b1PIdAFTK"
|
7
|
+
},
|
8
|
+
{
|
9
|
+
"id": "100001029958927",
|
10
|
+
"access_token": "126213067419995|2.oFg87Y_Si4ae5oP6YmygPA__.3600.1293260400-100001029958927|ydUEccGLJn2a0pHXD4rsHfurU-Y",
|
11
|
+
"login_url": "https://www.facebook.com/platform/test_account_login.php?user_id=100001029958927&n=pP0gBN5PNKcYiFP"
|
12
|
+
}
|
13
|
+
]
|
14
|
+
}
|