line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SelectPdf::WebElementsClient;
|
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
744
|
use JSON;
|
|
1
|
|
|
|
|
10690
|
|
|
1
|
|
|
|
|
6
|
|
4
|
1
|
|
|
1
|
|
141
|
use SelectPdf::ApiClient;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
19
|
|
5
|
1
|
|
|
1
|
|
6
|
use strict;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
175
|
|
6
|
|
|
|
|
|
|
our @ISA = qw(SelectPdf::ApiClient);
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
SelectPdf::WebElementsClient - Get the locations of certain web elements.
|
11
|
|
|
|
|
|
|
This is retrieved if pdf_web_elements_selectors parameter was set during the initial conversion call and elements were found to match the selectors.
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 METHODS
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head2 new( $apiKey, $jobId )
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Construct the web elements client.
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $client = SelectPdf::WebElementsClient->new($apiKey, $jobId);
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Parameters:
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
- $apiKey API Key.
|
24
|
|
|
|
|
|
|
- $jobId Job ID.
|
25
|
|
|
|
|
|
|
=cut
|
26
|
|
|
|
|
|
|
sub new {
|
27
|
0
|
|
|
0
|
1
|
|
my $type = shift;
|
28
|
0
|
|
|
|
|
|
my $self = $type->SUPER::new;
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# API endpoint
|
31
|
0
|
|
|
|
|
|
$self->{apiEndpoint} = "https://selectpdf.com/api2/webelements/";
|
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
$self->{parameters}{"key"} = shift;
|
34
|
0
|
|
|
|
|
|
$self->{parameters}{"job_id"} = shift;
|
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
bless $self, $type;
|
37
|
0
|
|
|
|
|
|
return $self;
|
38
|
|
|
|
|
|
|
}
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 getWebElements
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
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.
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $client = SelectPdf::WebElementsClient->new($apiKey, $jobId);
|
45
|
|
|
|
|
|
|
$elements = $client->getWebElements();
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Returns:
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
- List of web elements locations.
|
50
|
|
|
|
|
|
|
=cut
|
51
|
|
|
|
|
|
|
sub getWebElements {
|
52
|
0
|
|
|
0
|
1
|
|
my($self) = @_;
|
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
$self->{headers}{"Accept"} = "text/json";
|
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
my $result = $self->SUPER::performPost();
|
57
|
|
|
|
|
|
|
|
58
|
0
|
0
|
|
|
|
|
if ($result) {
|
59
|
0
|
|
|
|
|
|
return decode_json($result);
|
60
|
|
|
|
|
|
|
}
|
61
|
|
|
|
|
|
|
else {
|
62
|
0
|
|
|
|
|
|
return [];
|
63
|
|
|
|
|
|
|
}
|
64
|
|
|
|
|
|
|
}
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |