Class: Twitter::Tweet

Inherits:
Identity show all
Includes:
Creatable, Entities
Defined in:
lib/twitter/tweet.rb

Instance Attribute Summary collapse

Attributes inherited from Identity

#id

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Methods included from Entities

#entities?, #hashtags, #hashtags?, #media, #media?, #symbols, #symbols?, #uris, #uris?, #user_mentions, #user_mentions?

Methods included from Creatable

#created?, #created_at

Methods inherited from Identity

#initialize

Methods inherited from Base

#[], attr_reader, define_attribute_method, define_predicate_method, define_uri_method, deprecate_attribute_method, display_uri_attr_reader, #initialize, object_attr_reader, predicate_attr_reader, uri_attr_reader

Methods included from Utils

flat_pmap, pmap

Constructor Details

This class inherits a constructor from Twitter::Identity

Instance Attribute Details

#favorite_countInteger (readonly)

Returns:

  • (Integer)


12
13
14
# File 'lib/twitter/tweet.rb', line 12

def favorite_count
  @favorite_count
end

#filter_levelString (readonly)

Returns:

  • (String)


10
11
12
# File 'lib/twitter/tweet.rb', line 10

def filter_level
  @filter_level
end

#in_reply_to_screen_nameString (readonly)

Returns:

  • (String)


10
11
12
# File 'lib/twitter/tweet.rb', line 10

def in_reply_to_screen_name
  @in_reply_to_screen_name
end

#in_reply_to_status_idInteger (readonly) Also known as: in_reply_to_tweet_id

Returns:

  • (Integer)


12
13
14
# File 'lib/twitter/tweet.rb', line 12

def in_reply_to_status_id
  @in_reply_to_status_id
end

#in_reply_to_user_idInteger (readonly)

Returns:

  • (Integer)


12
13
14
# File 'lib/twitter/tweet.rb', line 12

def in_reply_to_user_id
  @in_reply_to_user_id
end

#langString (readonly)

Returns:

  • (String)


10
11
12
# File 'lib/twitter/tweet.rb', line 10

def lang
  @lang
end

#retweet_countInteger (readonly)

Returns:

  • (Integer)


12
13
14
# File 'lib/twitter/tweet.rb', line 12

def retweet_count
  @retweet_count
end

#sourceString (readonly)

Returns:

  • (String)


10
11
12
# File 'lib/twitter/tweet.rb', line 10

def source
  @source
end

#textString (readonly)

Returns:

  • (String)


10
11
12
# File 'lib/twitter/tweet.rb', line 10

def text
  @text
end

Instance Method Details

#full_textString

Note:

May be > 140 characters.

Returns:

  • (String)


37
38
39
40
41
42
43
44
# File 'lib/twitter/tweet.rb', line 37

def full_text
  if retweet?
    prefix = text[/\A(RT @[a-z0-9_]{1,20}: )/i, 1]
    [prefix, retweeted_status.text].compact.join
  else
    text
  end
end

#uriAddressable::URI Also known as: url

Returns The URL to the tweet.

Returns:

  • (Addressable::URI)

    The URL to the tweet.



48
49
50
# File 'lib/twitter/tweet.rb', line 48

def uri
  Addressable::URI.parse("https://twitter.com/#{user.screen_name}/status/#{id}") if user?
end