Class: Twitter::Tweet
- Inherits:
- Identity show all
- Extended by:
- Forwardable
- Includes:
- Creatable, Exceptable
- Defined in:
- lib/twitter/tweet.rb
Instance Attribute Summary (collapse)
-
- (Object) favorite_count
(also: #favorites_count, #favourite_count, #favourites_count, #favouriters_count)
readonly
Returns the value of attribute favorite_count.
-
- (Object) favorited
(also: #favourited)
readonly
Returns the value of attribute favorited.
-
- (Object) favoriters
(also: #favouriters)
readonly
Returns the value of attribute favoriters.
-
- (Object) from_user_id
readonly
Returns the value of attribute from_user_id.
-
- (Object) from_user_name
readonly
Returns the value of attribute from_user_name.
-
- (Object) in_reply_to_attrs_id
readonly
Returns the value of attribute in_reply_to_attrs_id.
-
- (Object) in_reply_to_screen_name
readonly
Returns the value of attribute in_reply_to_screen_name.
-
- (Object) in_reply_to_status_id
(also: #in_reply_to_tweet_id)
readonly
Returns the value of attribute in_reply_to_status_id.
-
- (Object) in_reply_to_user_id
readonly
Returns the value of attribute in_reply_to_user_id.
-
- (Object) lang
readonly
Returns the value of attribute lang.
-
- (Object) repliers
readonly
Returns the value of attribute repliers.
-
- (Object) retweeted
readonly
Returns the value of attribute retweeted.
-
- (Object) retweeters
readonly
Returns the value of attribute retweeters.
-
- (Object) source
readonly
Returns the value of attribute source.
-
- (Object) text
readonly
Returns the value of attribute text.
-
- (Object) to_user
readonly
Returns the value of attribute to_user.
-
- (Object) to_user_id
readonly
Returns the value of attribute to_user_id.
-
- (Object) to_user_name
readonly
Returns the value of attribute to_user_name.
-
- (Object) truncated
readonly
Returns the value of attribute truncated.
Instance Method Summary (collapse)
-
- (Boolean) entities?
-
- (Integer) favoriters_count
-
- (Object) filter_level
-
- (String) from_user
-
- (String) full_text
-
- (Twitter::Geo) geo
-
- (Array<Twitter::Entity::Hashtag>) hashtags
-
- (Array<Twitter::Media>) media
-
- (Twitter::Metadata) metadata
-
- (Twitter::Place) place
-
- (Integer) repliers_count
(also: #reply_count)
-
- (Boolean) reply?
-
- (Boolean) retweet?
-
- (Twitter::Tweet) retweeted_status
(also: #retweeted_tweet, #retweet)
If this Tweet is a retweet, the original Tweet is available here.
-
- (String) retweeters_count
(also: #retweet_count)
-
- (Array<Twitter::Entity::Url>) urls
-
- (Twitter::User) user
-
- (Boolean) user?
-
- (Array<Twitter::Entity::UserMention>) user_mentions
Methods included from Creatable
Methods inherited from Identity
#==, fetch, #id, #initialize, store
Methods inherited from Base
#[], #attr_equal, attr_reader, #attrs, #attrs_equal, fetch, fetch_or_new, from_response, identity_map, #initialize, store, #update
Constructor Details
This class inherits a constructor from Twitter::Identity
Instance Attribute Details
- (Object) favorite_count (readonly) Also known as: favorites_count, favourite_count, favourites_count, favouriters_count
Returns the value of attribute favorite_count
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def favorite_count @favorite_count end |
- (Object) favorited (readonly) Also known as: favourited
Returns the value of attribute favorited
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def favorited @favorited end |
- (Object) favoriters (readonly) Also known as: favouriters
Returns the value of attribute favoriters
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def favoriters @favoriters end |
- (Object) from_user_id (readonly)
Returns the value of attribute from_user_id
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def from_user_id @from_user_id end |
- (Object) from_user_name (readonly)
Returns the value of attribute from_user_name
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def from_user_name @from_user_name end |
- (Object) in_reply_to_attrs_id (readonly)
Returns the value of attribute in_reply_to_attrs_id
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def in_reply_to_attrs_id @in_reply_to_attrs_id end |
- (Object) in_reply_to_screen_name (readonly)
Returns the value of attribute in_reply_to_screen_name
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def in_reply_to_screen_name @in_reply_to_screen_name end |
- (Object) in_reply_to_status_id (readonly) Also known as: in_reply_to_tweet_id
Returns the value of attribute in_reply_to_status_id
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def in_reply_to_status_id @in_reply_to_status_id end |
- (Object) in_reply_to_user_id (readonly)
Returns the value of attribute in_reply_to_user_id
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def in_reply_to_user_id @in_reply_to_user_id end |
- (Object) lang (readonly)
Returns the value of attribute lang
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def lang @lang end |
- (Object) repliers (readonly)
Returns the value of attribute repliers
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def repliers @repliers end |
- (Object) retweeted (readonly)
Returns the value of attribute retweeted
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def retweeted @retweeted end |
- (Object) retweeters (readonly)
Returns the value of attribute retweeters
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def retweeters @retweeters end |
- (Object) source (readonly)
Returns the value of attribute source
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def source @source end |
- (Object) text (readonly)
Returns the value of attribute text
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def text @text end |
- (Object) to_user (readonly)
Returns the value of attribute to_user
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def to_user @to_user end |
- (Object) to_user_id (readonly)
Returns the value of attribute to_user_id
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def to_user_id @to_user_id end |
- (Object) to_user_name (readonly)
Returns the value of attribute to_user_name
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def to_user_name @to_user_name end |
- (Object) truncated (readonly)
Returns the value of attribute truncated
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def truncated @truncated end |
Instance Method Details
- (Boolean) entities?
27 28 29 |
# File 'lib/twitter/tweet.rb', line 27 def entities? !@attrs[:entities].nil? end |
- (Integer) favoriters_count
32 33 34 35 |
# File 'lib/twitter/tweet.rb', line 32 def favoriters_count favoriters_count = @attrs[:favoriters_count] favoriters_count.to_i if favoriters_count end |
- (Object) filter_level
42 43 44 |
# File 'lib/twitter/tweet.rb', line 42 def filter_level @attrs[:filter_level] || "none" end |
- (String) from_user
38 39 40 |
# File 'lib/twitter/tweet.rb', line 38 def from_user @attrs[:from_user] || user && user.screen_name end |
- (String) full_text
May be > 140 characters.
48 49 50 51 52 53 54 55 |
# File 'lib/twitter/tweet.rb', line 48 def full_text if retweeted_status prefix = text[/\A(RT @[a-z0-9_]{1,20}: )/i, 1] [prefix, retweeted_status.text].compact.join else text end end |
- (Twitter::Geo) geo
58 59 60 |
# File 'lib/twitter/tweet.rb', line 58 def geo @geo ||= Twitter::GeoFactory.fetch_or_new(@attrs[:geo]) end |
- (Array<Twitter::Entity::Hashtag>) hashtags
Must include entities in your request for this method to work
64 65 66 |
# File 'lib/twitter/tweet.rb', line 64 def @hashtags ||= entities(Twitter::Entity::Hashtag, :hashtags) end |
- (Array<Twitter::Media>) media
Must include entities in your request for this method to work
70 71 72 |
# File 'lib/twitter/tweet.rb', line 70 def media @media ||= entities(Twitter::MediaFactory, :media) end |
- (Twitter::Metadata) metadata
75 76 77 |
# File 'lib/twitter/tweet.rb', line 75 def @metadata ||= Twitter::Metadata.fetch_or_new(@attrs[:metadata]) end |
- (Twitter::Place) place
80 81 82 |
# File 'lib/twitter/tweet.rb', line 80 def place @place ||= Twitter::Place.fetch_or_new(@attrs[:place]) end |
- (Integer) repliers_count Also known as: reply_count
85 86 87 88 |
# File 'lib/twitter/tweet.rb', line 85 def repliers_count repliers_count = @attrs[:repliers_count] repliers_count.to_i if repliers_count end |
- (Boolean) reply?
92 93 94 |
# File 'lib/twitter/tweet.rb', line 92 def reply? !!in_reply_to_status_id end |
- (Boolean) retweet?
97 98 99 |
# File 'lib/twitter/tweet.rb', line 97 def retweet? !!retweeted_status end |
- (Twitter::Tweet) retweeted_status Also known as: retweeted_tweet, retweet
If this Tweet is a retweet, the original Tweet is available here.
104 105 106 |
# File 'lib/twitter/tweet.rb', line 104 def retweeted_status @retweeted_status ||= self.class.fetch_or_new(@attrs[:retweeted_status]) end |
- (String) retweeters_count Also known as: retweet_count
111 112 113 114 |
# File 'lib/twitter/tweet.rb', line 111 def retweeters_count retweeters_count = (@attrs[:retweet_count] || @attrs[:retweeters_count]) retweeters_count.to_i if retweeters_count end |
- (Array<Twitter::Entity::Url>) urls
Must include entities in your request for this method to work
119 120 121 |
# File 'lib/twitter/tweet.rb', line 119 def urls @urls ||= entities(Twitter::Entity::Url, :urls) end |
- (Twitter::User) user
124 125 126 |
# File 'lib/twitter/tweet.rb', line 124 def user @user ||= fetch_or_new_without_self(Twitter::User, @attrs, :user, :status) end |
- (Boolean) user?
134 135 136 |
# File 'lib/twitter/tweet.rb', line 134 def user? !@attrs[:user].nil? end |
- (Array<Twitter::Entity::UserMention>) user_mentions
Must include entities in your request for this method to work
130 131 132 |
# File 'lib/twitter/tweet.rb', line 130 def user_mentions @user_mentions ||= entities(Twitter::Entity::UserMention, :user_mentions) end |