Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add update method

  • Loading branch information...
commit 99efde04722accf243a1b61ac2cae619fa2fa1ae 1 parent 7d42dd5
Erik Michaels-Ober authored
Showing with 15 additions and 6 deletions.
  1. +12 −3 lib/twitter/base.rb
  2. +3 −3 lib/twitter/client.rb
15 lib/twitter/base.rb
View
@@ -28,16 +28,16 @@ def self.new(attrs={})
@@identity_map[self.name][Marshal.dump(attrs)] || super(attrs)
end
- # Initializes a new Base object
+ # Initializes a new object
#
# @param attrs [Hash]
# @return [Twitter::Base]
def initialize(attrs={})
- @attrs = attrs
+ self.update(attrs)
@@identity_map[self.class.name][Marshal.dump(attrs)] = self
end
- # Initializes a new Base object
+ # Fetches an attribute of an object using hash notation
#
# @param method [String, Symbol] Message to send to the object
def [](method)
@@ -46,5 +46,14 @@ def [](method)
nil
end
+ # Update the attributes of an object
+ #
+ # @param attrs [Hash]
+ # @return [Twitter::Base]
+ def update(attrs)
+ @attrs = attrs
+ self
+ end
+
end
end
6 lib/twitter/client.rb
View
@@ -661,7 +661,7 @@ def friendship(source, target, options={})
# @see https://dev.twitter.com/docs/api/1/post/friendships/create
# @rate_limited No
# @requires_authentication Yes
- # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, or object.
+ # @param users [Array<Integer, String, Twitter::User>, Set<Integer, String, Twitter::User>] An array of Twitter user IDs, screen names, or objects.
# @param options [Hash] A customizable set of options.
# @option options [Boolean] :follow (false) Enable notifications for the target user.
# @return [Twitter::User] The followed user.
@@ -692,7 +692,7 @@ def follow(*args)
# @see https://dev.twitter.com/docs/api/1/post/friendships/create
# @rate_limited No
# @requires_authentication Yes
- # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, or object.
+ # @param users [Array<Integer, String, Twitter::User>, Set<Integer, String, Twitter::User>] An array of Twitter user IDs, screen names, or objects.
# @param options [Hash] A customizable set of options.
# @option options [Boolean] :follow (false) Enable notifications for the target user.
# @return [Array<Twitter::User>] The followed users.
@@ -721,7 +721,7 @@ def follow!(*args)
# @see https://dev.twitter.com/docs/api/1/post/friendships/destroy
# @rate_limited No
# @requires_authentication Yes
- # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, or object.
+ # @param users [Array<Integer, String, Twitter::User>, Set<Integer, String, Twitter::User>] An array of Twitter user IDs, screen names, or objects.
# @param options [Hash] A customizable set of options.
# @return [Array<Twitter::User>] The unfollowed users.
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
Please sign in to comment.
Something went wrong with that request. Please try again.