Sha256: cf76a41832c30b3e7d8fa7502b13dc76c464c3a7645c8c315dcd211d40d2e2f0

Contents?: true

Size: 691 Bytes

Versions: 1

Compression:

Stored size: 691 Bytes

Contents

module FbGraph
  module Connections
    module Permissions
      def permissions(options = {})
        if FbGraph.v2?
          self.connection(:permissions, options).try(:inject, []) do |arr, entry|
            arr << entry[:permission].to_sym if entry[:status] == 'granted'
            arr
          end || []
        else
          self.connection(:permissions, options).first.try(:inject, []) do |arr, (key, value)|
            arr << key.to_sym if value.to_i == 1
            arr
          end || []
        end
      end

      def revoke!(permission = nil, options = {})
        destroy options.merge(:permission => permission, :connection => :permissions)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fb_graph-2.7.14 lib/fb_graph/connections/permissions.rb