line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::Recruit::AbRoad; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
56505
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
87
|
|
4
|
2
|
|
|
2
|
|
10
|
use base qw( Class::Accessor::Fast ); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
7953
|
|
5
|
2
|
|
|
2
|
|
8443
|
use vars qw( $VERSION ); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
136
|
|
6
|
|
|
|
|
|
|
$VERSION = '0.0.1'; |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
1501
|
use WebService::Recruit::AbRoad::Tour; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
29
|
|
9
|
2
|
|
|
2
|
|
1904
|
use WebService::Recruit::AbRoad::Area; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
19
|
|
10
|
2
|
|
|
2
|
|
1440
|
use WebService::Recruit::AbRoad::Country; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
19
|
|
11
|
2
|
|
|
2
|
|
1370
|
use WebService::Recruit::AbRoad::City; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
1647
|
|
12
|
2
|
|
|
2
|
|
1246
|
use WebService::Recruit::AbRoad::Hotel; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
18
|
|
13
|
2
|
|
|
2
|
|
1287
|
use WebService::Recruit::AbRoad::Airline; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
19
|
|
14
|
2
|
|
|
2
|
|
1540
|
use WebService::Recruit::AbRoad::Kodawari; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
87
|
|
15
|
2
|
|
|
2
|
|
1320
|
use WebService::Recruit::AbRoad::Spot; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
20
|
|
16
|
2
|
|
|
2
|
|
1453
|
use WebService::Recruit::AbRoad::TourTally; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
21
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $TPPCFG = [qw( user_agent lwp_useragent http_lite utf8_flag )]; |
20
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors( @$TPPCFG, 'param' ); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub new { |
23
|
2
|
|
|
2
|
1
|
27
|
my $package = shift; |
24
|
2
|
|
|
|
|
8
|
my $self = {@_}; |
25
|
2
|
|
33
|
|
|
23
|
$self->{user_agent} ||= __PACKAGE__."/$VERSION "; |
26
|
2
|
|
|
|
|
6
|
bless $self, $package; |
27
|
2
|
|
|
|
|
7
|
$self; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub add_param { |
31
|
2
|
|
|
2
|
1
|
418
|
my $self = shift; |
32
|
2
|
|
100
|
|
|
9
|
my $param = $self->param() || {}; |
33
|
2
|
50
|
|
|
|
40
|
%$param = ( %$param, @_ ) if scalar @_; |
34
|
2
|
|
|
|
|
10
|
$self->param($param); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub get_param { |
38
|
3
|
|
|
3
|
1
|
13
|
my $self = shift; |
39
|
3
|
|
|
|
|
10
|
my $key = shift; |
40
|
3
|
50
|
|
|
|
12
|
my $param = $self->param() or return; |
41
|
3
|
50
|
|
|
|
41
|
$param->{$key} if exists $param->{$key}; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub init_treepp_config { |
45
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
46
|
0
|
|
|
|
|
|
my $api = shift; |
47
|
0
|
|
|
|
|
|
my $treepp = $api->treepp(); |
48
|
0
|
|
|
|
|
|
foreach my $key ( @$TPPCFG ) { |
49
|
0
|
0
|
|
|
|
|
next unless exists $self->{$key}; |
50
|
0
|
0
|
|
|
|
|
next unless defined $self->{$key}; |
51
|
0
|
|
|
|
|
|
$treepp->set( $key => $self->{$key} ); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub init_query_param { |
56
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
57
|
0
|
|
|
|
|
|
my $api = shift; |
58
|
0
|
|
|
|
|
|
my $param = $self->param(); |
59
|
0
|
|
|
|
|
|
foreach my $key ( keys %$param ) { |
60
|
0
|
0
|
|
|
|
|
next unless defined $param->{$key}; |
61
|
0
|
|
|
|
|
|
$api->add_param( $key => $param->{$key} ); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub tour { |
66
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
67
|
0
|
0
|
|
|
|
|
$self = $self->new() unless ref $self; |
68
|
0
|
|
|
|
|
|
my $api = WebService::Recruit::AbRoad::Tour->new(); |
69
|
0
|
|
|
|
|
|
$self->init_treepp_config( $api ); |
70
|
0
|
|
|
|
|
|
$self->init_query_param( $api ); |
71
|
0
|
|
|
|
|
|
$api->add_param( @_ ); |
72
|
0
|
|
|
|
|
|
$api->request(); |
73
|
0
|
|
|
|
|
|
$api; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub area { |
77
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
78
|
0
|
0
|
|
|
|
|
$self = $self->new() unless ref $self; |
79
|
0
|
|
|
|
|
|
my $api = WebService::Recruit::AbRoad::Area->new(); |
80
|
0
|
|
|
|
|
|
$self->init_treepp_config( $api ); |
81
|
0
|
|
|
|
|
|
$self->init_query_param( $api ); |
82
|
0
|
|
|
|
|
|
$api->add_param( @_ ); |
83
|
0
|
|
|
|
|
|
$api->request(); |
84
|
0
|
|
|
|
|
|
$api; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub country { |
88
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
89
|
0
|
0
|
|
|
|
|
$self = $self->new() unless ref $self; |
90
|
0
|
|
|
|
|
|
my $api = WebService::Recruit::AbRoad::Country->new(); |
91
|
0
|
|
|
|
|
|
$self->init_treepp_config( $api ); |
92
|
0
|
|
|
|
|
|
$self->init_query_param( $api ); |
93
|
0
|
|
|
|
|
|
$api->add_param( @_ ); |
94
|
0
|
|
|
|
|
|
$api->request(); |
95
|
0
|
|
|
|
|
|
$api; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub city { |
99
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
100
|
0
|
0
|
|
|
|
|
$self = $self->new() unless ref $self; |
101
|
0
|
|
|
|
|
|
my $api = WebService::Recruit::AbRoad::City->new(); |
102
|
0
|
|
|
|
|
|
$self->init_treepp_config( $api ); |
103
|
0
|
|
|
|
|
|
$self->init_query_param( $api ); |
104
|
0
|
|
|
|
|
|
$api->add_param( @_ ); |
105
|
0
|
|
|
|
|
|
$api->request(); |
106
|
0
|
|
|
|
|
|
$api; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub hotel { |
110
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
111
|
0
|
0
|
|
|
|
|
$self = $self->new() unless ref $self; |
112
|
0
|
|
|
|
|
|
my $api = WebService::Recruit::AbRoad::Hotel->new(); |
113
|
0
|
|
|
|
|
|
$self->init_treepp_config( $api ); |
114
|
0
|
|
|
|
|
|
$self->init_query_param( $api ); |
115
|
0
|
|
|
|
|
|
$api->add_param( @_ ); |
116
|
0
|
|
|
|
|
|
$api->request(); |
117
|
0
|
|
|
|
|
|
$api; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub airline { |
121
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
122
|
0
|
0
|
|
|
|
|
$self = $self->new() unless ref $self; |
123
|
0
|
|
|
|
|
|
my $api = WebService::Recruit::AbRoad::Airline->new(); |
124
|
0
|
|
|
|
|
|
$self->init_treepp_config( $api ); |
125
|
0
|
|
|
|
|
|
$self->init_query_param( $api ); |
126
|
0
|
|
|
|
|
|
$api->add_param( @_ ); |
127
|
0
|
|
|
|
|
|
$api->request(); |
128
|
0
|
|
|
|
|
|
$api; |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub kodawari { |
132
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
133
|
0
|
0
|
|
|
|
|
$self = $self->new() unless ref $self; |
134
|
0
|
|
|
|
|
|
my $api = WebService::Recruit::AbRoad::Kodawari->new(); |
135
|
0
|
|
|
|
|
|
$self->init_treepp_config( $api ); |
136
|
0
|
|
|
|
|
|
$self->init_query_param( $api ); |
137
|
0
|
|
|
|
|
|
$api->add_param( @_ ); |
138
|
0
|
|
|
|
|
|
$api->request(); |
139
|
0
|
|
|
|
|
|
$api; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub spot { |
143
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
144
|
0
|
0
|
|
|
|
|
$self = $self->new() unless ref $self; |
145
|
0
|
|
|
|
|
|
my $api = WebService::Recruit::AbRoad::Spot->new(); |
146
|
0
|
|
|
|
|
|
$self->init_treepp_config( $api ); |
147
|
0
|
|
|
|
|
|
$self->init_query_param( $api ); |
148
|
0
|
|
|
|
|
|
$api->add_param( @_ ); |
149
|
0
|
|
|
|
|
|
$api->request(); |
150
|
0
|
|
|
|
|
|
$api; |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
sub tour_tally { |
154
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
155
|
0
|
0
|
|
|
|
|
$self = $self->new() unless ref $self; |
156
|
0
|
|
|
|
|
|
my $api = WebService::Recruit::AbRoad::TourTally->new(); |
157
|
0
|
|
|
|
|
|
$self->init_treepp_config( $api ); |
158
|
0
|
|
|
|
|
|
$self->init_query_param( $api ); |
159
|
0
|
|
|
|
|
|
$api->add_param( @_ ); |
160
|
0
|
|
|
|
|
|
$api->request(); |
161
|
0
|
|
|
|
|
|
$api; |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head1 NAME |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
WebService::Recruit::AbRoad - An Interface for AB-ROAD Web Service |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head1 SYNOPSIS |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
use WebService::Recruit::AbRoad; |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
my $service = WebService::Recruit::AbRoad->new(); |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
my $param = { |
176
|
|
|
|
|
|
|
'area' => 'EUR', |
177
|
|
|
|
|
|
|
'key' => $ENV{'WEBSERVICE_RECRUIT_KEY'}, |
178
|
|
|
|
|
|
|
}; |
179
|
|
|
|
|
|
|
my $res = $service->tour( %$param ); |
180
|
|
|
|
|
|
|
my $root = $res->root; |
181
|
|
|
|
|
|
|
printf("api_version: %s\n", $root->api_version); |
182
|
|
|
|
|
|
|
printf("results_available: %s\n", $root->results_available); |
183
|
|
|
|
|
|
|
printf("results_returned: %s\n", $root->results_returned); |
184
|
|
|
|
|
|
|
printf("results_start: %s\n", $root->results_start); |
185
|
|
|
|
|
|
|
printf("tour: %s\n", $root->tour); |
186
|
|
|
|
|
|
|
print "...\n"; |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head1 DESCRIPTION |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
エイビーロードWebサービスを使うことで、エイビーロード(AB-ROAD)に掲載されている、海外旅行ツアー情報にアクセスして、アプリケーションを構築することができます。 |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head1 METHODS |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head2 new |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
This is the constructor method for this class. |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
my $service = WebService::Recruit::AbRoad->new(); |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
This accepts optional parameters. |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
my $conf = { |
203
|
|
|
|
|
|
|
utf8_flag => 1, |
204
|
|
|
|
|
|
|
param => { |
205
|
|
|
|
|
|
|
# common parameters of this web service |
206
|
|
|
|
|
|
|
}, |
207
|
|
|
|
|
|
|
}; |
208
|
|
|
|
|
|
|
my $service = WebService::Recruit::AbRoad->new( %$conf ); |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=head2 add_param |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
Add common parameter of tihs web service. |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
$service->add_param( param_key => param_value ); |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
You can add multiple parameters by calling once. |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
$service->add_param( param_key1 => param_value1, |
219
|
|
|
|
|
|
|
param_key2 => param_value2, |
220
|
|
|
|
|
|
|
...); |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head2 get_param |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Returns common parameter value of the specified key. |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
my $param_value = $service->get( 'param_key' ); |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=head2 tour |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
This makes a request for C API. |
231
|
|
|
|
|
|
|
See L for details. |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
my $res = $service->tour( %$param ); |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=head2 area |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
This makes a request for C API. |
238
|
|
|
|
|
|
|
See L for details. |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
my $res = $service->area( %$param ); |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=head2 country |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
This makes a request for C API. |
245
|
|
|
|
|
|
|
See L for details. |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
my $res = $service->country( %$param ); |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=head2 city |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
This makes a request for C API. |
252
|
|
|
|
|
|
|
See L for details. |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
my $res = $service->city( %$param ); |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
=head2 hotel |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
This makes a request for C API. |
259
|
|
|
|
|
|
|
See L for details. |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
my $res = $service->hotel( %$param ); |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=head2 airline |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
This makes a request for C API. |
266
|
|
|
|
|
|
|
See L for details. |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
my $res = $service->airline( %$param ); |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
=head2 kodawari |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
This makes a request for C API. |
273
|
|
|
|
|
|
|
See L for details. |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
my $res = $service->kodawari( %$param ); |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=head2 spot |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
This makes a request for C API. |
280
|
|
|
|
|
|
|
See L for details. |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
my $res = $service->spot( %$param ); |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
=head2 tour_tally |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
This makes a request for C API. |
287
|
|
|
|
|
|
|
See L for details. |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
my $res = $service->tour_tally( %$param ); |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=head2 utf8_flag / user_agent / lwp_useragent / http_lite |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
This modules uses L module internally. |
294
|
|
|
|
|
|
|
Following methods are available to configure it. |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
$service->utf8_flag( 1 ); |
297
|
|
|
|
|
|
|
$service->user_agent( 'Foo-Bar/1.0 ' ); |
298
|
|
|
|
|
|
|
$service->lwp_useragent( LWP::UserAgent->new() ); |
299
|
|
|
|
|
|
|
$service->http_lite( HTTP::Lite->new() ); |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=head1 SEE ALSO |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
http://webservice.recruit.co.jp/ab-road/ |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
=head1 AUTHOR |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
RECRUIT Media Technology Labs |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
=head1 COPYRIGHT |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
Copyright 2008 RECRUIT Media Technology Labs |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
=cut |
314
|
|
|
|
|
|
|
1; |