Sha256: 507d64ed2832b0f40531eb4fe1cdb09610418c9ce9876db0b7ca81a133adb30d
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
class Twitter::Client @@FRIENDSHIP_URIS = { :add => 'http://twitter.com/friendships/create', :remove => 'http://twitter.com/friendships/destroy', } # Provides access to the Twitter Friendship API. # # You can add and remove friends using this method. # # <tt>action</tt> can be any of the following values: # * <tt>:add</tt> - to add a friend, you would use this <tt>action</tt> value # * <tt>:remove</tt> - to remove an existing friend from your friends list use this. # # The <tt>value</tt> must be either the user to befriend or defriend's # screen name, integer unique user ID or Twitter::User object representation. # # Examples: # screen_name = 'dictionary' # client.friend(:add, 'dictionary') # client.friend(:remove, 'dictionary') # id = 1260061 # client.friend(:add, id) # client.friend(:remove, id) # user = Twitter::User.find(id, client) # client.friend(:add, user) # client.friend(:remove, user) def friend(action, value) value = value.to_i unless value.is_a?(String) uri = "#{@@FRIENDSHIP_URIS[action]}/#{value}.json" response = http_connect {|conn| create_http_get_request(uri) } bless_model(Twitter::User.unmarshal(response.body)) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
twitter4r-0.2.0 | lib/twitter/client/friendship.rb |
twitter4r-0.2.1 | lib/twitter/client/friendship.rb |