Class: Twitter::Tweet
- Includes:
- Creatable
- Defined in:
- lib/twitter/tweet.rb
Instance Attribute Summary collapse
-
#favorited ⇒ Object
(also: #favorited?, #favourited, #favourited?)
readonly
Returns the value of attribute favorited.
-
#favoriters ⇒ Object
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.
-
#profile_image_url ⇒ Object
readonly
Returns the value of attribute profile_image_url.
-
#profile_image_url_https ⇒ Object
readonly
Returns the value of attribute profile_image_url_https.
-
#repliers ⇒ Object
readonly
Returns the value of attribute repliers.
-
#retweeted ⇒ Object
(also: #retweeted?)
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
(also: #truncated?)
readonly
Returns the value of attribute truncated.
Attributes inherited from Base
Instance Method Summary collapse
- #entities? ⇒ Boolean
- #favoriters_count ⇒ Integer (also: #favorite_count, #favourite_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)
- #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_mentions ⇒ Array<Twitter::Entity::UserMention>
Methods included from Creatable
Methods inherited from Identity
#==, fetch, #id, #initialize, store
Methods inherited from Base
#[], attr_reader, 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: favorited?, favourited, favourited?
Returns the value of attribute favorited.
16 17 18 |
# File 'lib/twitter/tweet.rb', line 16 def favorited @favorited end |
#favoriters ⇒ Object (readonly)
Returns the value of attribute favoriters.
16 17 18 |
# File 'lib/twitter/tweet.rb', line 16 def favoriters @favoriters end |
#from_user_id ⇒ Object (readonly)
Returns the value of attribute from_user_id.
16 17 18 |
# File 'lib/twitter/tweet.rb', line 16 def from_user_id @from_user_id end |
#from_user_name ⇒ Object (readonly)
Returns the value of attribute from_user_name.
16 17 18 |
# File 'lib/twitter/tweet.rb', line 16 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.
16 17 18 |
# File 'lib/twitter/tweet.rb', line 16 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.
16 17 18 |
# File 'lib/twitter/tweet.rb', line 16 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.
16 17 18 |
# File 'lib/twitter/tweet.rb', line 16 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.
16 17 18 |
# File 'lib/twitter/tweet.rb', line 16 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.
16 17 18 |
# File 'lib/twitter/tweet.rb', line 16 def iso_language_code @iso_language_code end |
#profile_image_url ⇒ Object (readonly)
Returns the value of attribute profile_image_url.
16 17 18 |
# File 'lib/twitter/tweet.rb', line 16 def profile_image_url @profile_image_url end |
#profile_image_url_https ⇒ Object (readonly)
Returns the value of attribute profile_image_url_https.
16 17 18 |
# File 'lib/twitter/tweet.rb', line 16 def profile_image_url_https @profile_image_url_https end |
#repliers ⇒ Object (readonly)
Returns the value of attribute repliers.
16 17 18 |
# File 'lib/twitter/tweet.rb', line 16 def repliers @repliers end |
#retweeted ⇒ Object (readonly) Also known as: retweeted?
Returns the value of attribute retweeted.
16 17 18 |
# File 'lib/twitter/tweet.rb', line 16 def retweeted @retweeted end |
#retweeters ⇒ Object (readonly)
Returns the value of attribute retweeters.
16 17 18 |
# File 'lib/twitter/tweet.rb', line 16 def retweeters @retweeters end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
16 17 18 |
# File 'lib/twitter/tweet.rb', line 16 def source @source end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
16 17 18 |
# File 'lib/twitter/tweet.rb', line 16 def text @text end |
#to_user ⇒ Object (readonly)
Returns the value of attribute to_user.
16 17 18 |
# File 'lib/twitter/tweet.rb', line 16 def to_user @to_user end |
#to_user_id ⇒ Object (readonly)
Returns the value of attribute to_user_id.
16 17 18 |
# File 'lib/twitter/tweet.rb', line 16 def to_user_id @to_user_id end |
#to_user_name ⇒ Object (readonly)
Returns the value of attribute to_user_name.
16 17 18 |
# File 'lib/twitter/tweet.rb', line 16 def to_user_name @to_user_name end |
#truncated ⇒ Object (readonly) Also known as: truncated?
Returns the value of attribute truncated.
16 17 18 |
# File 'lib/twitter/tweet.rb', line 16 def truncated @truncated end |
Instance Method Details
#entities? ⇒ Boolean
119 120 121 |
# File 'lib/twitter/tweet.rb', line 119 def entities? !@attrs[:entities].nil? end |
#favoriters_count ⇒ Integer Also known as: favorite_count, favourite_count, favouriters_count
29 30 31 32 |
# File 'lib/twitter/tweet.rb', line 29 def favoriters_count favoriters_count = @attrs[:favoriters_count] favoriters_count.to_i if favoriters_count end |
#from_user ⇒ String
38 39 40 |
# File 'lib/twitter/tweet.rb', line 38 def from_user @attrs[:from_user] || user && user.screen_name end |
#full_text ⇒ String
May be > 140 characters.
44 45 46 |
# File 'lib/twitter/tweet.rb', line 44 def full_text retweeted_status && retweeted_status.user ? "RT @#{retweeted_status.user.screen_name}: #{retweeted_status.text}" : text end |
#geo ⇒ Twitter::Geo
49 50 51 |
# File 'lib/twitter/tweet.rb', line 49 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
55 56 57 |
# File 'lib/twitter/tweet.rb', line 55 def @hashtags ||= entities(Twitter::Entity::Hashtag, :hashtags) end |
#media ⇒ Array<Twitter::Media>
Must include entities in your request for this method to work
61 62 63 |
# File 'lib/twitter/tweet.rb', line 61 def media @media ||= entities(Twitter::MediaFactory, :media) end |
#metadata ⇒ Twitter::Metadata
66 67 68 |
# File 'lib/twitter/tweet.rb', line 66 def @metadata ||= Twitter::Metadata.fetch_or_new(@attrs[:metadata]) end |
#place ⇒ Twitter::Place
71 72 73 |
# File 'lib/twitter/tweet.rb', line 71 def place @place ||= Twitter::Place.fetch_or_new(@attrs[:place]) end |
#repliers_count ⇒ Integer Also known as: reply_count
76 77 78 79 |
# File 'lib/twitter/tweet.rb', line 76 def repliers_count repliers_count = @attrs[:repliers_count] repliers_count.to_i if repliers_count end |
#retweet? ⇒ Boolean
82 83 84 |
# File 'lib/twitter/tweet.rb', line 82 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.
89 90 91 |
# File 'lib/twitter/tweet.rb', line 89 def retweeted_status @retweeted_status ||= self.class.fetch_or_new(@attrs[:retweeted_status]) end |
#retweeters_count ⇒ String Also known as: retweet_count
96 97 98 99 |
# File 'lib/twitter/tweet.rb', line 96 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
104 105 106 |
# File 'lib/twitter/tweet.rb', line 104 def urls @urls ||= entities(Twitter::Entity::Url, :urls) end |
#user ⇒ Twitter::User
109 110 111 |
# File 'lib/twitter/tweet.rb', line 109 def user @user ||= Twitter::User.fetch_or_new(@attrs.dup[:user].merge(:status => @attrs.except(:user))) if user? end |
#user_mentions ⇒ Array<Twitter::Entity::UserMention>
Must include entities in your request for this method to work
115 116 117 |
# File 'lib/twitter/tweet.rb', line 115 def user_mentions @user_mentions ||= entities(Twitter::Entity::UserMention, :user_mentions) end |