File Coverage

blib/lib/Telegram/Bot/Object/ChatJoinRequest.pm
Criterion Covered Total %
statement 15 22 68.1
branch n/a
condition n/a
subroutine 5 9 55.5
pod 1 4 25.0
total 21 35 60.0


line stmt bran cond sub pod time code
1             package Telegram::Bot::Object::ChatJoinRequest;
2             $Telegram::Bot::Object::ChatJoinRequest::VERSION = '0.029';
3             # ABSTRACT: The base class for the Telegram type "ChatJoinRequest".
4              
5              
6 2     2   14 use Mojo::Base 'Telegram::Bot::Object::Base';
  2         3  
  2         15  
7              
8 2     2   519 use Telegram::Bot::Object::User;
  2         4  
  2         27  
9 2     2   65 use Telegram::Bot::Object::Chat;
  2         3  
  2         14  
10 2     2   1175 use Telegram::Bot::Object::ChatInviteLink;
  2         7  
  2         14  
11              
12 2     2   104 use Data::Dumper;
  2         6  
  2         808  
13              
14             # basic message stuff
15             has 'chat'; # Chat
16             has 'from'; # User
17              
18             has 'user_chat_id'; # Integer
19             has 'date'; # Integer
20             has 'bio'; # String
21             has 'invite_link'; # ChatInviteLink
22              
23             sub fields {
24             return {
25 0     0 0   'scalar' => [qw/user_chat_id date bio/],
26             'Telegram::Bot::Object::User' => [qw/from/],
27              
28             'Telegram::Bot::Object::Chat' => [qw/chat/],
29              
30             'Telegram::Bot::Object::ChatInviteLink' => [qw/invite_link/],
31             };
32             }
33              
34       0 1   sub arrays {
35             }
36              
37              
38             sub approve {
39 0     0 0   my $self = shift;
40 0           my $text = shift;
41 0           return $self->_brain->approveChatJoinRequest({chat_id => $self->chat->id, user_id => $self->from->id});
42             }
43              
44             sub decline {
45 0     0 0   my $self = shift;
46 0           my $text = shift;
47 0           return $self->_brain->declineChatJoinRequest({chat_id => $self->chat->id, user_id => $self->from->id});
48             }
49              
50             1;
51              
52             __END__