line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
######### |
2
|
|
|
|
|
|
|
# Author: rmp |
3
|
|
|
|
|
|
|
# Maintainer: $Author: rmp $ |
4
|
|
|
|
|
|
|
# Created: 2008-08-13 |
5
|
|
|
|
|
|
|
# Last Modified: $Date$ |
6
|
|
|
|
|
|
|
# Id: $Id$ |
7
|
|
|
|
|
|
|
# $HeadURL$ |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
package Net::Plazes::Activity; |
10
|
1
|
|
|
1
|
|
792
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
11
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
12
|
1
|
|
|
1
|
|
5
|
use base qw(Net::Plazes::Base); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
598
|
|
13
|
|
|
|
|
|
|
use Net::Plazes::User; |
14
|
|
|
|
|
|
|
use Net::Plazes::Plaze; |
15
|
|
|
|
|
|
|
use Carp; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(fields()); |
20
|
|
|
|
|
|
|
__PACKAGE__->has_many(); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub service { |
23
|
|
|
|
|
|
|
return q[http://plazes.com/activities]; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub fields { |
27
|
|
|
|
|
|
|
return qw(id created_at device plaze_id scheduled_at status user_id); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub process_dom { |
31
|
|
|
|
|
|
|
my ($self, $obj, $dom) = @_; |
32
|
|
|
|
|
|
|
$self->SUPER::process_dom($obj, $dom); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $plz_els = $dom->getElementsByTagName('plaze'); |
35
|
|
|
|
|
|
|
if($plz_els) { |
36
|
|
|
|
|
|
|
my $el = $plz_els->[0]; |
37
|
|
|
|
|
|
|
if($el) { |
38
|
|
|
|
|
|
|
my $plaze = Net::Plazes::Plaze->new({ |
39
|
|
|
|
|
|
|
usergent => $self->useragent(), |
40
|
|
|
|
|
|
|
}); |
41
|
|
|
|
|
|
|
$obj->{plaze} = $plaze->process_dom($plaze, $el); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my $usr_els = $dom->getElementsByTagName('user'); |
46
|
|
|
|
|
|
|
if($usr_els) { |
47
|
|
|
|
|
|
|
my $el = $usr_els->[0]; |
48
|
|
|
|
|
|
|
if($el) { |
49
|
|
|
|
|
|
|
my $user = Net::Plazes::User->new({ |
50
|
|
|
|
|
|
|
usergent => $self->useragent(), |
51
|
|
|
|
|
|
|
}); |
52
|
|
|
|
|
|
|
$obj->{user} = $user->process_dom($user, $el); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
return $obj; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub user { |
60
|
|
|
|
|
|
|
my $self = shift; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
if(!$self->{user}) { |
63
|
|
|
|
|
|
|
$self->read(); |
64
|
|
|
|
|
|
|
$self->{user} ||= Net::Plazes::User->new({ |
65
|
|
|
|
|
|
|
useragent => $self->useragent(), |
66
|
|
|
|
|
|
|
id => $self->user_id(), |
67
|
|
|
|
|
|
|
}); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
return $self->{user}; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub plaze { |
74
|
|
|
|
|
|
|
my $self = shift; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
if(!$self->{plaze}) { |
77
|
|
|
|
|
|
|
$self->read(); |
78
|
|
|
|
|
|
|
$self->{plaze} ||= Net::Plazes::Plaze->new({ |
79
|
|
|
|
|
|
|
useragent => $self->useragent(), |
80
|
|
|
|
|
|
|
id => $self->plaze_id(), |
81
|
|
|
|
|
|
|
}); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
return $self->{plaze}; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |
89
|
|
|
|
|
|
|
__END__ |