| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WebService::Recruit::CarSensor; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
51086
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
85
|
|
|
4
|
2
|
|
|
2
|
|
11
|
use base qw( Class::Accessor::Fast ); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
1945
|
|
|
5
|
2
|
|
|
2
|
|
7622
|
use vars qw( $VERSION ); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
112
|
|
|
6
|
|
|
|
|
|
|
$VERSION = '0.0.2'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
1302
|
use WebService::Recruit::CarSensor::Usedcar; |
|
|
2
|
|
|
|
|
8
|
|
|
|
2
|
|
|
|
|
31
|
|
|
9
|
2
|
|
|
2
|
|
2119
|
use WebService::Recruit::CarSensor::Catalog; |
|
|
2
|
|
|
|
|
8
|
|
|
|
2
|
|
|
|
|
36
|
|
|
10
|
2
|
|
|
2
|
|
1562
|
use WebService::Recruit::CarSensor::Brand; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
21
|
|
|
11
|
2
|
|
|
2
|
|
1553
|
use WebService::Recruit::CarSensor::Country; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
23
|
|
|
12
|
2
|
|
|
2
|
|
1598
|
use WebService::Recruit::CarSensor::LargeArea; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
22
|
|
|
13
|
2
|
|
|
2
|
|
1528
|
use WebService::Recruit::CarSensor::Pref; |
|
|
2
|
|
|
|
|
7
|
|
|
|
2
|
|
|
|
|
20
|
|
|
14
|
2
|
|
|
2
|
|
1293
|
use WebService::Recruit::CarSensor::Body; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
21
|
|
|
15
|
2
|
|
|
2
|
|
1344
|
use WebService::Recruit::CarSensor::Color; |
|
|
2
|
|
|
|
|
8
|
|
|
|
2
|
|
|
|
|
22
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $TPPCFG = [qw( user_agent lwp_useragent http_lite utf8_flag )]; |
|
19
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors( @$TPPCFG, 'param' ); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
|
22
|
2
|
|
|
2
|
1
|
29
|
my $package = shift; |
|
23
|
2
|
|
|
|
|
7
|
my $self = {@_}; |
|
24
|
2
|
|
33
|
|
|
24
|
$self->{user_agent} ||= __PACKAGE__."/$VERSION "; |
|
25
|
2
|
|
|
|
|
6
|
bless $self, $package; |
|
26
|
2
|
|
|
|
|
8
|
$self; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub add_param { |
|
30
|
2
|
|
|
2
|
1
|
631
|
my $self = shift; |
|
31
|
2
|
|
100
|
|
|
9
|
my $param = $self->param() || {}; |
|
32
|
2
|
50
|
|
|
|
33
|
%$param = ( %$param, @_ ) if scalar @_; |
|
33
|
2
|
|
|
|
|
7
|
$self->param($param); |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub get_param { |
|
37
|
3
|
|
|
3
|
1
|
11
|
my $self = shift; |
|
38
|
3
|
|
|
|
|
4
|
my $key = shift; |
|
39
|
3
|
50
|
|
|
|
8
|
my $param = $self->param() or return; |
|
40
|
3
|
50
|
|
|
|
36
|
$param->{$key} if exists $param->{$key}; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub init_treepp_config { |
|
44
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
45
|
0
|
|
|
|
|
|
my $api = shift; |
|
46
|
0
|
|
|
|
|
|
my $treepp = $api->treepp(); |
|
47
|
0
|
|
|
|
|
|
foreach my $key ( @$TPPCFG ) { |
|
48
|
0
|
0
|
|
|
|
|
next unless exists $self->{$key}; |
|
49
|
0
|
0
|
|
|
|
|
next unless defined $self->{$key}; |
|
50
|
0
|
|
|
|
|
|
$treepp->set( $key => $self->{$key} ); |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub init_query_param { |
|
55
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
56
|
0
|
|
|
|
|
|
my $api = shift; |
|
57
|
0
|
|
|
|
|
|
my $param = $self->param(); |
|
58
|
0
|
|
|
|
|
|
foreach my $key ( keys %$param ) { |
|
59
|
0
|
0
|
|
|
|
|
next unless defined $param->{$key}; |
|
60
|
0
|
|
|
|
|
|
$api->add_param( $key => $param->{$key} ); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub usedcar { |
|
65
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
|
66
|
0
|
0
|
|
|
|
|
$self = $self->new() unless ref $self; |
|
67
|
0
|
|
|
|
|
|
my $api = WebService::Recruit::CarSensor::Usedcar->new(); |
|
68
|
0
|
|
|
|
|
|
$self->init_treepp_config( $api ); |
|
69
|
0
|
|
|
|
|
|
$self->init_query_param( $api ); |
|
70
|
0
|
|
|
|
|
|
$api->add_param( @_ ); |
|
71
|
0
|
|
|
|
|
|
$api->request(); |
|
72
|
0
|
|
|
|
|
|
$api; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub catalog { |
|
76
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
|
77
|
0
|
0
|
|
|
|
|
$self = $self->new() unless ref $self; |
|
78
|
0
|
|
|
|
|
|
my $api = WebService::Recruit::CarSensor::Catalog->new(); |
|
79
|
0
|
|
|
|
|
|
$self->init_treepp_config( $api ); |
|
80
|
0
|
|
|
|
|
|
$self->init_query_param( $api ); |
|
81
|
0
|
|
|
|
|
|
$api->add_param( @_ ); |
|
82
|
0
|
|
|
|
|
|
$api->request(); |
|
83
|
0
|
|
|
|
|
|
$api; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub brand { |
|
87
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
|
88
|
0
|
0
|
|
|
|
|
$self = $self->new() unless ref $self; |
|
89
|
0
|
|
|
|
|
|
my $api = WebService::Recruit::CarSensor::Brand->new(); |
|
90
|
0
|
|
|
|
|
|
$self->init_treepp_config( $api ); |
|
91
|
0
|
|
|
|
|
|
$self->init_query_param( $api ); |
|
92
|
0
|
|
|
|
|
|
$api->add_param( @_ ); |
|
93
|
0
|
|
|
|
|
|
$api->request(); |
|
94
|
0
|
|
|
|
|
|
$api; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub country { |
|
98
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
|
99
|
0
|
0
|
|
|
|
|
$self = $self->new() unless ref $self; |
|
100
|
0
|
|
|
|
|
|
my $api = WebService::Recruit::CarSensor::Country->new(); |
|
101
|
0
|
|
|
|
|
|
$self->init_treepp_config( $api ); |
|
102
|
0
|
|
|
|
|
|
$self->init_query_param( $api ); |
|
103
|
0
|
|
|
|
|
|
$api->add_param( @_ ); |
|
104
|
0
|
|
|
|
|
|
$api->request(); |
|
105
|
0
|
|
|
|
|
|
$api; |
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub large_area { |
|
109
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
|
110
|
0
|
0
|
|
|
|
|
$self = $self->new() unless ref $self; |
|
111
|
0
|
|
|
|
|
|
my $api = WebService::Recruit::CarSensor::LargeArea->new(); |
|
112
|
0
|
|
|
|
|
|
$self->init_treepp_config( $api ); |
|
113
|
0
|
|
|
|
|
|
$self->init_query_param( $api ); |
|
114
|
0
|
|
|
|
|
|
$api->add_param( @_ ); |
|
115
|
0
|
|
|
|
|
|
$api->request(); |
|
116
|
0
|
|
|
|
|
|
$api; |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub pref { |
|
120
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
|
121
|
0
|
0
|
|
|
|
|
$self = $self->new() unless ref $self; |
|
122
|
0
|
|
|
|
|
|
my $api = WebService::Recruit::CarSensor::Pref->new(); |
|
123
|
0
|
|
|
|
|
|
$self->init_treepp_config( $api ); |
|
124
|
0
|
|
|
|
|
|
$self->init_query_param( $api ); |
|
125
|
0
|
|
|
|
|
|
$api->add_param( @_ ); |
|
126
|
0
|
|
|
|
|
|
$api->request(); |
|
127
|
0
|
|
|
|
|
|
$api; |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub body { |
|
131
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
|
132
|
0
|
0
|
|
|
|
|
$self = $self->new() unless ref $self; |
|
133
|
0
|
|
|
|
|
|
my $api = WebService::Recruit::CarSensor::Body->new(); |
|
134
|
0
|
|
|
|
|
|
$self->init_treepp_config( $api ); |
|
135
|
0
|
|
|
|
|
|
$self->init_query_param( $api ); |
|
136
|
0
|
|
|
|
|
|
$api->add_param( @_ ); |
|
137
|
0
|
|
|
|
|
|
$api->request(); |
|
138
|
0
|
|
|
|
|
|
$api; |
|
139
|
|
|
|
|
|
|
} |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
sub color { |
|
142
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
|
143
|
0
|
0
|
|
|
|
|
$self = $self->new() unless ref $self; |
|
144
|
0
|
|
|
|
|
|
my $api = WebService::Recruit::CarSensor::Color->new(); |
|
145
|
0
|
|
|
|
|
|
$self->init_treepp_config( $api ); |
|
146
|
0
|
|
|
|
|
|
$self->init_query_param( $api ); |
|
147
|
0
|
|
|
|
|
|
$api->add_param( @_ ); |
|
148
|
0
|
|
|
|
|
|
$api->request(); |
|
149
|
0
|
|
|
|
|
|
$api; |
|
150
|
|
|
|
|
|
|
} |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 NAME |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
WebService::Recruit::CarSensor - An Interface for CarSensor.net Web Service |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
use WebService::Recruit::CarSensor; |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
my $service = WebService::Recruit::CarSensor->new(); |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
my $param = { |
|
164
|
|
|
|
|
|
|
'key' => $ENV{'WEBSERVICE_RECRUIT_KEY'}, |
|
165
|
|
|
|
|
|
|
'pref' => '13', |
|
166
|
|
|
|
|
|
|
}; |
|
167
|
|
|
|
|
|
|
my $res = $service->usedcar( %$param ); |
|
168
|
|
|
|
|
|
|
my $root = $res->root; |
|
169
|
|
|
|
|
|
|
printf("api_version: %s\n", $root->api_version); |
|
170
|
|
|
|
|
|
|
printf("results_available: %s\n", $root->results_available); |
|
171
|
|
|
|
|
|
|
printf("results_returned: %s\n", $root->results_returned); |
|
172
|
|
|
|
|
|
|
printf("results_start: %s\n", $root->results_start); |
|
173
|
|
|
|
|
|
|
printf("usedcar: %s\n", $root->usedcar); |
|
174
|
|
|
|
|
|
|
print "...\n"; |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
カーセンサーnetに掲載されている中古車情報及び新車カタログ情報を様々な軸で検索できるAPIです。 |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head1 METHODS |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head2 new |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
This is the constructor method for this class. |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
my $service = WebService::Recruit::CarSensor->new(); |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
This accepts optional parameters. |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
my $conf = { |
|
191
|
|
|
|
|
|
|
utf8_flag => 1, |
|
192
|
|
|
|
|
|
|
param => { |
|
193
|
|
|
|
|
|
|
# common parameters of this web service |
|
194
|
|
|
|
|
|
|
}, |
|
195
|
|
|
|
|
|
|
}; |
|
196
|
|
|
|
|
|
|
my $service = WebService::Recruit::CarSensor->new( %$conf ); |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head2 add_param |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
Add common parameter of tihs web service. |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
$service->add_param( param_key => param_value ); |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
You can add multiple parameters by calling once. |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
$service->add_param( param_key1 => param_value1, |
|
207
|
|
|
|
|
|
|
param_key2 => param_value2, |
|
208
|
|
|
|
|
|
|
...); |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=head2 get_param |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
Returns common parameter value of the specified key. |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
my $param_value = $service->get( 'param_key' ); |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=head2 usedcar |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
This makes a request for C API. |
|
219
|
|
|
|
|
|
|
See L for details. |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
my $res = $service->usedcar( %$param ); |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=head2 catalog |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
This makes a request for C API. |
|
226
|
|
|
|
|
|
|
See L for details. |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
my $res = $service->catalog( %$param ); |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=head2 brand |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
This makes a request for C API. |
|
233
|
|
|
|
|
|
|
See L for details. |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
my $res = $service->brand( %$param ); |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=head2 country |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
This makes a request for C API. |
|
240
|
|
|
|
|
|
|
See L for details. |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
my $res = $service->country( %$param ); |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=head2 large_area |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
This makes a request for C API. |
|
247
|
|
|
|
|
|
|
See L for details. |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
my $res = $service->large_area( %$param ); |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=head2 pref |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
This makes a request for C API. |
|
254
|
|
|
|
|
|
|
See L for details. |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
my $res = $service->pref( %$param ); |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=head2 body |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
This makes a request for C API. |
|
261
|
|
|
|
|
|
|
See L for details. |
|
262
|
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
my $res = $service->body( %$param ); |
|
264
|
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=head2 color |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
This makes a request for C API. |
|
268
|
|
|
|
|
|
|
See L for details. |
|
269
|
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
my $res = $service->color( %$param ); |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
=head2 utf8_flag / user_agent / lwp_useragent / http_lite |
|
273
|
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
This modules uses L module internally. |
|
275
|
|
|
|
|
|
|
Following methods are available to configure it. |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
$service->utf8_flag( 1 ); |
|
278
|
|
|
|
|
|
|
$service->user_agent( 'Foo-Bar/1.0 ' ); |
|
279
|
|
|
|
|
|
|
$service->lwp_useragent( LWP::UserAgent->new() ); |
|
280
|
|
|
|
|
|
|
$service->http_lite( HTTP::Lite->new() ); |
|
281
|
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
283
|
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
http://webservice.recruit.co.jp/carsensor/ |
|
285
|
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=head1 AUTHOR |
|
287
|
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
RECRUIT Media Technology Labs |
|
289
|
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
291
|
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
Copyright 2008 RECRUIT Media Technology Labs |
|
293
|
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
=cut |
|
295
|
|
|
|
|
|
|
1; |