NAME
Mojo::WebService::Twitter::Tweet - A tweet
SYNOPSIS
use Mojo::WebService::Twitter;
my $twitter = Mojo::WebService::Twitter->new(api_key => $api_key, api_secret => $api_secret);
my $tweet = $twitter->get_tweet($tweet_id);
my $username = $tweet->user->screen_name;
my $created_at = $tweet->created_at;
my $text = $tweet->text;
say "[$created_at] \@$username: $text";
DESCRIPTION
Mojo::WebService::Twitter::Tweet is an object representing a Twitter tweet. See https://dev.twitter.com/overview/api/tweets for more information.
ATTRIBUTES
source
my $href = $tweet->source;
Source data hashref from Twitter API.
coordinates
my $coords = $tweet->coordinates;
Array reference of geographic coordinates (longitude then latitude), or undef
if tweet does not have coordinates.
created_at
my $ts = $tweet->created_at;
Time::Piece object representing the creation time of the tweet in UTC.
favorites
my $count = $tweet->favorites;
Number of times the tweet has been favorited.
id
my $tweet_id = $tweet->id;
Tweet identifier. Note that tweet IDs are usually too large to be represented as a number, so should always be treated as a string.
in_reply_to_screen_name
my $screen_name = $tweet->in_reply_to_screen_name;
Screen name of user whom tweet was in reply to, or undef
if tweet was not a reply.
in_reply_to_status_id
my $tweet_id = $tweet->in_reply_to_status_id;
Tweet ID which tweet was in reply to, or undef
if tweet was not a reply.
in_reply_to_user_id
my $user_id = $tweet->in_reply_to_user_id;
User ID of user whom tweet was in reply to, or undef
if tweet was not a reply.
media
my $media = $tweet->media;
Array reference of media entities associated to this tweet as Mojo::WebService::Twitter::Media objects.
retweets
my $count = $tweet->retweets;
Number of times the tweet has been retweeted.
text
my $text = $tweet->text;
Text contents of tweet.
user
my $user = $tweet->user;
User who sent the tweet, as a Mojo::WebService::Twitter::User object.
METHODS
Mojo::WebService::Twitter::Tweet inherits all methods from Mojo::Base, and implements the following new ones.
from_source
$tweet = $tweet->from_source($hr);
Populate attributes from hashref of Twitter API source data.
BUGS
Report any issues on the public bugtracker.
AUTHOR
Dan Book <dbook@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2015 by Dan Book.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)