Included Modules


Represents a status posted to Twitter by a Twitter user.

Public Class Methods

attributes() click to toggle source

Used as factory method callback

     # File lib/twitter/model.rb, line 347
347:       def attributes; @@ATTRIBUTES; end
create(params) click to toggle source

Creates a new status for the authenticated user of the given client context.

You MUST include a valid/authenticated client context in the given params argument.

For example:

 status = Twitter::Status.create(
   :text => 'I am shopping for flip flops',
   :client => client)

An ArgumentError will be raised if no valid client context is given in the params Hash. For example,

 status = Twitter::Status.create(:text => 'I am shopping for flip flops')

The above line of code will raise an ArgumentError.

The same is true when you do not provide a :text key-value pair in the params argument given.

The Twitter::Status object returned after the status successfully updates on the Twitter server side is returned from this method.

     # File lib/twitter/model.rb, line 376
376:       def create(params)
377:         client, text = params[:client], params[:text]
378:         raise ArgumentError, 'Valid client context must be provided' unless client.is_a?(Twitter::Client)
379:         raise ArgumentError, 'Must provide text for the status to update' unless text.is_a?(String)
380:         client.status(:post, text)
381:       end
find(id, client) click to toggle source

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

     # File lib/twitter/model.rb, line 351
351:       def find(id, client)
352:         client.status(:get, id)
353:       end

Public Instance Methods

reply(reply) click to toggle source

Convenience method to allow client developers to not have to worry about setting the in_reply_to_status_id attribute or prefixing the status text with the screen_name being replied to.

     # File lib/twitter/model.rb, line 391
391:     def reply(reply)
392:       status_reply = "@#{user.screen_name} #{reply}"
393:       client.status(:reply, :status => status_reply, 
394:                     :in_reply_to_status_id => @id)
395:     end
reply?() click to toggle source
     # File lib/twitter/model.rb, line 384
384:     def reply?
385:       !!@in_reply_to_status_id
386:     end

Protected Instance Methods

init() click to toggle source

Constructor callback

     # File lib/twitter/model.rb, line 399
399:       def init
400:         @user = if @user.is_a?(Hash)
401:         @created_at = Time.parse(@created_at) if @created_at.is_a?(String)
402:       end

Disabled; run with --debug to generate this.


Generated with the Darkfish Rdoc Generator 1.1.6.