Module: FbGraph::Connections::Blocked

Included in:
Page
Defined in:
lib/fb_graph/connections/blocked.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) block!(*users)



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fb_graph/connections/blocked.rb', line 18

def block!(*users)
  options = users.extract_options!
  blocked = post options.merge(
    :connection => :blocked,
    :uid => Array(users).flatten.collect(&:identifier).join(',')
  )
  blocked.delete_if do |user_id, succeeded|
    !succeeded
  end.keys.map! do |user_id|
    User.new user_id, :access_token => (options[:access_token] || self.access_token)
  end
end

- (Object) blocked(options = {})



4
5
6
7
8
9
10
11
# File 'lib/fb_graph/connections/blocked.rb', line 4

def blocked(options = {})
  blocked = self.connection :blocked, options
  blocked.map! do |user|
    User.new(user[:id], user.merge(
      :access_token => options[:access_token] || self.access_token
    ))
  end
end

- (Boolean) blocked?(user, options = {})

Returns:

  • (Boolean)


13
14
15
16
# File 'lib/fb_graph/connections/blocked.rb', line 13

def blocked?(user, options = {})
  blocked = self.connection :blocked, options.merge(:connection_scope => user.identifier)
  blocked.present?
end

- (Object) unblock!(user, options = {})



31
32
33
# File 'lib/fb_graph/connections/blocked.rb', line 31

def unblock!(user, options = {})
  delete options.merge(:connection => :blocked, :connection_scope => user.identifier)
end