Class: Twitter::Tweet
Instance Attribute Summary collapse
-
#favorited ⇒ Object
(also: #favourited)
readonly
Returns the value of attribute favorited.
-
#favoriters ⇒ Object
(also: #favouriters)
readonly
Returns the value of attribute favoriters.
-
#from_user_id ⇒ Object
readonly
Returns the value of attribute from_user_id.
-
#from_user_name ⇒ Object
readonly
Returns the value of attribute from_user_name.
-
#in_reply_to_attrs_id ⇒ Object
readonly
Returns the value of attribute in_reply_to_attrs_id.
-
#in_reply_to_screen_name ⇒ Object
readonly
Returns the value of attribute in_reply_to_screen_name.
-
#in_reply_to_status_id ⇒ Object
(also: #in_reply_to_tweet_id)
readonly
Returns the value of attribute in_reply_to_status_id.
-
#in_reply_to_user_id ⇒ Object
readonly
Returns the value of attribute in_reply_to_user_id.
-
#iso_language_code ⇒ Object
readonly
Returns the value of attribute iso_language_code.
-
#repliers ⇒ Object
readonly
Returns the value of attribute repliers.
-
#retweeted ⇒ Object
readonly
Returns the value of attribute retweeted.
-
#retweeters ⇒ Object
readonly
Returns the value of attribute retweeters.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#to_user ⇒ Object
readonly
Returns the value of attribute to_user.
-
#to_user_id ⇒ Object
readonly
Returns the value of attribute to_user_id.
-
#to_user_name ⇒ Object
readonly
Returns the value of attribute to_user_name.
-
#truncated ⇒ Object
readonly
Returns the value of attribute truncated.
Instance Method Summary collapse
- #entities? ⇒ Boolean
- #favoriters_count ⇒ Integer (also: #favorite_count, #favorites_count, #favourite_count, #favourites_count, #favouriters_count)
- #from_user ⇒ String
- #full_text ⇒ String
- #geo ⇒ Twitter::Geo
- #hashtags ⇒ Array<Twitter::Entity::Hashtag>
- #media ⇒ Array<Twitter::Media>
- #metadata ⇒ Twitter::Metadata
- #place ⇒ Twitter::Place
- #repliers_count ⇒ Integer (also: #reply_count)
- #reply? ⇒ Boolean
- #retweet? ⇒ Boolean
-
#retweeted_status ⇒ Twitter::Tweet
(also: #retweeted_tweet, #retweet)
If this Tweet is a retweet, the original Tweet is available here.
- #retweeters_count ⇒ String (also: #retweet_count)
- #urls ⇒ Array<Twitter::Entity::Url>
- #user ⇒ Twitter::User
- #user? ⇒ Boolean
- #user_mentions ⇒ Array<Twitter::Entity::UserMention>
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
#favorited ⇒ Object (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 |
#favoriters ⇒ Object (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 |
#from_user_id ⇒ Object (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 |
#from_user_name ⇒ Object (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 |
#in_reply_to_attrs_id ⇒ Object (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 |
#in_reply_to_screen_name ⇒ Object (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 |
#in_reply_to_status_id ⇒ Object (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 |
#in_reply_to_user_id ⇒ Object (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 |
#iso_language_code ⇒ Object (readonly)
Returns the value of attribute iso_language_code.
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def iso_language_code @iso_language_code end |
#repliers ⇒ Object (readonly)
Returns the value of attribute repliers.
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def repliers @repliers end |
#retweeted ⇒ Object (readonly)
Returns the value of attribute retweeted.
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def retweeted @retweeted end |
#retweeters ⇒ Object (readonly)
Returns the value of attribute retweeters.
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def retweeters @retweeters end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def source @source end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def text @text end |
#to_user ⇒ Object (readonly)
Returns the value of attribute to_user.
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def to_user @to_user end |
#to_user_id ⇒ Object (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 |
#to_user_name ⇒ Object (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 |
#truncated ⇒ Object (readonly)
Returns the value of attribute truncated.
11 12 13 |
# File 'lib/twitter/tweet.rb', line 11 def truncated @truncated end |
Instance Method Details
#entities? ⇒ Boolean
23 24 25 |
# File 'lib/twitter/tweet.rb', line 23 def entities? !@attrs[:entities].nil? end |
#favoriters_count ⇒ Integer Also known as: favorite_count, favorites_count, favourite_count, favourites_count, favouriters_count
28 29 30 31 |
# File 'lib/twitter/tweet.rb', line 28 def favoriters_count favoriters_count = @attrs[:favoriters_count] favoriters_count.to_i if favoriters_count end |
#from_user ⇒ String
39 40 41 |
# File 'lib/twitter/tweet.rb', line 39 def from_user @attrs[:from_user] || user && user.screen_name end |
#full_text ⇒ String
May be > 140 characters.
45 46 47 48 49 50 51 52 |
# File 'lib/twitter/tweet.rb', line 45 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 |
#geo ⇒ Twitter::Geo
55 56 57 |
# File 'lib/twitter/tweet.rb', line 55 def geo @geo ||= Twitter::GeoFactory.fetch_or_new(@attrs[:geo]) end |
#hashtags ⇒ Array<Twitter::Entity::Hashtag>
Must include entities in your request for this method to work
61 62 63 |
# File 'lib/twitter/tweet.rb', line 61 def ||= entities(Twitter::Entity::Hashtag, :hashtags) end |
#media ⇒ Array<Twitter::Media>
Must include entities in your request for this method to work
67 68 69 |
# File 'lib/twitter/tweet.rb', line 67 def media @media ||= entities(Twitter::MediaFactory, :media) end |
#metadata ⇒ Twitter::Metadata
72 73 74 |
# File 'lib/twitter/tweet.rb', line 72 def ||= Twitter::Metadata.fetch_or_new(@attrs[:metadata]) end |
#place ⇒ Twitter::Place
77 78 79 |
# File 'lib/twitter/tweet.rb', line 77 def place @place ||= Twitter::Place.fetch_or_new(@attrs[:place]) end |
#repliers_count ⇒ Integer Also known as: reply_count
82 83 84 85 |
# File 'lib/twitter/tweet.rb', line 82 def repliers_count repliers_count = @attrs[:repliers_count] repliers_count.to_i if repliers_count end |
#reply? ⇒ Boolean
89 90 91 |
# File 'lib/twitter/tweet.rb', line 89 def reply? !!in_reply_to_status_id end |
#retweet? ⇒ Boolean
94 95 96 |
# File 'lib/twitter/tweet.rb', line 94 def retweet? !!retweeted_status end |
#retweeted_status ⇒ Twitter::Tweet Also known as: retweeted_tweet, retweet
If this Tweet is a retweet, the original Tweet is available here.
101 102 103 |
# File 'lib/twitter/tweet.rb', line 101 def retweeted_status @retweeted_status ||= self.class.fetch_or_new(@attrs[:retweeted_status]) end |
#retweeters_count ⇒ String Also known as: retweet_count
108 109 110 111 |
# File 'lib/twitter/tweet.rb', line 108 def retweeters_count retweeters_count = (@attrs[:retweet_count] || @attrs[:retweeters_count]) retweeters_count.to_i if retweeters_count end |
#urls ⇒ Array<Twitter::Entity::Url>
Must include entities in your request for this method to work
116 117 118 |
# File 'lib/twitter/tweet.rb', line 116 def urls @urls ||= entities(Twitter::Entity::Url, :urls) end |
#user ⇒ Twitter::User
121 122 123 |
# File 'lib/twitter/tweet.rb', line 121 def user @user ||= fetch_or_new_without_self(Twitter::User, @attrs, :user, :status) end |
#user? ⇒ Boolean
131 132 133 |
# File 'lib/twitter/tweet.rb', line 131 def user? !@attrs[:user].nil? end |
#user_mentions ⇒ Array<Twitter::Entity::UserMention>
Must include entities in your request for this method to work
127 128 129 |
# File 'lib/twitter/tweet.rb', line 127 def user_mentions @user_mentions ||= entities(Twitter::Entity::UserMention, :user_mentions) end |