| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::OpenSocial::Client::Request; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
578
|
use Any::Moose; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
has 'id' => ( |
|
6
|
|
|
|
|
|
|
is => 'rw', |
|
7
|
|
|
|
|
|
|
isa => 'Str', |
|
8
|
|
|
|
|
|
|
); |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has 'service' => ( |
|
11
|
|
|
|
|
|
|
is => 'rw', |
|
12
|
|
|
|
|
|
|
isa => 'Str', |
|
13
|
|
|
|
|
|
|
required => 1, |
|
14
|
|
|
|
|
|
|
); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has 'operation' => ( |
|
17
|
|
|
|
|
|
|
is => 'rw', |
|
18
|
|
|
|
|
|
|
isa => 'Str', |
|
19
|
|
|
|
|
|
|
required => 1, |
|
20
|
|
|
|
|
|
|
); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has 'user_id' => ( |
|
23
|
|
|
|
|
|
|
is => 'rw', |
|
24
|
|
|
|
|
|
|
isa => 'Str', |
|
25
|
|
|
|
|
|
|
default => '@me', |
|
26
|
|
|
|
|
|
|
required => 1, |
|
27
|
|
|
|
|
|
|
); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has 'group_id' => ( |
|
30
|
|
|
|
|
|
|
is => 'rw', |
|
31
|
|
|
|
|
|
|
isa => 'Str', |
|
32
|
|
|
|
|
|
|
default => '@self', |
|
33
|
|
|
|
|
|
|
required => 1, |
|
34
|
|
|
|
|
|
|
); |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has 'params' => ( |
|
37
|
|
|
|
|
|
|
is => 'rw', |
|
38
|
|
|
|
|
|
|
isa => 'HashRef', |
|
39
|
|
|
|
|
|
|
default => sub { +{} }, |
|
40
|
|
|
|
|
|
|
); |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has 'resource' => ( |
|
43
|
|
|
|
|
|
|
is => 'rw', |
|
44
|
|
|
|
|
|
|
isa => 'Net::OpenSocial::Client::Resource', |
|
45
|
|
|
|
|
|
|
predicate => 'has_resource', |
|
46
|
|
|
|
|
|
|
); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my %OP_METHOD_MAP = ( |
|
49
|
|
|
|
|
|
|
get => 'GET', |
|
50
|
|
|
|
|
|
|
create => 'POST', |
|
51
|
|
|
|
|
|
|
update => 'PUT', |
|
52
|
|
|
|
|
|
|
delete => 'DELETE', |
|
53
|
|
|
|
|
|
|
); |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub rpc_service { |
|
56
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
57
|
0
|
|
|
|
|
|
my $service = $self->service; |
|
58
|
0
|
0
|
|
|
|
|
$service = 'activity' if $service eq 'activities'; |
|
59
|
0
|
|
|
|
|
|
return $service; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub http_method_for_operation { |
|
63
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
64
|
0
|
|
|
|
|
|
return $OP_METHOD_MAP{ $self->operation }; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
1
|
|
|
1
|
|
666
|
no Any::Moose; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
4
|
|
|
68
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
69
|
|
|
|
|
|
|
1; |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 NAME |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Net::OpenSocial::Client::Request - Request class. |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
use Net::OpenSocial::Client::Type::Service qw(PEOPLE, ACTIVITY); |
|
78
|
|
|
|
|
|
|
use Net::OpenSocial::Client::Type::Operation qw(GET CREATE UPDATE DELETE); |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
my $req = Net::OpenSocial::Client::Request->new( |
|
81
|
|
|
|
|
|
|
service => PEOPL, |
|
82
|
|
|
|
|
|
|
operation => GET, |
|
83
|
|
|
|
|
|
|
user_id => '@me', |
|
84
|
|
|
|
|
|
|
group_id => '@friends', |
|
85
|
|
|
|
|
|
|
params => { |
|
86
|
|
|
|
|
|
|
itemsPerPage => 10, |
|
87
|
|
|
|
|
|
|
startIndex => 11, |
|
88
|
|
|
|
|
|
|
}, |
|
89
|
|
|
|
|
|
|
); |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
This module represents a OpenSocial REST/RPC request. |
|
94
|
|
|
|
|
|
|
For short circuit, there are many request subclasses like |
|
95
|
|
|
|
|
|
|
L, |
|
96
|
|
|
|
|
|
|
L and so on. |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 METHODS |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 id |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Request id |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 service |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Service type. |
|
107
|
|
|
|
|
|
|
See L |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head2 operation |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Operation type. |
|
112
|
|
|
|
|
|
|
See L |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 user_id |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Service(container) specific user-id or selector like '@me' |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 group_id |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Service(container) specific group-id or selector like '@self' or '@friends' |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 params |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Other parameters |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head2 resource |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
L object, |
|
129
|
|
|
|
|
|
|
This parameter is required when the operation is 'CREATE' or 'UPDATE' |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head2 rpc_service |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
RPC service name |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head2 http_method_for_operation |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
HTTP method name for current operation. |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 AUTHOR |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Lyo Kato, Elyo.kato@gmail.comE |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Copyright (C) 2009 by Lyo Kato |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
148
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.8 or, |
|
149
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=cut |
|
152
|
|
|
|
|
|
|
|