Parent

Included Modules

Twitter::User

Represents a Twitter user

Public Class Methods

attributes() click to toggle source

Used as factory method callback

     # File lib/twitter/model.rb, line 172
172:       def attributes; @@ATTRIBUTES; end
find(id, client) click to toggle source

Returns user model object with given id using the configuration and credentials of the client object passed in.

You can pass in either the user’s unique integer ID or the user’s screen name.

     # File lib/twitter/model.rb, line 179
179:       def find(id, client)
180:         client.user(id)
181:       end

Public Instance Methods

bless(client) click to toggle source

Override of ModelMixin#bless method.

Adds # instance method when user object represents authenticated user. Otherwise just do basic bless.

This permits applications using Twitter4R to write Rubyish code like this:

 followers = user.followers if user.is_me?

Or:

 followers = user.followers if user.respond_to?(:followers)
     # File lib/twitter/model.rb, line 194
194:     def bless(client)
195:       basic_bless(client)
196:       self.instance_eval(%{
197:         self.class.send(:include, Twitter::AuthenticatedUserMixin)
198:       }) if self.is_me? and not self.respond_to?(:followers)
199:       self
200:     end
friends() click to toggle source

Returns an Array of user objects that represents the authenticated user’s friends on Twitter.

     # File lib/twitter/model.rb, line 220
220:     def friends
221:       @client.user(@id, :friends)
222:     end
is_me?() click to toggle source

Returns whether this Twitter::User model object represents the authenticated user of the client that blessed it.

     # File lib/twitter/model.rb, line 205
205:     def is_me?
206:       # TODO: Determine whether we should cache this or not?
207:       # Might be dangerous to do so, but do we want to support
208:       # the edge case where this would cause a problem?  i.e. 
209:       # changing authenticated user after initial use of 
210:       # authenticated API.
211:       # TBD: To cache or not to cache.  That is the question!
212:       # Since this is an implementation detail we can leave this for 
213:       # subsequent 0.2.x releases.  It doesn't have to be decided before 
214:       # the 0.2.0 launch.
215:       @screen_name == @client.instance_eval("@login")
216:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.