Telegram/Sticker.pm

filter: Statementstmt 42.1% 8 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 21.4% 3 / 14 Podpod 100% 10 / 10 totaltotal 48.8% 21 / 43 SCAR 1.8
CC
1
Cov
42%
download
2.0
emoji
2.0
file_id
2.0
CRAP 1.2
« Telegram/InlineQueryResultPhoto.pm ↑ Summary Telegram/InlineQueryResultContact.pm »
1 # -*- perl -*-
2 ##----------------------------------------------------------------------------
3 ## Net/API/Telegram/Sticker.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::Sticker;
15 BEGIN
16 {
17 1 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶ use parent qw( Net::API::Telegram::Generic );
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶ our( $VERSION ) = '0.1';
Subroutine BEGIN: called CC=1 SCAR=0.0
20 };
21  
22 0 ▶sub download { return( shift->_download( @_ ) ); }
Subroutine download: not called CC=1 SCAR=6.9
Pod documented
23  
24 0 ▶sub emoji { return( shift->_set_get_scalar( 'emoji', @_ ) ); }
Subroutine emoji: not called CC=1 SCAR=6.9
Pod documented
25  
26 0 ▶sub file_id { return( shift->_set_get_scalar( 'file_id', @_ ) ); }
Subroutine file_id: not called CC=1 SCAR=6.9
Pod documented
27  
28 0 ▶sub file_size { return( shift->_set_get_number( 'file_size', @_ ) ); }
Subroutine file_size: not called CC=1 SCAR=6.9
Pod documented
29  
30 0 ▶sub height { return( shift->_set_get_number( 'height', @_ ) ); }
Subroutine height: not called CC=1 SCAR=6.9
Pod documented
31  
32 0 ▶sub is_animated { return( shift->_set_get_scalar( 'is_animated', @_ ) ); }
Subroutine is_animated: not called CC=1 SCAR=6.9
Pod documented
33  
34 0 ▶sub mask_position { return( shift->_set_get_object( 'mask_position', 'Net::API::Telegram::MaskPosition', @_ ) ); }
Subroutine mask_position: not called CC=1 SCAR=6.9
Pod documented
35  
36 0 ▶sub set_name { return( shift->_set_get_scalar( 'set_name', @_ ) ); }
Subroutine set_name: not called CC=1 SCAR=6.9
Pod documented
37  
38 0 ▶sub thumb { return( shift->_set_get_object( 'thumb', 'Net::API::Telegram::PhotoSize', @_ ) ); }
Subroutine thumb: not called CC=1 SCAR=6.9
Pod documented
39  
40 0 ▶sub width { return( shift->_set_get_number( 'width', @_ ) ); }
Subroutine width: not called CC=1 SCAR=6.9
Pod documented
41  
42 0 ▶sub _is_boolean { return( grep( /^$_[1]$/, qw( is_animated ) ) ); }
Subroutine _is_boolean: not called CC=1 SCAR=6.9
43  
44 1 1;
45  
46 __END__
47  
48 =encoding utf-8
49  
50 =head1 NAME
51  
52 Net::API::Telegram::Sticker - A sticker
53  
54 =head1 SYNOPSIS
55  
56 my $msg = Net::API::Telegram::Sticker->new( %data ) ||
57 die( Net::API::Telegram::Sticker->error, "\n" );
58  
59 =head1 DESCRIPTION
60  
61 L<Net::API::Telegram::Sticker> is a Telegram Message Object as defined here L<https://core.telegram.org/bots/api#sticker>
62  
63 This module has been automatically generated from Telegram API documentation by the script scripts/telegram-doc2perl-methods.pl.
64  
65 =head1 METHODS
66  
67 =over 4
68  
69 =item B<new>( {INIT HASH REF}, %PARAMETERS )
70  
71 B<new>() will create a new object for the package, pass any argument it might receive
72 to the special standard routine B<init> that I<must> exist.
73 Then it returns what returns B<init>().
74  
75 The valid parameters are as follow. Methods available here are also parameters to the B<new> method.
76  
77 =over 8
78  
79 =item * I<verbose>
80  
81 =item * I<debug>
82  
83 =back
84  
85 =item B<download>( file_id, [ file extension ] )
86  
87 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.
88  
89 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:
90  
91 =over 8
92  
93 =item I<filepath>
94  
95 The full path to the temporary file
96  
97 =item I<mime>
98  
99 The mime type returned by the server.
100  
101 =item I<response>
102  
103 The L<HTTP::Response>
104  
105 =item I<size>
106  
107 The size in bytes of the file fetched
108  
109 =back
110 =item B<download>( )
111  
112  
113  
114 =item B<emoji>( String )
115  
116 Optional. Emoji associated with the sticker
117  
118 =item B<file_id>( String )
119  
120 Identifier for this file
121  
122 =item B<file_size>( Integer )
123  
124 Optional. File size
125  
126 =item B<height>( Integer )
127  
128 Sticker height
129  
130 =item B<is_animated>( Boolean )
131  
132 True, if the sticker is animated
133  
134 =item B<mask_position>( L<Net::API::Telegram::MaskPosition> )
135  
136 Optional. For mask stickers, the position where the mask should be placed
137  
138 =item B<set_name>( String )
139  
140 Optional. Name of the sticker set to which the sticker belongs
141  
142 =item B<thumb>( L<Net::API::Telegram::PhotoSize> )
143  
144 Optional. Sticker thumbnail in the .webp or .jpg format
145  
146 =item B<width>( Integer )
147  
148 Sticker width
149  
150 =back
151  
152 =head1 COPYRIGHT
153  
154 Copyright (c) 2000-2019 DEGUEST Pte. Ltd.
155  
156 =head1 AUTHOR
157  
158 Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
159  
160 =head1 SEE ALSO
161  
162 L<Net::API::Telegram>
163  
164 =head1 COPYRIGHT & LICENSE
165  
166 Copyright (c) 2018-2019 DEGUEST Pte. Ltd.
167  
168 You can use, copy, modify and redistribute this package and associated
169 files under the same terms as Perl itself.
170  
171 =cut
172  
« Telegram/InlineQueryResultPhoto.pm ↑ Summary Telegram/InlineQueryResultContact.pm »