gest::SHA;
use Encode qw/encode_utf8/;
use HTTP::Request;
use HTTP::Request::Common qw/POST/;
use JSON::MaybeXS ();
use Module::Runtime qw/use_module/;
use Ref::Util qw/is_arrayref is_ref/;
use Try::T
',
default => sub { '1.1' },
);
has api_ext => (
is => 'ro',
default => sub { '.json' },
);
has [ qw/consumer_key consumer_secret/ ] => (
is => 'ro',
required => 1,
);
},
);
has json_parser => (
is => 'ro',
lazy => 1,
default => sub { JSON::MaybeXS->new(utf8 => 1) },
handles => {
from_json => 'decode',
to_json => 'encode
say $c->http_request->uri;
# output:
https://api.twitter.com/1.1/statuses/home_timeline.json?trim_user=true
=head1 DESCRIPTION
Twitter has a strange concept of boolean values. Usually, the
, $to_json ) = @_;
croak 'expected a single hashref argument'
unless @_ == 2 && is_hashref($_[1]);
$self->request(post => 'media/metadata/create', {
-to_json => $to_json,
tion {
my ( $self, $to_json ) = @_;
croak 'unexpected extra args' if @_ > 2;
$self->request(post => 'collections/entries/curate', {
-to_json => $to_json,
});
}
#pod =method d
my $args = shift // {};
$self->request(post => 'direct_messages/events/new', {
-to_json => { event => $event }, %$args
});
}
#pod =method invalidate_access_token([ \%args ])
#pod
#
Response> object for the API call.
#pod
#pod =method twitter_error
#pod
#pod Returns the inflated JSON error response from Twitter (if any).
#pod
#pod =cut
has context => (
is => 'ro',
ring representation of the exception. If Twitter
#pod returned error information in the form of a JSON body, it is mined for error
#pod text. Otherwise, the HTTP response status line is used. The stac
eturns the L<HTTP::Response> object for the API call.
=head2 twitter_error
Returns the inflated JSON error response from Twitter (if any).
=head2 stack_trace
Returns a L<Devel::StackTrace> object