SelectPdf/WebElementsClient.pm

filter: Statementstmt 48.0% 12 / 25 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 3 / 5 Podpod 100% 2 / 2 totaltotal 50.0% 17 / 34 CC 2 SCAR 10.4
CC
2
Cov
44%
getWebElements
6.0
new
2.0
BEGIN
1.0
CRAP 2.8
« SelectPdf/UsageClient.pm ↑ Summary SelectPdf.pm »
1 package SelectPdf::WebElementsClient;
2
3 1 ▶use JSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use SelectPdf::ApiClient;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 our @ISA = qw(SelectPdf::ApiClient);
7
8 1 our $VERSION = '1.6.0';
9
10 =head1 NAME
11
12 SelectPdf::WebElementsClient - Get the locations of certain web elements.
13 This is retrieved if pdf_web_elements_selectors parameter was set during the initial conversion call and elements were found to match the selectors.
14
15 =head1 METHODS
16
17 =head2 new( $apiKey, $jobId )
18
19 Construct the web elements client.
20
21 my $client = SelectPdf::WebElementsClient->new($apiKey, $jobId);
22
23 Parameters:
24
25 - $apiKey API Key.
26 - $jobId Job ID.
27 =cut
28 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
29 0 my $type = shift;
30 0 my $self = $type->SUPER::new;
31
32 # API endpoint
33 0 $self->{apiEndpoint} = "https://selectpdf.com/api2/webelements/";
34
35 0 $self->{parameters}{"key"} = shift;
36 0 $self->{parameters}{"job_id"} = shift;
37
38 0 bless $self, $type;
39 0 return $self;
40 }
41
42 =head2 getWebElements
43
44 Get the locations of certain web elements. This is retrieved if pdf_web_elements_selectors parameter is set and elements were found to match the selectors.
45
46 my $client = SelectPdf::WebElementsClient->new($apiKey, $jobId);
47 $elements = $client->getWebElements();
48
49 Returns:
50
51 - List of web elements locations.
52 =cut
53 0 ▶sub getWebElements {
Subroutine getWebElements: not called CC=2 SCAR=17.9
Pod documented
54 0 my($self) = @_;
55
56 0 $self->{headers}{"Accept"} = "text/json";
57
58 0 my $result = $self->SUPER::performPost();
59
60 0 ▶ if ($result) {
Branch: 1 branch
BranchTrueFalseTotal
if ($result) { } 0 0 0
61 0 return decode_json($result);
62 }
63 else {
64 0 return [];
65 }
66 }
67
68 1 1;
« SelectPdf/UsageClient.pm ↑ Summary SelectPdf.pm »