line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::Recruit::HotPepperBeauty; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
49567
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
78
|
|
4
|
2
|
|
|
2
|
|
10
|
use base qw( Class::Accessor::Fast ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1810
|
|
5
|
2
|
|
|
2
|
|
6594
|
use vars qw( $VERSION ); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
131
|
|
6
|
|
|
|
|
|
|
$VERSION = '0.0.1'; |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
1346
|
use WebService::Recruit::HotPepperBeauty::Salon; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
24
|
|
9
|
2
|
|
|
2
|
|
1298
|
use WebService::Recruit::HotPepperBeauty::ServiceArea; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
29
|
|
10
|
2
|
|
|
2
|
|
1239
|
use WebService::Recruit::HotPepperBeauty::MiddleArea; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
16
|
|
11
|
2
|
|
|
2
|
|
1075
|
use WebService::Recruit::HotPepperBeauty::SmallArea; |
|
2
|
|
|
|
|
1345
|
|
|
2
|
|
|
|
|
23
|
|
12
|
2
|
|
|
2
|
|
2490
|
use WebService::Recruit::HotPepperBeauty::HairImage; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
20
|
|
13
|
2
|
|
|
2
|
|
1323
|
use WebService::Recruit::HotPepperBeauty::HairLength; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
21
|
|
14
|
2
|
|
|
2
|
|
1231
|
use WebService::Recruit::HotPepperBeauty::Kodawari; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
17
|
|
15
|
2
|
|
|
2
|
|
1189
|
use WebService::Recruit::HotPepperBeauty::KodawariSetsubi; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
20
|
|
16
|
2
|
|
|
2
|
|
1267
|
use WebService::Recruit::HotPepperBeauty::KodawariMenu; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
20
|
|
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
|
23
|
my $package = shift; |
24
|
2
|
|
|
|
|
5
|
my $self = {@_}; |
25
|
2
|
|
33
|
|
|
22
|
$self->{user_agent} ||= __PACKAGE__."/$VERSION "; |
26
|
2
|
|
|
|
|
5
|
bless $self, $package; |
27
|
2
|
|
|
|
|
6
|
$self; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub add_param { |
31
|
2
|
|
|
2
|
1
|
663
|
my $self = shift; |
32
|
2
|
|
100
|
|
|
11
|
my $param = $self->param() || {}; |
33
|
2
|
50
|
|
|
|
37
|
%$param = ( %$param, @_ ) if scalar @_; |
34
|
2
|
|
|
|
|
6
|
$self->param($param); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub get_param { |
38
|
3
|
|
|
3
|
1
|
24
|
my $self = shift; |
39
|
3
|
|
|
|
|
5
|
my $key = shift; |
40
|
3
|
50
|
|
|
|
10
|
my $param = $self->param() or return; |
41
|
3
|
50
|
|
|
|
37
|
$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 salon { |
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::HotPepperBeauty::Salon->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 service_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::HotPepperBeauty::ServiceArea->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 middle_area { |
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::HotPepperBeauty::MiddleArea->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 small_area { |
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::HotPepperBeauty::SmallArea->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 hair_image { |
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::HotPepperBeauty::HairImage->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 hair_length { |
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::HotPepperBeauty::HairLength->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::HotPepperBeauty::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 kodawari_setsubi { |
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::HotPepperBeauty::KodawariSetsubi->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 kodawari_menu { |
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::HotPepperBeauty::KodawariMenu->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::HotPepperBeauty - An Interface for HotPepperBeauty Web Service |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head1 SYNOPSIS |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
use WebService::Recruit::HotPepperBeauty; |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
my $service = WebService::Recruit::HotPepperBeauty->new(); |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
my $param = { |
176
|
|
|
|
|
|
|
'key' => $ENV{'WEBSERVICE_RECRUIT_KEY'}, |
177
|
|
|
|
|
|
|
'name' => 'サロン', |
178
|
|
|
|
|
|
|
'order' => '3', |
179
|
|
|
|
|
|
|
}; |
180
|
|
|
|
|
|
|
my $res = $service->salon( %$param ); |
181
|
|
|
|
|
|
|
my $root = $res->root; |
182
|
|
|
|
|
|
|
printf("api_version: %s\n", $root->api_version); |
183
|
|
|
|
|
|
|
printf("results_available: %s\n", $root->results_available); |
184
|
|
|
|
|
|
|
printf("results_returned: %s\n", $root->results_returned); |
185
|
|
|
|
|
|
|
printf("results_start: %s\n", $root->results_start); |
186
|
|
|
|
|
|
|
printf("salon: %s\n", $root->salon); |
187
|
|
|
|
|
|
|
print "...\n"; |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=head1 DESCRIPTION |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
ホットペッパーBeauty Webサービスを使うことで、ホットペッパーBeautyに掲載されている、サロン情報にアクセスして、アプリケーションを構築することができます。 |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head1 METHODS |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=head2 new |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
This is the constructor method for this class. |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
my $service = WebService::Recruit::HotPepperBeauty->new(); |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
This accepts optional parameters. |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
my $conf = { |
204
|
|
|
|
|
|
|
utf8_flag => 1, |
205
|
|
|
|
|
|
|
param => { |
206
|
|
|
|
|
|
|
# common parameters of this web service |
207
|
|
|
|
|
|
|
}, |
208
|
|
|
|
|
|
|
}; |
209
|
|
|
|
|
|
|
my $service = WebService::Recruit::HotPepperBeauty->new( %$conf ); |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=head2 add_param |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
Add common parameter of tihs web service. |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
$service->add_param( param_key => param_value ); |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
You can add multiple parameters by calling once. |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
$service->add_param( param_key1 => param_value1, |
220
|
|
|
|
|
|
|
param_key2 => param_value2, |
221
|
|
|
|
|
|
|
...); |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=head2 get_param |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
Returns common parameter value of the specified key. |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
my $param_value = $service->get( 'param_key' ); |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=head2 salon |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
This makes a request for C API. |
232
|
|
|
|
|
|
|
See L for details. |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
my $res = $service->salon( %$param ); |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=head2 service_area |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
This makes a request for C API. |
239
|
|
|
|
|
|
|
See L for details. |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
my $res = $service->service_area( %$param ); |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=head2 middle_area |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
This makes a request for C API. |
246
|
|
|
|
|
|
|
See L for details. |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
my $res = $service->middle_area( %$param ); |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=head2 small_area |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
This makes a request for C API. |
253
|
|
|
|
|
|
|
See L for details. |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
my $res = $service->small_area( %$param ); |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
=head2 hair_image |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
This makes a request for C API. |
260
|
|
|
|
|
|
|
See L for details. |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
my $res = $service->hair_image( %$param ); |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
=head2 hair_length |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
This makes a request for C API. |
267
|
|
|
|
|
|
|
See L for details. |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
my $res = $service->hair_length( %$param ); |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=head2 kodawari |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
This makes a request for C API. |
274
|
|
|
|
|
|
|
See L for details. |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
my $res = $service->kodawari( %$param ); |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
=head2 kodawari_setsubi |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
This makes a request for C API. |
281
|
|
|
|
|
|
|
See L for details. |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
my $res = $service->kodawari_setsubi( %$param ); |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=head2 kodawari_menu |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
This makes a request for C API. |
288
|
|
|
|
|
|
|
See L for details. |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
my $res = $service->kodawari_menu( %$param ); |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
=head2 utf8_flag / user_agent / lwp_useragent / http_lite |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
This modules uses L module internally. |
295
|
|
|
|
|
|
|
Following methods are available to configure it. |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
$service->utf8_flag( 1 ); |
298
|
|
|
|
|
|
|
$service->user_agent( 'Foo-Bar/1.0 ' ); |
299
|
|
|
|
|
|
|
$service->lwp_useragent( LWP::UserAgent->new() ); |
300
|
|
|
|
|
|
|
$service->http_lite( HTTP::Lite->new() ); |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
=head1 SEE ALSO |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
http://webservice.recruit.co.jp/beauty/ |
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
=head1 AUTHOR |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
RECRUIT Media Technology Labs |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
=head1 COPYRIGHT |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
Copyright 2008 RECRUIT Media Technology Labs |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
=cut |
315
|
|
|
|
|
|
|
1; |