File Coverage

blib/lib/Mastodon/Entity/Attachment.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


line stmt bran cond sub pod time code
1             package Mastodon::Entity::Attachment;
2              
3 3     3   2292 use strict;
  3         7  
  3         81  
4 3     3   14 use warnings;
  3         4  
  3         119  
5              
6             our $VERSION = '0.016';
7              
8 3     3   30 use Moo;
  3         5  
  3         35  
9             with 'Mastodon::Role::Entity';
10              
11 3     3   867 use Types::Standard qw( Maybe Enum Int );
  3         6  
  3         31  
12 3     3   2724 use Mastodon::Types qw( URI );
  3         6  
  3         14  
13              
14             has id => ( is => 'ro', isa => Int, );
15             has preview_url => ( is => 'ro', isa => URI, coerce => 1, required => 1, );
16             has remote_url => ( is => 'ro', isa => Maybe [URI], coerce => 1, );
17             has text_url => ( is => 'ro', isa => Maybe [URI], coerce => 1, );
18             has url => ( is => 'ro', isa => URI, coerce => 1, );
19             has type => ( is => 'ro', isa => Enum[qw( image video gifv )], );
20              
21             1;
22              
23             =encoding utf8
24              
25             =head1 NAME
26              
27             Mastodon::Entity::Attachment - A Mastodon media attachment
28              
29             =head1 DESCRIPTION
30              
31             This object should not be manually created. It is intended to be generated
32             from the data received from a Mastodon server using the coercions in
33             L<Mastodon::Types>.
34              
35             For current information, see the
36             L<Mastodon API documentation|https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#attachment>
37              
38             =head1 ATTRIBUTES
39              
40             =over 4
41              
42             =item B<id>
43              
44             ID of the attachment.
45              
46             =item B<type>
47              
48             One of: "image", "video", "gifv".
49              
50             =item B<url>
51              
52             URL of the locally hosted version of the image.
53              
54             =item B<remote_url>
55              
56             For remote images, the remote URL of the original image.
57              
58             =item B<preview_url>
59              
60             URL of the preview image
61              
62             =item B<text_url>
63              
64             Shorter URL for the image, for insertion into text (only present on local
65             images).
66              
67             =back
68              
69             =head1 AUTHOR
70              
71             =over 4
72              
73             =item *
74              
75             José Joaquín Atria <jjatria@cpan.org>
76              
77             =back
78              
79             =head1 COPYRIGHT AND LICENSE
80              
81             This software is copyright (c) 2017 by José Joaquín Atria.
82              
83             This is free software; you can redistribute it and/or modify it under
84             the same terms as the Perl 5 programming language system itself.
85              
86             =cut