File Coverage

blib/lib/Net/Twitter/Role/API/UploadMedia.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1             package Net::Twitter::Role::API::UploadMedia;
2             $Net::Twitter::Role::API::UploadMedia::VERSION = '4.01043';
3 7     7   3996 use Moose::Role;
  7         15  
  7         39  
4 7     7   29199 use Net::Twitter::API;
  7         13  
  7         36  
5 7     7   5386 use DateTime::Format::Strptime;
  7         11  
  7         37  
6 7     7   342 use URI;
  7         12  
  7         1140  
7              
8             has upload_url => isa => 'Str', is => 'ro', default => 'http://upload.twitter.com/1.1';
9              
10             after BUILD => sub {
11                 my $self = shift;
12              
13                 $self->{upload_url} =~ s/^http:/https:/ if $self->ssl;
14             };
15              
16             base_url     'upload_url';
17             authenticate 1;
18              
19             twitter_api_method upload => (
20                 path => 'media/upload',
21                 method => 'POST',
22                 params => [qw/media/],
23                 required => [qw/media/],
24                 booleans => [qw/possibly_sensitive display_coordinates/],
25                 returns => 'HashRef',
26                 description => <<'',
27             Uploads an image to twitter without immediately posting it to the
28             authenticating user's timeline. Its return-value hashref notably contains a
29             C<media_id> value that's useful as a parameter value in various other
30             endpoint calls, such as C<update> and C<create_media_metadata>.
31            
32             );
33              
34             twitter_api_method upload_status => (
35                 path => 'media/upload',
36                 method => 'GET',
37                 params => [qw/media_id command/],
38                 required => [qw/media_id command/],
39                 booleans => [qw//],
40                 returns => 'status',
41                 description => 'Check the status for async video uploads.'
42             );
43              
44             1;
45              
46             __END__
47            
48             =head1 NAME
49            
50             Net::Twitter::Role::API::UploadImage - A definition of the Twitter Upload API as a Moose role
51            
52             =head1 VERSION
53            
54             version 4.01043
55            
56             =head1 SYNOPSIS
57            
58             package My::Twitter;
59             use Moose;
60             with 'Net::Twitter::API::UploadImage';
61            
62             =head1 DESCRIPTION
63            
64             This module provides definitions the Twitter Upload API methods.
65