Class: Twitter::Status

Inherits:
Base
  • Object
show all
Includes:
Creatable
Defined in:
lib/twitter/status.rb

Instance Attribute Summary

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Methods included from Creatable

#created_at

Methods inherited from Base

#[], #initialize, lazy_attr_reader

Constructor Details

This class inherits a constructor from Twitter::Base

Instance Method Details

#==(other) ⇒ Boolean

Parameters:

  • other (Twiter::Status)

Returns:

  • (Boolean)


26
27
28
# File 'lib/twitter/status.rb', line 26

def ==(other)
  super || (other.class == self.class && other.id == self.id)
end

#expanded_urlsArray<String>

Note:

Must :include_entities in your request for this method to work

Returns:

  • (Array<String>)


32
33
34
35
36
# File 'lib/twitter/status.rb', line 32

def expanded_urls
  @expanded_urls ||= Array(@attrs['entities']['urls']).map do |url|
    url['expanded_url']
  end unless @attrs['entities'].nil?
end

#geoTwitter::Point, Twitter::Polygon



39
40
41
# File 'lib/twitter/status.rb', line 39

def geo
  @geo ||= Twitter::GeoFactory.new(@attrs['geo']) unless @attrs['geo'].nil?
end

#mediaArray

Note:

Must :include_entities in your request for this method to work

Returns:

  • (Array)


45
46
47
48
49
# File 'lib/twitter/status.rb', line 45

def media
  @media ||= Array(@attrs['entities']['media']).map do |media|
    Twitter::MediaFactory.new(media)
  end unless @attrs['entities'].nil?
end

#metadataTwitter::Metadata

Returns:



52
53
54
# File 'lib/twitter/status.rb', line 52

def 
  @metadata ||= Twitter::Metadata.new(@attrs['metadata']) unless @attrs['metadata'].nil?
end

#oembed(options = {}) ⇒ Twitter::OEmbed

Returns:



74
75
76
77
# File 'lib/twitter/status.rb', line 74

def oembed(options={})
  @client ||= Twitter::Client.new
  @client.oembed(@attrs['id'], options) unless @attrs['id'].nil?
end

#placeTwitter::Place

Returns:



57
58
59
# File 'lib/twitter/status.rb', line 57

def place
  @place ||= Twitter::Place.new(@attrs['place']) unless @attrs['place'].nil?
end

#retweeted_statusTwitter::Status

If this status is itself a retweet, the original tweet is available here.

Returns:



69
70
71
# File 'lib/twitter/status.rb', line 69

def retweeted_status
  @retweeted_status ||= self.class.new(@attrs['retweeted_status']) unless @attrs['retweeted_status'].nil?
end

#userTwitter::User

Returns:



62
63
64
# File 'lib/twitter/status.rb', line 62

def user
  @user ||= Twitter::User.new(@attrs.dup['user'].merge('status' => @attrs.except('user'))) unless @attrs['user'].nil?
end