Module: GSGraph::Connections::Blocked
- Included in:
- Page
- Defined in:
- lib/gs_graph/connections/blocked.rb
Instance Method Summary collapse
- #block!(*users) ⇒ Object
- #blocked(options = {}) ⇒ Object
- #blocked?(user, options = {}) ⇒ Boolean
- #unblock!(user, options = {}) ⇒ Object
Instance Method Details
#block!(*users) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gs_graph/connections/blocked.rb', line 18 def block!(*users) = users. blocked = post .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 => ([:access_token] || self.access_token) end end |
#blocked(options = {}) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/gs_graph/connections/blocked.rb', line 4 def blocked( = {}) blocked = self.connection :blocked, blocked.map! do |user| User.new(user[:id], user.merge( :access_token => [:access_token] || self.access_token )) end end |
#blocked?(user, options = {}) ⇒ Boolean
13 14 15 16 |
# File 'lib/gs_graph/connections/blocked.rb', line 13 def blocked?(user, = {}) blocked = self.connection :blocked, .merge(:connection_scope => user.identifier) blocked.present? end |
#unblock!(user, options = {}) ⇒ Object
31 32 33 |
# File 'lib/gs_graph/connections/blocked.rb', line 31 def unblock!(user, = {}) delete .merge(:connection => :blocked, :connection_scope => user.identifier) end |