Parent

Twitter::Status

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
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
def create(params)
  client, text = params[:client], params[:text]
  raise ArgumentError, 'Valid client context must be provided' unless client.is_a?(Twitter::Client)
  raise ArgumentError, 'Must provide text for the status to update' unless text.is_a?(String)
  client.status(:post, text)
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
def find(id, client)
  client.status(:get, id)
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
def reply(reply)
  status_reply = "@#{user.screen_name} #{reply}"
  client.status(:reply, :status => status_reply, 
                :in_reply_to_status_id => @id)
end
reply?() click to toggle source
# File lib/twitter/model.rb, line 384
def reply?
  !!@in_reply_to_status_id
end

Protected Instance Methods

init() click to toggle source

Constructor callback

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

[Validate]

Generated with the Darkfish Rdoc Generator 2.