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

Graph API v2.2 - page settings & app permissions

This commit is contained in:
nov 2014-10-31 18:13:14 +09:00
parent 87fdb861e8
commit 53dfdec608
6 changed files with 78 additions and 0 deletions

View file

@ -5,6 +5,7 @@ module FbGraph2
include Edge::AppEventTypes
include Edge::Banned
include Edge::Groups
include Edge::Permissions
include Edge::Picture
include Edge::Roles
include Edge::Scores

View file

@ -0,0 +1,12 @@
module FbGraph2
class Edge
module Settings
def settings(params = {})
settings = self.edge :settings, params
settings.collect! do |setting|
Struct::Setting.new setting
end
end
end
end
end

View file

@ -14,6 +14,7 @@ module FbGraph2
include Edge::Photos
include Edge::Posts
include Edge::PromotablePosts
include Edge::Settings
include Edge::Statuses
include Edge::Tagged
include Edge::Videos

View file

@ -0,0 +1,9 @@
module FbGraph2
class Struct
class Setting < Struct
register_attributes(
raw: [:setting, :value]
)
end
end
end

View file

@ -0,0 +1,19 @@
require 'spec_helper'
describe FbGraph2::Edge::Settings do
context 'included in Page' do
describe '#settings' do
let(:page) { FbGraph2::Page.new('page_id').authenticate('page_token') }
it 'should return an Array of FbGraph2::Struct::Permission' do
settings = mock_graph :get, 'page_id/settings', 'page/settings', access_token: 'page_token' do
page.settings
end
settings.should be_instance_of FbGraph2::Edge
settings.should_not be_blank
settings.each do |setting|
setting.should be_instance_of FbGraph2::Struct::Setting
end
end
end
end
end

View file

@ -0,0 +1,36 @@
{
"data": [
{
"setting": "USERS_CAN_POST",
"value": true
},
{
"setting": "USERS_CAN_MESSAGE",
"value": true
},
{
"setting": "USERS_CAN_POST_PHOTOS",
"value": true
},
{
"setting": "USERS_CAN_TAG_PHOTOS",
"value": false
},
{
"setting": "WALL_COMBINED_POSTS",
"value": true
},
{
"setting": "PLATFORM_OPTOUTS_CAN_POST",
"value": true
},
{
"setting": "SHOW_RECENT_POSTS_BY_OTHERS",
"value": true
},
{
"setting": "APPEARS_IN_RELATED_PAGES",
"value": true
}
]
}