line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Google::Analytics::Request; |
2
|
|
|
|
|
|
|
$Net::Google::Analytics::Request::VERSION = '3.05'; |
3
|
2
|
|
|
2
|
|
8
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
48
|
|
4
|
2
|
|
|
2
|
|
6
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
83
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Google Analytics API request |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Class::XSAccessor |
9
|
2
|
|
|
|
|
14
|
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
|
|
1014
|
constructor => 'new'; |
|
2
|
|
|
|
|
3968
|
|
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
|
3
|
|
|
3
|
|
5
|
my $self = shift; |
43
|
|
|
|
|
|
|
|
44
|
3
|
|
|
|
|
9
|
my @required = qw(ids metrics); |
45
|
|
|
|
|
|
|
|
46
|
3
|
100
|
|
|
|
23
|
if (!$self->{realtime}) { |
47
|
2
|
|
|
|
|
4
|
push(@required, qw(start_date end_date)); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
3
|
|
|
|
|
8
|
for my $name (@required) { |
51
|
10
|
|
|
|
|
14
|
my $value = $self->{$name}; |
52
|
10
|
50
|
33
|
|
|
49
|
die("parameter $name is empty") |
53
|
|
|
|
|
|
|
if !defined($value) || $value eq ''; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
3
|
|
|
|
|
7
|
my @params; |
57
|
|
|
|
|
|
|
|
58
|
3
|
|
|
|
|
13
|
for (my $i=0; $i<@param_map; $i+=2) { |
59
|
39
|
|
|
|
|
34
|
my $from = $param_map[$i]; |
60
|
39
|
|
|
|
|
37
|
my $to = $param_map[$i+1]; |
61
|
|
|
|
|
|
|
|
62
|
39
|
|
|
|
|
39
|
my $value = $self->{$from}; |
63
|
39
|
100
|
|
|
|
102
|
push(@params, $to => $value) if defined($value); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
3
|
|
|
|
|
28
|
return @params; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__END__ |