1
0
Fork 0
mirror of https://github.com/nov/fb_graph2 synced 2023-03-27 23:22:15 -04:00

Merge pull request #81 from nov/feature/v2.4

Feature/v2.4
This commit is contained in:
Nov Matake 2017-02-28 18:09:55 +09:00 committed by GitHub
commit ef73a93c50
29 changed files with 6 additions and 538 deletions

View file

@ -3,5 +3,6 @@ before_install:
rvm:
- 2.2.2 # NOTE: 2.2.1 or lower aren't supported by activesupport 5.0, CI isn't needed for such legacy versions.
- 2.2.5
- 2.3.1
- 2.2.6
- 2.3.3
- 2.4.0

View file

@ -8,7 +8,7 @@ module FbGraph2
mattr_accessor :root_url, :api_version, :gem_version, :logger, :debugging, :_http_config_, :object_classes
self.root_url = 'https://graph.facebook.com'
self.api_version = 'v2.3'
self.api_version = 'v2.4'
self.gem_version = File.read(File.join(__dir__, '../VERSION')).strip
self.logger = Logger.new(STDOUT)
self.logger.progname = 'FbGraph2'

View file

@ -1,12 +0,0 @@
module FbGraph2
class Edge
module Home
def home(params = {})
posts = self.edge :home, params
posts.collect! do |post|
Post.new(post[:id], post).authenticate self.access_token
end
end
end
end
end

View file

@ -1,12 +0,0 @@
module FbGraph2
class Edge
module Inbox
def inbox(params = {})
threads = self.edge :inbox, params
threads.collect! do |thread|
Thread.new(thread[:id], thread).authenticate self.access_token
end
end
end
end
end

View file

@ -1,12 +0,0 @@
module FbGraph2
class Edge
module Invited
def invited(params = {})
users = self.edge :invited, params
users.collect! do |user|
User.new(user[:id], user).authenticate self.access_token
end
end
end
end
end

View file

@ -1,12 +0,0 @@
module FbGraph2
class Edge
module Links
def links(params = {})
posts = self.edge :links, params
posts.collect! do |post|
Post.new(post[:id], post).authenticate self.access_token
end
end
end
end
end

View file

@ -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

View file

@ -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

View file

@ -1,12 +0,0 @@
module FbGraph2
class Edge
module Statuses
def statuses(params = {})
posts = self.edge :statuses, params
posts.collect! do |post|
Post.new(post[:id], post).authenticate self.access_token
end
end
end
end
end

View file

@ -3,7 +3,6 @@ module FbGraph2
include Edge::Attending
include Edge::Declined
include Edge::Feed
include Edge::Invited
include Edge::Maybe
include Edge::Noreply
include Edge::Picture

View file

@ -8,7 +8,6 @@ module FbGraph2
include Edge::Feed
include Edge::GlobalBrandChildren
include Edge::Insights
include Edge::Links
include Edge::Locations
include Edge::Milestones
include Edge::Offers
@ -19,7 +18,6 @@ module FbGraph2
include Edge::Ratings
include Edge::Roles::PageContext
include Edge::Settings
include Edge::Statuses
include Edge::Tagged
include Edge::Videos
extend Searchable

View file

@ -15,17 +15,11 @@ module FbGraph2
include Edge::Friends
include Edge::Games
include Edge::Groups
include Edge::Home
include Edge::Inbox
include Edge::Interests
include Edge::InvitableFriends
include Edge::Likes::LikerContext
include Edge::Links
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
@ -33,7 +27,6 @@ module FbGraph2
include Edge::Pokes
include Edge::Posts
include Edge::Scores
include Edge::Statuses
include Edge::TaggableFriends
include Edge::Tagged
include Edge::TaggedPlaces

View file

@ -1,19 +0,0 @@
require 'spec_helper'
describe FbGraph2::Edge::Feed do
context 'included in User' do
describe '#home' do
let(:me) { FbGraph2::User.me('token') }
it 'should return an Array of FbGraph2::Post' do
posts = mock_graph :get, 'me/home', 'user/home', access_token: 'token' do
me.home
end
posts.should be_instance_of FbGraph2::Edge
posts.should_not be_blank
posts.each do |post|
post.should be_instance_of FbGraph2::Post
end
end
end
end
end

View file

@ -1,20 +0,0 @@
require 'spec_helper'
describe FbGraph2::Edge::Inbox do
context 'included in User' do
describe '#inbox' do
let(:me) { FbGraph2::User.me('token') }
it 'should return an Array of FbGraph2::Thread' do
threads = mock_graph :get, 'me/inbox', 'user/inbox', access_token: 'token' do
me.inbox
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
threads.summary.should include unseen_count: 0, unread_count: 0, updated_time: Time.parse('2014-09-02T03:51:40+0000')
end
end
end
end

