File Coverage

blib/lib/RT/Client/REST/HTTPClient.pm
Criterion Covered Total %
statement 13 17 76.4
branch 1 4 25.0
condition n/a
subroutine 4 5 80.0
pod 2 2 100.0
total 20 28 71.4


line stmt bran cond sub pod time code
1             #!perl
2             # PODNAME: RT::Client::REST::HTTPClient
3             # ABSTRACT: Subclass LWP::UserAgent in order to support basic authentication.
4              
5 21     21   170 use strict;
  21         258  
  21         702  
6 21     21   147 use warnings;
  21         57  
  21         1032  
7              
8             package RT::Client::REST::HTTPClient;
9             $RT::Client::REST::HTTPClient::VERSION = '0.71';
10 21     21   126 use parent 'LWP::UserAgent';
  21         46  
  21         138  
11              
12              
13             sub get_basic_credentials {
14 0     0 1 0 my $self = shift;
15              
16 0 0       0 if ($self->basic_auth_cb) {
17 0         0 return $self->basic_auth_cb->(@_);
18             }
19             else {
20 0         0 return;
21             }
22             }
23              
24              
25             sub basic_auth_cb {
26 3     3 1 13 my $self = shift;
27              
28 3 50       28 if (@_) {
29 3         29 $self->{basic_auth_cb} = shift;
30             }
31              
32 3         15 return $self->{basic_auth_cb};
33             }
34              
35              
36             1;
37              
38             __END__
39              
40             =pod
41              
42             =encoding UTF-8
43              
44             =head1 NAME
45              
46             RT::Client::REST::HTTPClient - Subclass LWP::UserAgent in order to support basic authentication.
47              
48             =head1 VERSION
49              
50             version 0.71
51              
52             =head1 METHODS
53              
54             =over 4
55              
56             =item get_basic_credentials
57              
58             Returns basic authentication credentials
59              
60             =item basic_auth_cb
61              
62             Gets/sets basic authentication callback
63              
64             =back
65              
66             =head1 AUTHOR
67              
68             Dean Hamstead <dean@fragfest.com.au>
69              
70             =head1 COPYRIGHT AND LICENSE
71              
72             This software is copyright (c) 2022, 2020 by Dmitri Tikhonov.
73              
74             This is free software; you can redistribute it and/or modify it under
75             the same terms as the Perl 5 programming language system itself.
76              
77             =cut