Module: Twitter::Client::Block
- Included in:
- Twitter::Client
- Defined in:
- lib/twitter/client/block.rb
Overview
Defines methods related to blocking and unblocking users
Instance Method Summary collapse
-
#block(user, options = {}) ⇒ Twitter::User
Blocks the user specified by the authenticating user.
-
#block?(user, options = {}) ⇒ Boolean
Returns true if the authenticating user is blocking a target user.
-
#blocked_ids(options = {}) ⇒ Array
Returns an array of numeric user ids the authenticating user is blocking.
-
#blocking(options = {}) ⇒ Array<Twitter::User>
Returns an array of user objects that the authenticating user is blocking.
-
#unblock(user, options = {}) ⇒ Twitter::User
Un-blocks the user specified by the authenticating user.
Instance Method Details
#block(user, options = {}) ⇒ Twitter::User
Destroys a friendship to the blocked user if it exists.
Blocks the user specified by the authenticating user
77 78 79 80 81 |
# File 'lib/twitter/client/block.rb', line 77 def block(user, ={}) .merge_user!(user) user = post("/1/blocks/create.json", ) Twitter::User.new(user) end |
#block?(user, options = {}) ⇒ Boolean
Returns true if the authenticating user is blocking a target user
55 56 57 58 59 60 61 |
# File 'lib/twitter/client/block.rb', line 55 def block?(user, ={}) .merge_user!(user) get("/1/blocks/exists.json", , :raw => true) true rescue Twitter::Error::NotFound false end |
#blocked_ids(options = {}) ⇒ Array
Returns an array of numeric user ids the authenticating user is blocking
39 40 41 |
# File 'lib/twitter/client/block.rb', line 39 def blocked_ids(={}) get("/1/blocks/blocking/ids.json", ) end |
#blocking(options = {}) ⇒ Array<Twitter::User>
Returns an array of user objects that the authenticating user is blocking
23 24 25 26 27 |
# File 'lib/twitter/client/block.rb', line 23 def blocking(={}) get("/1/blocks/blocking.json", ).map do |user| Twitter::User.new(user) end end |
#unblock(user, options = {}) ⇒ Twitter::User
Un-blocks the user specified by the authenticating user
96 97 98 99 100 |
# File 'lib/twitter/client/block.rb', line 96 def unblock(user, ={}) .merge_user!(user) user = delete("/1/blocks/destroy.json", ) Twitter::User.new(user) end |