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