View file

@ -1,20 +0,0 @@
require 'spec_helper'
describe FbGraph2::Edge::Invited do
context 'included in Event' do
let(:event) { FbGraph2::Event.new('event_id').authenticate('token') }
describe '#invited' do
it 'should return an Array of FbGraph2::User' do
users = mock_graph :get, 'event_id/invited', 'event/invited', access_token: 'token' do
event.invited
end
users.should be_instance_of FbGraph2::Edge
users.should_not be_blank
users.each do |user|
user.should be_instance_of FbGraph2::User
end
end
end
end
end

View file

@ -1,19 +0,0 @@
require 'spec_helper'
describe FbGraph2::Edge::Links do
context 'included in User' do
let(:me) { FbGraph2::User.me('token') }
describe '#links' do
it 'should return an Array of FbGraph2::Post' do
posts = mock_graph :get, 'me/links', 'user/links', access_token: 'token' do
me.links
end
posts.should be_instance_of FbGraph2::Edge
posts.should_not be_blank
posts.each do |post|
post.should be_instance_of FbGraph2::Post
end
end
end
end
end

View file

@ -4,7 +4,7 @@ describe FbGraph2::Edge::Members do
context 'included in Group' do
let(:group) { FbGraph2::Group.new('group_id').authenticate('token') }
describe '#invited' do
describe '#members' do
it 'should return an Array of FbGraph2::User' do
users = mock_graph :get, 'group_id/members', 'group/members', access_token: 'token' do
group.members

View file

@ -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

View file

@ -1,28 +0,0 @@
require 'spec_helper'
describe FbGraph2::Edge::OpenGraph::Actions do
context 'included in User' do
describe '#og_actions' do
let(:me) { FbGraph2::User.me('token') }
it 'should return an Array of FbGraph2::Post' do
actions = mock_graph :get, 'me/og.likes', 'user/og_actions_likes', access_token: 'token' do
me.og_actions 'og.likes'
end
actions.should be_instance_of FbGraph2::Edge
actions.should_not be_blank
actions.each do |action|
action.should be_instance_of FbGraph2::OpenGraph::Action
end
end
end
describe '#og_action!' do
let(:user) { FbGraph2::User.new('user_id') }
it 'should return a FbGraph2::Post' do
mock_graph :post, 'user_id/og.likes', 'success_with_id', access_token: 'app_token' do
user.authenticate('app_token').og_action! 'og.likes', object: 'https://github.com/nov/fb_graph2/'
end.should be_instance_of FbGraph2::OpenGraph::Action
end
end
end
end

View file

@ -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

View file

@ -1,19 +0,0 @@
require 'spec_helper'
describe FbGraph2::Edge::Statuses do
context 'included in User' do
let(:me) { FbGraph2::User.me('token') }
describe '#statuses' do
it 'should return an Array of FbGraph2::Post' do
posts = mock_graph :get, 'me/statuses', 'user/statuses', access_token: 'token' do
me.statuses
end
posts.should be_instance_of FbGraph2::Edge
posts.should_not be_blank
posts.each do |post|
post.should be_instance_of FbGraph2::Post
end
end
end
end
end

View file

@ -6,7 +6,7 @@ describe FbGraph2 do
context 'as default' do
its(:logger) { should be_a Logger }
its(:api_version) { should == 'v2.3' }
its(:api_version) { should == 'v2.4' }
its(:root_url) { should == 'https://graph.facebook.com' }
it { should_not be_debugging }
end

View file

@ -1,17 +0,0 @@
{
"data": [{
"name": "Akira Otaishi",
"rsvp_status": "attending",
"id": "553375548107883"
}, {
"name": "Shin-ichiro Kagaya",
"rsvp_status": "attending",
"id": "241546062702044"
}],
"paging": {
"cursors": {
"after": "TVRBd01EQXdNRFl6TWpjME1qSTBPakUwTVRBMU1UQTJNREE2TVRZMU1EZzBPRGsyT0RRNE5UZ3g=",
"before": "TVRBd01EQXpNRFl6TWpjM01qTXhPakUwTVRBMU1UQTJNREE2TVRjMk9UQTRNVE0xTmpnM09UWXg="
}
}
}

View file

