Module: FbGraph::Connections::Settings
- Included in:
- Page
- Defined in:
- lib/fb_graph/connections/settings.rb
Constant Summary
- AVAILABLE_SETTINGS =
[ :users_can_post, :users_can_post_photos, :users_can_tag_photos, :users_can_post_videos ]
Class Method Summary (collapse)
Instance Method Summary (collapse)
- - (Object) disable!(setting, options = {})
- - (Object) enable!(setting, options = {})
- - (Object) settings(options = {})
Class Method Details
+ (Object) included(klass)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fb_graph/connections/settings.rb', line 11 def self.included(klass) AVAILABLE_SETTINGS.each do |setting| klass.class_eval <<-SETTING def #{setting}?(options = {}) settings(options).include? :#{setting} end def #{setting}!(options = {}) enable! :#{setting}, options end def #{setting.to_s.sub('can', 'cannot')}!(options = {}) disable! :#{setting}, options end SETTING end end |
Instance Method Details
- (Object) disable!(setting, options = {})
41 42 43 |
# File 'lib/fb_graph/connections/settings.rb', line 41 def disable!(setting, = {}) __update_setting__ setting, false, end |
- (Object) enable!(setting, options = {})
37 38 39 |
# File 'lib/fb_graph/connections/settings.rb', line 37 def enable!(setting, = {}) __update_setting__ setting, true, end |
- (Object) settings(options = {})
29 30 31 32 33 34 35 |
# File 'lib/fb_graph/connections/settings.rb', line 29 def settings( = {}) @settings = nil if [:no_cache] @settings ||= self.connection(:settings, ).inject([]) do |_settings_, _setting_| _settings_ << _setting_[:setting].downcase.to_sym if _setting_[:value] _settings_ end end |