From 750280706165248847a69b256432a0dcfb5a45cd Mon Sep 17 00:00:00 2001 From: nov Date: Mon, 13 Jul 2015 15:47:23 +0900 Subject: [PATCH] notifications and outbox edges are no longer availabe. https://developers.facebook.com/docs/apps/changelog#v2_4_changes ps. outbox isn't mentioned in the doc, but read_mailbox deprecation causes outbox deprecation too. --- lib/fb_graph2/edge/notifications.rb | 17 --------- lib/fb_graph2/edge/outbox.rb | 12 ------ lib/fb_graph2/user.rb | 3 -- spec/fb_graph2/edge/notifications_spec.rb | 30 --------------- spec/fb_graph2/edge/outbox_spec.rb | 19 ---------- spec/mock_json/user/notifications.json | 45 ----------------------- spec/mock_json/user/outbox.json | 36 ------------------ 7 files changed, 162 deletions(-) delete mode 100644 lib/fb_graph2/edge/notifications.rb delete mode 100644 lib/fb_graph2/edge/outbox.rb delete mode 100644 spec/fb_graph2/edge/notifications_spec.rb delete mode 100644 spec/fb_graph2/edge/outbox_spec.rb delete mode 100644 spec/mock_json/user/notifications.json delete mode 100644 spec/mock_json/user/outbox.json diff --git a/lib/fb_graph2/edge/notifications.rb b/lib/fb_graph2/edge/notifications.rb deleted file mode 100644 index 0537781..0000000 --- a/lib/fb_graph2/edge/notifications.rb +++ /dev/null @@ -1,17 +0,0 @@ -module FbGraph2 - class Edge - module Notifications - def notifications(params = {}) - notifications = self.edge :notifications, params - notifications.collect! do |notification| - Notification.new notification[:id], notification - end - end - - def notification!(params = {}) - self.post params, edge: :notifications - end - alias_method :notify!, :notification! - end - end -end \ No newline at end of file diff --git a/lib/fb_graph2/edge/outbox.rb b/lib/fb_graph2/edge/outbox.rb deleted file mode 100644 index c6b2e87..0000000 --- a/lib/fb_graph2/edge/outbox.rb +++ /dev/null @@ -1,12 +0,0 @@ -module FbGraph2 - class Edge - module Outbox - def outbox(params = {}) - threads = self.edge :outbox, params - threads.collect! do |thread| - Thread.new(thread[:id], thread).authenticate self.access_token - end - end - end - end -end \ No newline at end of file diff --git a/lib/fb_graph2/user.rb b/lib/fb_graph2/user.rb index 5055be0..3fc0abf 100644 --- a/lib/fb_graph2/user.rb +++ b/lib/fb_graph2/user.rb @@ -20,9 +20,6 @@ module FbGraph2 include Edge::Likes::LikerContext include Edge::Movies include Edge::Music - include Edge::Notifications - include Edge::OpenGraph::Actions - include Edge::Outbox include Edge::PaymentTransactions include Edge::Permissions include Edge::Picture diff --git a/spec/fb_graph2/edge/notifications_spec.rb b/spec/fb_graph2/edge/notifications_spec.rb deleted file mode 100644 index 9f52e0d..0000000 --- a/spec/fb_graph2/edge/notifications_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'spec_helper' - -describe FbGraph2::Edge::Notifications do - context 'included in User' do - describe '#notifications' do - let(:me) { FbGraph2::User.me('token') } - it 'should return an Array of FbGraph2::Notification' do - notifications = mock_graph :get, 'me/notifications', 'user/notifications', access_token: 'token' do - me.notifications - end - notifications.should be_instance_of FbGraph2::Edge - notifications.should_not be_blank - notifications.each do |notification| - notification.should be_instance_of FbGraph2::Notification - end - end - end - - describe '#notification!' do - let(:user) { FbGraph2::User.new('user_id') } - it 'should return true' do - mock_graph :post, 'user_id/notifications', 'success_true', access_token: 'app_token', params: { - href: 'href', template: 'template' - } do - user.authenticate('app_token').notification! href: 'href', template: 'template' - end.should be true - end - end - end -end \ No newline at end of file diff --git a/spec/fb_graph2/edge/outbox_spec.rb b/spec/fb_graph2/edge/outbox_spec.rb deleted file mode 100644 index eba845a..0000000 --- a/spec/fb_graph2/edge/outbox_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'spec_helper' - -describe FbGraph2::Edge::Outbox do - context 'included in User' do - describe '#outbox' do - let(:me) { FbGraph2::User.me('token') } - it 'should return an Array of FbGraph2::Thread' do - threads = mock_graph :get, 'me/outbox', 'user/outbox', access_token: 'token' do - me.outbox - end - threads.should be_instance_of FbGraph2::Edge - threads.should_not be_blank - threads.each do |thread| - thread.should be_instance_of FbGraph2::Thread - end - end - end - end -end \ No newline at end of file diff --git a/spec/mock_json/user/notifications.json b/spec/mock_json/user/notifications.json deleted file mode 100644 index 8bacf35..0000000 --- a/spec/mock_json/user/notifications.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "data": [{ - "id": "notif_579612276_373456430", - "from": { - "id": "583017165143721", - "name": "Akira Otaishi" - }, - "to": { - "id": "579612276", - "name": "Nov Matake" - }, - "created_time": "2014-08-27T18:48:07+0000", - "updated_time": "2014-08-27T18:48:07+0000", - "title": "Akira Otaishi invited you to his event あんしんかんcafe vol.4 ~ネット選挙をめぐるビジネス&セキュリティ~.", - "link": "http://www.facebook.com/events/339815099528481/", - "application": { - "name": "Events", - "id": "141157392619610" - }, - "unread": 1 - }, { - "id": "notif_579612276_373364015", - "from": { - "id": "631020523647805", - "name": "Shota Kawaminami" - }, - "to": { - "id": "579612276", - "name": "Nov Matake" - }, - "created_time": "2014-08-27T05:28:07+0000", - "updated_time": "2014-08-27T05:28:07+0000", - "title": "Shota Kawaminami shared your link.", - "link": "http://www.facebook.com/shota.kawaminami/posts/700333850049805", - "application": { - "name": "Links", - "id": "2309869772" - }, - "unread": 1 - }], - "paging": { - "previous": "https://graph.facebook.com/v2.1/579612276/notifications?limit=5000&since=1409272999&__paging_token=***", - "next": "https://graph.facebook.com/v2.1/579612276/notifications?limit=5000&until=1408919679&__paging_token=***" - } -} diff --git a/spec/mock_json/user/outbox.json b/spec/mock_json/user/outbox.json deleted file mode 100644 index 73b67ab..0000000 --- a/spec/mock_json/user/outbox.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "data": [{ - "id": "741737742539677", - "to": { - "data": [{ - "id": "579612276", - "name": "Nov Matake" - }, { - "id": "10152167763779825", - "name": "Hayashi Tatsuya" - }] - }, - "updated_time": "2014-09-02T03:51:40+0000", - "unread": 0, - "unseen": 0, - "comments": { - "data": [{ - "id": "741737742539677_1409625688", - "from": { - "id": "579612276", - "name": "Nov Matake" - }, - "message": "ヒゲキョクチョ", - "created_time": "2014-09-02T02:41:28+0000" - }], - "paging": { - "previous": "https://graph.facebook.com/v2.1/741737742539677/comments?limit=25&since=1409629900&__paging_token=***", - "next": "https://graph.facebook.com/v2.1/741737742539677/comments?limit=25&until=1409625439&__paging_token=***" - } - } - }], - "paging": { - "previous": "https://graph.facebook.com/v2.1/579612276/outbox?limit=25&since=1409629900&__paging_token=***", - "next": "https://graph.facebook.com/v2.1/579612276/outbox?limit=25&until=1403014440&__paging_token=***" - } -}