3 :add => '/blocks/create',
4 :remove => '/blocks/destroy',
7 # Provides access to the Twitter Block API.
9 # You can add and remove blocks to users using this method.
11 # <tt>action</tt> can be any of the following values:
12 # * <tt>:add</tt> - to add a block, you would use this <tt>action</tt> value
13 # * <tt>:remove</tt> - to remove a block use this.
15 # The <tt>value</tt> must be either the user screen name, integer unique user ID or Twitter::User
16 # object representation.
19 # screen_name = 'dictionary'
20 # client.block(:add, 'dictionary')
21 # client.block(:remove, 'dictionary')
23 # client.block(:add, id)
24 # client.block(:remove, id)
25 # user = Twitter::User.find(id, client)
26 # client.block(:add, user)
27 # client.block(:remove, user)
28 def block(action, value)
29 raise ArgumentError, "Invalid friend action provided: #{action}" unless @@BLOCK_URIS.keys.member?(action)
30 value = value.to_i unless value.is_a?(String)
31 uri = "#{@@BLOCK_URIS[action]}/#{value}.json"
32 response = http_connect {|conn| create_http_get_request(uri) }
33 bless_model(Twitter::User.unmarshal(response.body))