File Coverage

blib/lib/Net/API/Telegram/Animation.pm
Criterion Covered Total %
statement 7 16 43.7
branch n/a
condition n/a
subroutine 3 12 25.0
pod 9 9 100.0
total 19 37 51.3


line stmt bran cond sub pod time code
1             # -*- perl -*-
2             ##----------------------------------------------------------------------------
3             ## Net/API/Telegram/Animation.pm
4             ## Version 0.1
5             ## Copyright(c) 2019 Jacques Deguest
6             ## Author: Jacques Deguest <jack@deguest.jp>
7             ## Created 2019/05/29
8             ## Modified 2020/05/20
9             ## All rights reserved.
10             ##
11             ## This program is free software; you can redistribute it and/or modify it
12             ## under the same terms as Perl itself.
13             ##----------------------------------------------------------------------------
14             package Net::API::Telegram::Animation;
15             BEGIN
16             {
17 1     1   1291 use strict;
  1         2  
  1         35  
18 1     1   6 use parent qw( Net::API::Telegram::Generic );
  1         2  
  1         6  
19 1     1   232 our( $VERSION ) = '0.1';
20             };
21              
22 0     0 1   sub download { return( shift->_download( @_ ) ); }
23              
24 0     0 1   sub duration { return( shift->_set_get_number( 'duration', @_ ) ); }
25              
26 0     0 1   sub file_id { return( shift->_set_get_scalar( 'file_id', @_ ) ); }
27              
28 0     0 1   sub file_name { return( shift->_set_get_scalar( 'file_name', @_ ) ); }
29              
30 0     0 1   sub file_size { return( shift->_set_get_number( 'file_size', @_ ) ); }
31              
32 0     0 1   sub height { return( shift->_set_get_number( 'height', @_ ) ); }
33              
34 0     0 1   sub mime_type { return( shift->_set_get_scalar( 'mime_type', @_ ) ); }
35              
36 0     0 1   sub thumb { return( shift->_set_get_object( 'thumb', 'Net::API::Telegram::PhotoSize', @_ ) ); }
37              
38 0     0 1   sub width { return( shift->_set_get_number( 'width', @_ ) ); }
39              
40             1;
41              
42             __END__
43              
44             =encoding utf-8
45              
46             =head1 NAME
47              
48             Net::API::Telegram::Animation - An animation file (GIF or H.264/MPEG-4 AVC video without sound)
49              
50             =head1 SYNOPSIS
51              
52             my $msg = Net::API::Telegram::Animation->new( %data ) ||
53             die( Net::API::Telegram::Animation->error, "\n" );
54              
55             =head1 DESCRIPTION
56              
57             L<Net::API::Telegram::Animation> is a Telegram Message Object as defined here L<https://core.telegram.org/bots/api#animation>
58              
59             This module has been automatically generated from Telegram API documentation by the script scripts/telegram-doc2perl-methods.pl.
60              
61             =head1 METHODS
62              
63             =over 4
64              
65             =item B<new>( {INIT HASH REF}, %PARAMETERS )
66              
67             B<new>() will create a new object for the package, pass any argument it might receive
68             to the special standard routine B<init> that I<must> exist.
69             Then it returns what returns B<init>().
70              
71             The valid parameters are as follow. Methods available here are also parameters to the B<new> method.
72              
73             =over 8
74              
75             =item * I<verbose>
76              
77             =item * I<debug>
78              
79             =back
80              
81             =item B<download>( file_id, [ file extension ] )
82              
83             Given a file id like file_id, this will call the B<getFile>() method from the parent L<Net::API::Telegram> package and receive a L<Net::API::Telegram::File> object in return, which contains a file path valid for only one hour according to Telegram api here L<https://core.telegram.org/bots/api#getfile>. With this file path, this B<download> method will issue a http get request and retrieve the file and save it locally in a temproary file generated by L<File::Temp>. If an extension is provided, it will be appended to the temproary file name such as C<myfile.jpg> otherwise the extension will be gussed from the mime type returned by the Telegram http server, if any.
84              
85             This method returns undef() on error and sets a L<Net::API::Telegram::Error> or, on success, returns a hash reference with the following properties:
86              
87             =over 8
88              
89             =item I<filepath>
90              
91             The full path to the temporary file
92              
93             =item I<mime>
94              
95             The mime type returned by the server.
96              
97             =item I<response>
98              
99             The L<HTTP::Response>
100              
101             =item I<size>
102              
103             The size in bytes of the file fetched
104              
105             =back
106             =item B<download>( )
107              
108              
109              
110             =item B<duration>( Integer )
111              
112             Duration of the video in seconds as defined by sender
113              
114             =item B<file_id>( String )
115              
116             Identifier for this file
117              
118             =item B<file_name>( String )
119              
120             Optional. Original animation filename as defined by sender
121              
122             =item B<file_size>( Integer )
123              
124             Optional. File size
125              
126             =item B<height>( Integer )
127              
128             Video height as defined by sender
129              
130             =item B<mime_type>( String )
131              
132             Optional. MIME type of the file as defined by sender
133              
134             =item B<thumb>( L<Net::API::Telegram::PhotoSize> )
135              
136             Optional. Animation thumbnail as defined by sender
137              
138             =item B<width>( Integer )
139              
140             Video width as defined by sender
141              
142             =back
143              
144             =head1 COPYRIGHT
145              
146             Copyright (c) 2000-2019 DEGUEST Pte. Ltd.
147              
148             =head1 AUTHOR
149              
150             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
151              
152             =head1 SEE ALSO
153              
154             L<Net::API::Telegram>
155              
156             =head1 COPYRIGHT & LICENSE
157              
158             Copyright (c) 2018-2019 DEGUEST Pte. Ltd.
159              
160             You can use, copy, modify and redistribute this package and associated
161             files under the same terms as Perl itself.
162              
163             =cut
164