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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 47cc32a9ad029bbad0346803bf8ca999ae2b3d75
4
- data.tar.gz: eaef411ebb5075c1ca0bc616ed597e2d6fdfa2de
3
+ metadata.gz: f7f32136098b368351724d9f6eebef1f874b3993
4
+ data.tar.gz: f61f1aaa729b53f4679cfb3af2841455c26a307a
5
5
  SHA512:
6
- metadata.gz: b610f4cce39977ed93d62187ae635759ed5a7c2e7dd62f718792f41af5a91d8f7531a5494478c402679e2e02484daddc29da634b7295d16d9a746fe738c5fc43
7
- data.tar.gz: e5c23365053ba2cbca1814042680a7d17db74793bad2da1fc8911eef04cc6e393f522ecbdca7e0eee8f8462f9a11338a32a40f05f6c484f99a35389fb01352da
6
+ metadata.gz: 9c4c4ef7d93a18400c50fb12c4738794fd08cc656e6a9225c05b943bc493d5d69708256b9459166d422950aabd69dfc8550267cd56e11d7e18835da8a812be5a
7
+ data.tar.gz: ddac397d67226a515dce09b1955de877ba0cbf4e9d043015e6a75a96ae7fcf255ce5cd5a807110b7142c08ac0548504e37ac581cf27d7c6f118a7bce74af2ed8
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.2
1
+ 0.7.3
@@ -5,6 +5,7 @@ module FbGraph2
5
5
  include Edge::AppEventTypes
6
6
  include Edge::Banned
7
7
  include Edge::Groups
8
+ include Edge::OpenGraph::Objects
8
9
  include Edge::Permissions
9
10
  include Edge::Picture
10
11
  include Edge::Roles::AppContext
@@ -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,3 @@
1
+ Dir[File.join(__dir__, 'open_graph/*.rb')].each do |file|
2
+ require file
3
+ end
@@ -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,3 @@
1
+ Dir[File.join(__dir__, 'open_graph/*.rb')].each do |file|
2
+ require file
3
+ 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
@@ -0,0 +1,9 @@
1
+ module FbGraph2
2
+ module OpenGraph
3
+ class Object < Node
4
+ register_attributes(
5
+ raw: [:title, :type, :url]
6
+ )
7
+ end
8
+ end
9
+ end
@@ -24,6 +24,7 @@ module FbGraph2
24
24
  include Edge::Movies
25
25
  include Edge::Music
26
26
  include Edge::Notifications
27
+ include Edge::OpenGraph::Actions
27
28
  include Edge::Outbox
28
29
  include Edge::PaymentTransactions
29
30
  include Edge::Permissions
@@ -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.2
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-09 00:00:00.000000000 Z
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