line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Google::Analytics::Request; |
2
|
|
|
|
|
|
|
$Net::Google::Analytics::Request::VERSION = '3.04'; |
3
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
59
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
119
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Google Analytics API request |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Class::XSAccessor |
9
|
2
|
|
|
|
|
22
|
accessors => [ qw( |
10
|
|
|
|
|
|
|
realtime |
11
|
|
|
|
|
|
|
ids |
12
|
|
|
|
|
|
|
start_date end_date |
13
|
|
|
|
|
|
|
metrics dimensions |
14
|
|
|
|
|
|
|
sort |
15
|
|
|
|
|
|
|
filters |
16
|
|
|
|
|
|
|
segment |
17
|
|
|
|
|
|
|
start_index max_results |
18
|
|
|
|
|
|
|
fields |
19
|
|
|
|
|
|
|
sampling_level |
20
|
|
|
|
|
|
|
pretty_print |
21
|
|
|
|
|
|
|
user_ip quota_user |
22
|
|
|
|
|
|
|
) ], |
23
|
2
|
|
|
2
|
|
1482
|
constructor => 'new'; |
|
2
|
|
|
|
|
6444
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my @param_map = ( |
26
|
|
|
|
|
|
|
ids => 'ids', |
27
|
|
|
|
|
|
|
start_date => 'start-date', |
28
|
|
|
|
|
|
|
end_date => 'end-date', |
29
|
|
|
|
|
|
|
metrics => 'metrics', |
30
|
|
|
|
|
|
|
dimensions => 'dimensions', |
31
|
|
|
|
|
|
|
sort => 'sort', |
32
|
|
|
|
|
|
|
filters => 'filters', |
33
|
|
|
|
|
|
|
segment => 'segment', |
34
|
|
|
|
|
|
|
fields => 'fields', |
35
|
|
|
|
|
|
|
sampling_level => 'samplingLevel', |
36
|
|
|
|
|
|
|
pretty_print => 'prettyPrint', |
37
|
|
|
|
|
|
|
user_ip => 'userIp', |
38
|
|
|
|
|
|
|
quota_user => 'quotaUser', |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _params { |
42
|
2
|
|
|
2
|
|
6
|
my $self = shift; |
43
|
|
|
|
|
|
|
|
44
|
2
|
|
|
|
|
8
|
my @required = qw(ids metrics); |
45
|
|
|
|
|
|
|
|
46
|
2
|
100
|
|
|
|
23
|
if (!$self->{realtime}) { |
47
|
1
|
|
|
|
|
4
|
push(@required, qw(start_date end_date)); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
2
|
|
|
|
|
8
|
for my $name (@required) { |
51
|
6
|
|
|
|
|
17
|
my $value = $self->{$name}; |
52
|
6
|
50
|
33
|
|
|
52
|
die("parameter $name is empty") |
53
|
|
|
|
|
|
|
if !defined($value) || $value eq ''; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
2
|
|
|
|
|
8
|
my @params; |
57
|
|
|
|
|
|
|
|
58
|
2
|
|
|
|
|
13
|
for (my $i=0; $i<@param_map; $i+=2) { |
59
|
26
|
|
|
|
|
46
|
my $from = $param_map[$i]; |
60
|
26
|
|
|
|
|
46
|
my $to = $param_map[$i+1]; |
61
|
|
|
|
|
|
|
|
62
|
26
|
|
|
|
|
42
|
my $value = $self->{$from}; |
63
|
26
|
100
|
|
|
|
108
|
push(@params, $to => $value) if defined($value); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
2
|
|
|
|
|
28
|
return @params; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__END__ |