Class: Twitter::Tweet
- Defined in:
- lib/twitter/tweet.rb
Overview
Represents a Twitter tweet
Instance Attribute Summary collapse
-
#favorite_count ⇒ Integer
readonly
The number of times this tweet has been retweeted.
-
#filter_level ⇒ String
readonly
The text of the tweet.
-
#in_reply_to_screen_name ⇒ String
readonly
The text of the tweet.
-
#in_reply_to_status_id ⇒ Integer
(also: #in_reply_to_tweet_id)
readonly
The number of times this tweet has been retweeted.
-
#in_reply_to_user_id ⇒ Integer
readonly
The number of times this tweet has been retweeted.
-
#lang ⇒ String
readonly
The text of the tweet.
-
#quote_count ⇒ Integer
readonly
The number of times this tweet has been retweeted.
-
#reply_count ⇒ Integer
readonly
The number of times this tweet has been retweeted.
-
#retweet_count ⇒ Integer
readonly
The number of times this tweet has been retweeted.
-
#source ⇒ String
readonly
The text of the tweet.
-
#text ⇒ String
readonly
The text of the tweet.
Attributes inherited from Identity
Attributes inherited from Base
Instance Method Summary collapse
-
#full_text ⇒ String
Returns the full text of the tweet.
-
#initialize(attrs) ⇒ Twitter::Tweet
constructor
Initializes a new Tweet object.
-
#uri ⇒ URI::Generic
(also: #url)
Returns the URI to the tweet.
Methods included from Entities
#entities?, #hashtags, #hashtags?, #media, #media?, #symbols, #symbols?, #uris, #uris?, #user_mentions, #user_mentions?
Methods included from Creatable
Methods inherited from Base
#[], attr_reader, define_attribute_method, define_predicate_method, define_uri_method, display_uri_attr_reader, object_attr_reader, predicate_attr_reader, uri_attr_reader
Methods included from Utils
Constructor Details
#initialize(attrs) ⇒ Twitter::Tweet
Initializes a new Tweet object
178 179 180 181 |
# File 'lib/twitter/tweet.rb', line 178 def initialize(attrs) attrs[:text] ||= attrs[:full_text] super end |
Instance Attribute Details
#favorite_count ⇒ Integer (readonly)
The number of times this tweet has been retweeted
88 89 90 |
# File 'lib/twitter/tweet.rb', line 88 def favorite_count @favorite_count end |
#filter_level ⇒ String (readonly)
The text of the tweet
45 46 47 |
# File 'lib/twitter/tweet.rb', line 45 def filter_level @filter_level end |
#in_reply_to_screen_name ⇒ String (readonly)
The text of the tweet
45 46 47 |
# File 'lib/twitter/tweet.rb', line 45 def in_reply_to_screen_name @in_reply_to_screen_name end |
#in_reply_to_status_id ⇒ Integer (readonly) Also known as: in_reply_to_tweet_id
The number of times this tweet has been retweeted
88 89 90 |
# File 'lib/twitter/tweet.rb', line 88 def in_reply_to_status_id @in_reply_to_status_id end |
#in_reply_to_user_id ⇒ Integer (readonly)
The number of times this tweet has been retweeted
88 89 90 |
# File 'lib/twitter/tweet.rb', line 88 def in_reply_to_user_id @in_reply_to_user_id end |
#lang ⇒ String (readonly)
The text of the tweet
45 46 47 |
# File 'lib/twitter/tweet.rb', line 45 def lang @lang end |
#quote_count ⇒ Integer (readonly)
The number of times this tweet has been retweeted
88 89 90 |
# File 'lib/twitter/tweet.rb', line 88 def quote_count @quote_count end |
#reply_count ⇒ Integer (readonly)
The number of times this tweet has been retweeted
88 89 90 |
# File 'lib/twitter/tweet.rb', line 88 def reply_count @reply_count end |
#retweet_count ⇒ Integer (readonly)
The number of times this tweet has been retweeted
88 89 90 |
# File 'lib/twitter/tweet.rb', line 88 def retweet_count @retweet_count end |
#source ⇒ String (readonly)
The text of the tweet
45 46 47 |
# File 'lib/twitter/tweet.rb', line 45 def source @source end |
#text ⇒ String (readonly)
The text of the tweet
45 46 47 |
# File 'lib/twitter/tweet.rb', line 45 def text @text end |
Instance Method Details
#full_text ⇒ String
May be > 280 characters
Returns the full text of the tweet
190 191 192 193 194 195 196 197 |
# File 'lib/twitter/tweet.rb', line 190 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 |
#uri ⇒ URI::Generic Also known as: url
Returns the URI to the tweet
206 207 208 |
# File 'lib/twitter/tweet.rb', line 206 def uri URI.parse("https://twitter.com/#{user.screen_name}/status/#{id}") if user? end |