Module: GSGraph::Connections::Banned

Included in:
Application
Defined in:
lib/gs_graph/connections/banned.rb

Instance Method Summary collapse

Instance Method Details

#ban!(*users) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/gs_graph/connections/banned.rb', line 18

def ban!(*users)
  options = users.extract_options!
  post options.merge(
    :connection => :banned,
    :uid => Array(users).flatten.collect(&:identifier).join(',')
  )
end

#banned(options = {}) ⇒ Object



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

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

#banned?(user, options = {}) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
# File 'lib/gs_graph/connections/banned.rb', line 13

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

#unban!(user, options = {}) ⇒ Object



26
27
28
# File 'lib/gs_graph/connections/banned.rb', line 26

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