@ -1,61 +0,0 @@
{
"data": [{
"id": "114870808553071_759907394049406",
"from": {
"category": "Computers/internet website",
"name": "TechCrunch Japan",
"id": "114870808553071"
},
"story": "TechCrunch Japan shared a link.",
"story_tags": {
"0": [{
"id": "114870808553071",
"name": "TechCrunch Japan",
"offset": 0,
"length": 16,
"type": "page"
}]
},
"picture": "https://fbexternal-a.akamaihd.net/safe_image.php?d=AQCP3uH6kEoLnPsL&w=154&h=154&url=http%3A%2F%2Ftechcrunchjp.files.wordpress.com%2F2014%2F06%2F140603modiva1.jpg%3Fw%3D1024%26h%3D768",
"link": "http://dlvr.it/5sP8LX",
"name": "MOVIDA JAPANがデモデイを開催して13社が登壇個人的にはEigooo!に期待",
"caption": "jp.techcrunch.com",
"description": "MOVIDA JAPANは6月3日、同社のシードアクセラレーションプログラムの成果を発表する「MOVIDA JAPAN DemoDay 5th」を開催した。今回登壇したスタートアップは13社。まずは登壇したスタートアップとそのサービス概要を紹介していく。…",
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/y5/r/sXJx2UP7quc.png",
"actions": [{
"name": "Comment",
"link": "https://www.facebook.com/114870808553071/posts/759907394049406"
}, {
"name": "Like",
"link": "https://www.facebook.com/114870808553071/posts/759907394049406"
}],
"privacy": {
"value": ""
},
"type": "link",
"status_type": "shared_story",
"application": {
"name": "dlvr.it",
"namespace": "dlvr_it",
"id": "232775914688"
},
"created_time": "2014-06-03T08:20:01+0000",
"updated_time": "2014-06-03T08:20:01+0000",
"likes": {
"data": [{
"id": "10203763563950799",
"name": "Takuya Kawai"
}],
"paging": {
"cursors": {
"after": "MTAyMDM3NjM1NjM5NTA3OTk=",
"before": "MTAyMDM3NjM1NjM5NTA3OTk="
}
}
}
}],
"paging": {
"previous": "https://graph.facebook.com/v2.0/579612276/home?limit=25&since=1401784697",
"next": "https://graph.facebook.com/v2.0/579612276/home?limit=25&until=1401773525"
}
}

View file

@ -1,41 +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/inbox?limit=25&since=1409629900&__paging_token=***",
"next": "https://graph.facebook.com/v2.1/579612276/inbox?limit=25&until=1403524175&__paging_token=***"
},
"summary": {
"unseen_count": 0,
"unread_count": 0,
"updated_time": "2014-09-02T03:51:40+0000"
}
}

View file

@ -1,45 +0,0 @@
{
"data": [{
"id": "10152480998332277",
"from": {
"id": "579612276",
"name": "Nov Matake"
},
"picture": "https://fbexternal-a.akamaihd.net/safe_image.php?d=AQCtEdPdezKIoUxo&w=154&h=154&url=http%3A%2F%2Fi.yimg.jp%2Fi%2Fdocs%2Frelease%2Ffbicon.jpg",
"privacy": {
"description": "Your friends",
"value": "ALL_FRIENDS",
"allow": "",
"deny": "",
"networks": "",
"friends": ""
},
"link": "http://docs.yahoo.co.jp/docs/info/terms/chapter1.html#cf2nd",
"name": "ヤフー株式会社 - サービス利用規約 第1編 基本ガイドライン",
"description": "Yahoo! JAPANのサービス利用規約、第1編 基本ガイドラインは当社のサービスをご利用になるすべての方に共通して適用されます。",
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yD/r/aS8ecmYRys0.gif",
"created_time": "2014-06-02T09:34:13+0000",
"likes": {
"data": [{
"id": "689134294485152",
"name": "Shunya Iriki"
}, {
"id": "1246364330",
"name": "Kaoru Maeda"
}],
"paging": {
"cursors": {
"after": "MTI0NjM2NDMzMA==",
"before": "Njg5MTM0Mjk0NDg1MTUy"
}
}
}
}],
"paging": {
"cursors": {
"after": "MTAxNTI0NDIwNzU4MzIyNzc=",
"before": "MTAxNTI0ODA5OTgzMzIyNzc="
},
"next": "https://graph.facebook.com/v2.0/579612276/links?limit=25&after=MTAxNTI0NDIwNzU4MzIyNzc="
}
}

View file

@ -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=***"
}
}

View file

@ -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=***"
}
}

View file

@ -1,15 +0,0 @@
{
"data": [{
"id": "10152483324277277",
"from": {
"id": "579612276",
"name": "Nov Matake"
},
"message": "Nov Matake test",
"updated_time": "2014-06-03T06:27:20+0000"
}],
"paging": {
"previous": "https://graph.facebook.com/v2.0/579612276/statuses?limit=25&since=1401776840&__paging_token=***",
"next": "https://graph.facebook.com/v2.0/579612276/statuses?limit=25&until=1384770778&__paging_token=***"
}
}