fb_graph2 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/fb_graph2/app.rb +1 -0
- data/lib/fb_graph2/comment.rb +1 -1
- data/lib/fb_graph2/edge/open_graph.rb +3 -0
- data/lib/fb_graph2/edge/open_graph/actions.rb +19 -0
- data/lib/fb_graph2/edge/open_graph/objects.rb +12 -0
- data/lib/fb_graph2/open_graph.rb +3 -0
- data/lib/fb_graph2/open_graph/action.rb +24 -0
- data/lib/fb_graph2/open_graph/object.rb +9 -0
- data/lib/fb_graph2/user.rb +1 -0
- data/spec/fb_graph2/edge/open_graph/actions_spec.rb +28 -0
- data/spec/mock_json/user/og_actions_likes.json +49 -0
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7f32136098b368351724d9f6eebef1f874b3993
|
4
|
+
data.tar.gz: f61f1aaa729b53f4679cfb3af2841455c26a307a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c4c4ef7d93a18400c50fb12c4738794fd08cc656e6a9225c05b943bc493d5d69708256b9459166d422950aabd69dfc8550267cd56e11d7e18835da8a812be5a
|
7
|
+
data.tar.gz: ddac397d67226a515dce09b1955de877ba0cbf4e9d043015e6a75a96ae7fcf255ce5cd5a807110b7142c08ac0548504e37ac581cf27d7c6f118a7bce74af2ed8
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.3
|
data/lib/fb_graph2/app.rb
CHANGED
data/lib/fb_graph2/comment.rb
CHANGED
@@ -6,8 +6,8 @@ module FbGraph2
|
|
6
6
|
register_attributes(
|
7
7
|
raw: [:can_comment, :can_remove, :comment_count, :like_count, :message, :user_likes, :is_hidden, :can_hide],
|
8
8
|
time: [:created_time],
|
9
|
-
user: [:from],
|
10
9
|
comment: [:parent],
|
10
|
+
profile: [:from],
|
11
11
|
profiles: [:message_tags],
|
12
12
|
custom: [:attachment]
|
13
13
|
)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module FbGraph2
|
2
|
+
class Edge
|
3
|
+
module OpenGraph
|
4
|
+
module Actions
|
5
|
+
def og_actions(action_type, params = {})
|
6
|
+
actions = self.edge action_type, params
|
7
|
+
actions.collect! do |action|
|
8
|
+
FbGraph2::OpenGraph::Action.new(action[:id], action).authenticate self.access_token
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def og_action!(action_type, params = {})
|
13
|
+
action = self.post params, edge: action_type
|
14
|
+
FbGraph2::OpenGraph::Action.new(action[:id], params.merge(action)).authenticate self.access_token
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module FbGraph2
|
2
|
+
class Edge
|
3
|
+
module OpenGraph
|
4
|
+
module Objects
|
5
|
+
def og_object!(object_type, params = {})
|
6
|
+
object = self.post params, edge: :objects, edge_scope: object_type
|
7
|
+
FbGraph2::OpenGraph::Object.new(object[:id], params.merge(object)).authenticate self.access_token
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module FbGraph2
|
2
|
+
module OpenGraph
|
3
|
+
class Action < Node
|
4
|
+
include Edge::Comments
|
5
|
+
include Edge::Likes::LikeeContext
|
6
|
+
|
7
|
+
register_attributes(
|
8
|
+
raw: [:message, :no_feed_story, :ref, :type],
|
9
|
+
time: [:end_time, :publish_time, :start_time],
|
10
|
+
app: [:application],
|
11
|
+
profile: [:from],
|
12
|
+
custom: [:object]
|
13
|
+
)
|
14
|
+
|
15
|
+
def initialize(id, attributes = {})
|
16
|
+
super
|
17
|
+
if attributes.include?(:data) && attributes[:data].include?(:object)
|
18
|
+
_object_ = attributes[:data][:object]
|
19
|
+
self.object = OpenGraph::Object.new _object_[:id], _object_
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/fb_graph2/user.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FbGraph2::Edge::OpenGraph::Actions do
|
4
|
+
context 'included in User' do
|
5
|
+
describe '#og_actions' do
|
6
|
+
let(:me) { FbGraph2::User.me('token') }
|
7
|
+
it 'should return an Array of FbGraph2::Post' do
|
8
|
+
actions = mock_graph :get, 'me/og.likes', 'user/og_actions_likes', access_token: 'token' do
|
9
|
+
me.og_actions 'og.likes'
|
10
|
+
end
|
11
|
+
actions.should be_instance_of FbGraph2::Edge
|
12
|
+
actions.should_not be_blank
|
13
|
+
actions.each do |action|
|
14
|
+
action.should be_instance_of FbGraph2::OpenGraph::Action
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '#og_action!' do
|
20
|
+
let(:user) { FbGraph2::User.new('user_id') }
|
21
|
+
it 'should return a FbGraph2::Post' do
|
22
|
+
mock_graph :post, 'user_id/og.likes', 'success_with_id', access_token: 'app_token' do
|
23
|
+
user.authenticate('app_token').og_action! 'og.likes', object: 'https://github.com/nov/fb_graph2/'
|
24
|
+
end.should be_instance_of FbGraph2::OpenGraph::Action
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
{
|
2
|
+
"data": [
|
3
|
+
{
|
4
|
+
"application": {
|
5
|
+
"name": "Test Application",
|
6
|
+
"namespace": "testapp",
|
7
|
+
"id": "495624957249579"
|
8
|
+
},
|
9
|
+
"comments": {
|
10
|
+
"data": [
|
11
|
+
],
|
12
|
+
"can_comment": true,
|
13
|
+
"comment_order": "chronological",
|
14
|
+
"count": 0
|
15
|
+
},
|
16
|
+
"from": {
|
17
|
+
"id": "0815",
|
18
|
+
"name": "John Doe"
|
19
|
+
},
|
20
|
+
"likes": {
|
21
|
+
"data": [
|
22
|
+
],
|
23
|
+
"can_like": true,
|
24
|
+
"count": 0,
|
25
|
+
"user_likes": false
|
26
|
+
},
|
27
|
+
"no_feed_story": false,
|
28
|
+
"publish_time": "2015-04-06T11:53:54+0000",
|
29
|
+
"ref": ".hDGIIZ34.like",
|
30
|
+
"start_time": "2015-04-06T11:53:54+0000",
|
31
|
+
"type": "og.likes",
|
32
|
+
"data": {
|
33
|
+
"object": {
|
34
|
+
"id": "2893972379237",
|
35
|
+
"title": "The awesome test site",
|
36
|
+
"type": "website",
|
37
|
+
"url": "http://example.com"
|
38
|
+
}
|
39
|
+
},
|
40
|
+
"id": "4953745973459"
|
41
|
+
}
|
42
|
+
],
|
43
|
+
"paging": {
|
44
|
+
"cursors": {
|
45
|
+
"before": "MTAzsdfsdfzU2OTM5NDYyNQ==",
|
46
|
+
"after": "NDk2Mz3453czNDergczNzIzNjQw"
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fb_graph2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nov matake
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|
@@ -226,6 +226,9 @@ files:
|
|
226
226
|
- lib/fb_graph2/edge/noreply.rb
|
227
227
|
- lib/fb_graph2/edge/notifications.rb
|
228
228
|
- lib/fb_graph2/edge/offers.rb
|
229
|
+
- lib/fb_graph2/edge/open_graph.rb
|
230
|
+
- lib/fb_graph2/edge/open_graph/actions.rb
|
231
|
+
- lib/fb_graph2/edge/open_graph/objects.rb
|
229
232
|
- lib/fb_graph2/edge/outbox.rb
|
230
233
|
- lib/fb_graph2/edge/payment_transactions.rb
|
231
234
|
- lib/fb_graph2/edge/permissions.rb
|
@@ -262,6 +265,9 @@ files:
|
|
262
265
|
- lib/fb_graph2/node.rb
|
263
266
|
- lib/fb_graph2/notification.rb
|
264
267
|
- lib/fb_graph2/offer.rb
|
268
|
+
- lib/fb_graph2/open_graph.rb
|
269
|
+
- lib/fb_graph2/open_graph/action.rb
|
270
|
+
- lib/fb_graph2/open_graph/object.rb
|
265
271
|
- lib/fb_graph2/order.rb
|
266
272
|
- lib/fb_graph2/page.rb
|
267
273
|
- lib/fb_graph2/page_category.rb
|
@@ -352,6 +358,7 @@ files:
|
|
352
358
|
- spec/fb_graph2/edge/noreply_spec.rb
|
353
359
|
- spec/fb_graph2/edge/notifications_spec.rb
|
354
360
|
- spec/fb_graph2/edge/offers_spec.rb
|
361
|
+
- spec/fb_graph2/edge/open_graph/actions_spec.rb
|
355
362
|
- spec/fb_graph2/edge/outbox_spec.rb
|
356
363
|
- spec/fb_graph2/edge/permissions_spec.rb
|
357
364
|
- spec/fb_graph2/edge/photos_spec.rb
|
@@ -450,6 +457,7 @@ files:
|
|
450
457
|
- spec/mock_json/user/movies.json
|
451
458
|
- spec/mock_json/user/music.json
|
452
459
|
- spec/mock_json/user/notifications.json
|
460
|
+
- spec/mock_json/user/og_actions_likes.json
|
453
461
|
- spec/mock_json/user/outbox.json
|
454
462
|
- spec/mock_json/user/permissions.json
|
455
463
|
- spec/mock_json/user/photos.json
|