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:
parent
87fdb861e8
commit
53dfdec608
6 changed files with 78 additions and 0 deletions
|
@ -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
|
||||
|
|
12
lib/fb_graph2/edge/settings.rb
Normal file
12
lib/fb_graph2/edge/settings.rb
Normal 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
|
|
@ -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
|
||||
|
|
9
lib/fb_graph2/struct/setting.rb
Normal file
9
lib/fb_graph2/struct/setting.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
module FbGraph2
|
||||
class Struct
|
||||
class Setting < Struct
|
||||
register_attributes(
|
||||
raw: [:setting, :value]
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
19
spec/fb_graph2/edge/settings_spec.rb
Normal file
19
spec/fb_graph2/edge/settings_spec.rb
Normal 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
|
36
spec/mock_json/page/settings.json
Normal file
36
spec/mock_json/page/settings.json
Normal 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
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in a new issue