File Coverage

blib/lib/Telegram/Bot/Object/InlineQuery.pm
Criterion Covered Total %
statement 13 17 76.4
branch n/a
condition 0 4 0.0
subroutine 5 6 83.3
pod 1 2 50.0
total 19 29 65.5


line stmt bran cond sub pod time code
1             package Telegram::Bot::Object::InlineQuery;
2             $Telegram::Bot::Object::InlineQuery::VERSION = '0.029';
3             # ABSTRACT: The base class for Telegram 'Invoice' type objects
4              
5              
6 6     6   273944 use Mojo::Base 'Telegram::Bot::Object::Base';
  6         10364  
  6         41  
7 6     6   3163 use Mojo::JSON ();
  6         756658  
  6         291  
8 6     6   743 use Telegram::Bot::Object::Location;
  6         25  
  6         72  
9 6     6   1026 use Telegram::Bot::Object::User;
  6         15  
  6         63  
10              
11             has 'id';
12             has 'from'; # User
13             has 'query';
14             has 'offset';
15             has 'chat_type';
16             has 'location'; # Location
17              
18             sub fields {
19             return {
20 4     4 0 37 scalar => [qw/id query offset chat_type/],
21             'Telegram::Bot::Object::User' => [qw/from/],
22             'Telegram::Bot::Object::Location' => [qw/location/],
23             };
24             }
25              
26              
27             sub reply {
28 0     0 1   my $self = shift;
29 0   0       my $results = shift // [];
30 0   0       my $args = shift // {};
31              
32 0           return $self->_brain->answerInlineQuery(
33             {
34             inline_query_id => $self->id,
35             results => Mojo::JSON::to_json($results),
36             %$args
37             }
38             );
39             }
40              
41             1;
42              
43             __END__