line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::Recruit::HotPepper::GourmetSearch; |
2
|
3
|
|
|
3
|
|
20
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
124
|
|
3
|
3
|
|
|
3
|
|
24
|
use base qw( WebService::Recruit::HotPepper::Base ); |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
2165
|
|
4
|
3
|
|
|
3
|
|
21
|
use vars qw( $VERSION ); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
1340
|
|
5
|
|
|
|
|
|
|
$VERSION = '0.02'; |
6
|
|
|
|
|
|
|
|
7
|
0
|
|
|
0
|
1
|
0
|
sub url { 'http://api.hotpepper.jp/GourmetSearch/V110'; } |
8
|
0
|
|
|
0
|
1
|
0
|
sub force_array { [qw( Shop Error )]; } |
9
|
0
|
|
|
0
|
1
|
0
|
sub elem_class { 'WebService::Recruit::HotPepper::GourmetSearch::Element'; } |
10
|
1
|
|
|
1
|
1
|
48
|
sub query_class { 'WebService::Recruit::HotPepper::GourmetSearch::Query'; } |
11
|
|
|
|
|
|
|
|
12
|
3
|
|
|
3
|
0
|
66
|
sub query_fields { [qw( |
13
|
|
|
|
|
|
|
ShopIdFront ShopNameKana ShopName ShopTel ShopAddress |
14
|
|
|
|
|
|
|
LargeServiceAreaCD ServiceAreaCD LargeAreaCD MiddleAreaCD |
15
|
|
|
|
|
|
|
SmallAreaCD Keyword Latitude Longitude Range Datum KtaiCoupon |
16
|
|
|
|
|
|
|
GenreCD FoodCD BudgetCD PartyCapacity Wedding Course FreeDrink |
17
|
|
|
|
|
|
|
FreeFood PrivateRoom Horigotatsu Tatami Cocktail Shochu |
18
|
|
|
|
|
|
|
Sake Wine Card NonSmoking Charter Ktai Parking BarrierFree |
19
|
|
|
|
|
|
|
Sommelier NightView OpenAir Show Equipment Karaoke Band |
20
|
|
|
|
|
|
|
Tv Lunch Midnight MidnightMeal English Pet Child |
21
|
|
|
|
|
|
|
key Order Start Count |
22
|
|
|
|
|
|
|
)]; } |
23
|
3
|
|
|
3
|
1
|
57
|
sub root_elem { 'Results'; } |
24
|
|
|
|
|
|
|
sub elem_fields { { |
25
|
3
|
|
|
3
|
0
|
78
|
Results => [qw( |
26
|
|
|
|
|
|
|
NumberOfResults DisplayPerPage DisplayFrom APIVersion |
27
|
|
|
|
|
|
|
Shop |
28
|
|
|
|
|
|
|
)], |
29
|
|
|
|
|
|
|
Shop => [qw( |
30
|
|
|
|
|
|
|
ShopIdFront ShopNameKana ShopName ShopAddress StationName |
31
|
|
|
|
|
|
|
KtaiCoupon LargeServiceAreaCD LargeServiceAreaName |
32
|
|
|
|
|
|
|
ServiceAreaCD ServiceAreaName LargeAreaCD LargeAreaName |
33
|
|
|
|
|
|
|
MiddleAreaCD MiddleAreaName SmallAreaCD SmallAreaName |
34
|
|
|
|
|
|
|
Latitude Longitude GenreCD GenreName FoodCD FoodName |
35
|
|
|
|
|
|
|
GenreCatch ShopCatch BudgetCD BudgetDesc BudgetAverage |
36
|
|
|
|
|
|
|
Capacity Access KtaiAccess ShopUrl KtaiShopUrl KtaiQRUrl |
37
|
|
|
|
|
|
|
PictureUrl Open Close PartyCapacity Wedding Course |
38
|
|
|
|
|
|
|
FreeDrink FreeFood PrivateRoom Horigotatsu Tatami |
39
|
|
|
|
|
|
|
Card NonSmoking Charter Ktai Parking BarrierFree |
40
|
|
|
|
|
|
|
Sommelier OpenAir Show Equipment Karaoke Band Tv |
41
|
|
|
|
|
|
|
English Pet Child |
42
|
|
|
|
|
|
|
)], |
43
|
|
|
|
|
|
|
PictureUrl => [qw( |
44
|
|
|
|
|
|
|
PcLargeImg PcMiddleImg PcSmallImg MbLargeImg MbSmallImg |
45
|
|
|
|
|
|
|
)], |
46
|
|
|
|
|
|
|
}; } |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# __PACKAGE__->mk_query_accessors(); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
@WebService::Recruit::HotPepper::GourmetSearch::Query::ISA = qw( Class::Accessor::Fast ); |
51
|
|
|
|
|
|
|
WebService::Recruit::HotPepper::GourmetSearch::Query->mk_accessors( @{query_fields()} ); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# __PACKAGE__->mk_elem_accessors(); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
@WebService::Recruit::HotPepper::GourmetSearch::Element::ISA = qw( Class::Accessor::Children::Fast ); |
56
|
|
|
|
|
|
|
WebService::Recruit::HotPepper::GourmetSearch::Element->mk_ro_accessors( root_elem() ); |
57
|
|
|
|
|
|
|
WebService::Recruit::HotPepper::GourmetSearch::Element->mk_child_ro_accessors( %{elem_fields()} ); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 NAME |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
WebService::Recruit::HotPepper::GourmetSearch - HotPepper Web Service "GourmetSearch" API |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 SYNOPSIS |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
use WebService::Recruit::HotPepper; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
my $api = WebService::Recruit::HotPepper->new(); |
68
|
|
|
|
|
|
|
$api->key( 'xxxxxxxxxxxxxxxx' ); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
my $param = { |
71
|
|
|
|
|
|
|
ServiceAreaCD => 'SA11', |
72
|
|
|
|
|
|
|
GenreCD => 'G002', |
73
|
|
|
|
|
|
|
}; |
74
|
|
|
|
|
|
|
my $res = $api->GourmetSearch( %$param ); |
75
|
|
|
|
|
|
|
die 'error!' if $res->is_error; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
my $list = $res->root->Shop; |
78
|
|
|
|
|
|
|
foreach my $shop ( @$list ) { |
79
|
|
|
|
|
|
|
print "name: ", $shop->ShopName, "\n"; |
80
|
|
|
|
|
|
|
print "addr: ", $shop->ShopAddress, "\n"; |
81
|
|
|
|
|
|
|
print "photo: ", $shop->PictureUrl->PcLargeImg, "\n"; |
82
|
|
|
|
|
|
|
print "\n"; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 DESCRIPTION |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This module is an interface for the C API. |
88
|
|
|
|
|
|
|
It accepts following query parameters to make an request. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
my $param = { |
91
|
|
|
|
|
|
|
Start => 1, |
92
|
|
|
|
|
|
|
Count => 10, |
93
|
|
|
|
|
|
|
keyword => 'italian pizza', |
94
|
|
|
|
|
|
|
ShopName => 'antonio', |
95
|
|
|
|
|
|
|
SmallAreaCD => 'X005', |
96
|
|
|
|
|
|
|
# |
97
|
|
|
|
|
|
|
# ...and so on. See |
98
|
|
|
|
|
|
|
# http://api.hotpepper.jp/reference.html |
99
|
|
|
|
|
|
|
# for a complete list of available params. |
100
|
|
|
|
|
|
|
}; |
101
|
|
|
|
|
|
|
my $res = $hpp->GourmetSearch( %$param ); |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
C<$hpp> above is an instance of L. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 METHODS |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head2 root |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This returns the root element of the response. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
my $root = $res->root; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
You can retrieve each element by the following accessors. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
$root->NumberOfResults; |
116
|
|
|
|
|
|
|
$root->DisplayPerPage; |
117
|
|
|
|
|
|
|
$root->DisplayFrom; |
118
|
|
|
|
|
|
|
$root->APIVersion; |
119
|
|
|
|
|
|
|
$root->Shop->[0]->ShopIdFront; |
120
|
|
|
|
|
|
|
$root->Shop->[0]->ShopNameKana; |
121
|
|
|
|
|
|
|
$root->Shop->[0]->ShopName; |
122
|
|
|
|
|
|
|
$root->Shop->[0]->ShopAddress; |
123
|
|
|
|
|
|
|
$root->Shop->[0]->StationName; |
124
|
|
|
|
|
|
|
$root->Shop->[0]->KtaiCoupon; |
125
|
|
|
|
|
|
|
$root->Shop->[0]->LargeServiceAreaCD; |
126
|
|
|
|
|
|
|
$root->Shop->[0]->LargeServiceAreaName; |
127
|
|
|
|
|
|
|
$root->Shop->[0]->ServiceAreaCD; |
128
|
|
|
|
|
|
|
$root->Shop->[0]->ServiceAreaName; |
129
|
|
|
|
|
|
|
$root->Shop->[0]->LargeAreaCD; |
130
|
|
|
|
|
|
|
$root->Shop->[0]->LargeAreaName; |
131
|
|
|
|
|
|
|
$root->Shop->[0]->MiddleAreaCD; |
132
|
|
|
|
|
|
|
$root->Shop->[0]->MiddleAreaName; |
133
|
|
|
|
|
|
|
$root->Shop->[0]->SmallAreaCD; |
134
|
|
|
|
|
|
|
$root->Shop->[0]->SmallAreaName; |
135
|
|
|
|
|
|
|
$root->Shop->[0]->Latitude; |
136
|
|
|
|
|
|
|
$root->Shop->[0]->Longitude; |
137
|
|
|
|
|
|
|
$root->Shop->[0]->GenreCD; |
138
|
|
|
|
|
|
|
$root->Shop->[0]->GenreName; |
139
|
|
|
|
|
|
|
$root->Shop->[0]->FoodCD; |
140
|
|
|
|
|
|
|
$root->Shop->[0]->FoodName; |
141
|
|
|
|
|
|
|
$root->Shop->[0]->GenreCatch; |
142
|
|
|
|
|
|
|
$root->Shop->[0]->ShopCatch; |
143
|
|
|
|
|
|
|
$root->Shop->[0]->BudgetCD; |
144
|
|
|
|
|
|
|
$root->Shop->[0]->BudgetDesc; |
145
|
|
|
|
|
|
|
$root->Shop->[0]->BudgetAverage; |
146
|
|
|
|
|
|
|
$root->Shop->[0]->Capacity; |
147
|
|
|
|
|
|
|
$root->Shop->[0]->Access; |
148
|
|
|
|
|
|
|
$root->Shop->[0]->KtaiAccess; |
149
|
|
|
|
|
|
|
$root->Shop->[0]->ShopUrl; |
150
|
|
|
|
|
|
|
$root->Shop->[0]->KtaiShopUrl; |
151
|
|
|
|
|
|
|
$root->Shop->[0]->KtaiQRUrl; |
152
|
|
|
|
|
|
|
$root->Shop->[0]->PictureUrl->PcLargeImg; |
153
|
|
|
|
|
|
|
$root->Shop->[0]->PictureUrl->PcMiddleImg; |
154
|
|
|
|
|
|
|
$root->Shop->[0]->PictureUrl->PcSmallImg; |
155
|
|
|
|
|
|
|
$root->Shop->[0]->PictureUrl->MbLargeImg; |
156
|
|
|
|
|
|
|
$root->Shop->[0]->PictureUrl->MbSmallImg; |
157
|
|
|
|
|
|
|
$root->Shop->[0]->Open; |
158
|
|
|
|
|
|
|
$root->Shop->[0]->Close; |
159
|
|
|
|
|
|
|
$root->Shop->[0]->PartyCapacity; |
160
|
|
|
|
|
|
|
$root->Shop->[0]->Wedding; |
161
|
|
|
|
|
|
|
$root->Shop->[0]->Course; |
162
|
|
|
|
|
|
|
$root->Shop->[0]->FreeDrink; |
163
|
|
|
|
|
|
|
$root->Shop->[0]->FreeFood; |
164
|
|
|
|
|
|
|
$root->Shop->[0]->PrivateRoom; |
165
|
|
|
|
|
|
|
$root->Shop->[0]->Horigotatsu; |
166
|
|
|
|
|
|
|
$root->Shop->[0]->Tatami; |
167
|
|
|
|
|
|
|
$root->Shop->[0]->Card; |
168
|
|
|
|
|
|
|
$root->Shop->[0]->NonSmoking; |
169
|
|
|
|
|
|
|
$root->Shop->[0]->Charter; |
170
|
|
|
|
|
|
|
$root->Shop->[0]->Ktai; |
171
|
|
|
|
|
|
|
$root->Shop->[0]->Parking; |
172
|
|
|
|
|
|
|
$root->Shop->[0]->BarrierFree; |
173
|
|
|
|
|
|
|
$root->Shop->[0]->Sommelier; |
174
|
|
|
|
|
|
|
$root->Shop->[0]->OpenAir; |
175
|
|
|
|
|
|
|
$root->Shop->[0]->Show; |
176
|
|
|
|
|
|
|
$root->Shop->[0]->Equipment; |
177
|
|
|
|
|
|
|
$root->Shop->[0]->Karaoke; |
178
|
|
|
|
|
|
|
$root->Shop->[0]->Band; |
179
|
|
|
|
|
|
|
$root->Shop->[0]->Tv; |
180
|
|
|
|
|
|
|
$root->Shop->[0]->English; |
181
|
|
|
|
|
|
|
$root->Shop->[0]->Pet; |
182
|
|
|
|
|
|
|
$root->Shop->[0]->Child; |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head2 xml |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
This returns the raw response context itself. |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
print $res->xml, "\n"; |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head2 code |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
This returns the response status code. |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
my $code = $res->code; # usually "200" when succeeded |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=head2 is_error |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
This returns true value when the response has an error. |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
die 'error!' if $res->is_error; |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head2 page |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
This returns a L instance. |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
my $page = $res->page(); |
207
|
|
|
|
|
|
|
print "Total: ", $page->total_entries, "\n"; |
208
|
|
|
|
|
|
|
print "Page: ", $page->current_page, "\n"; |
209
|
|
|
|
|
|
|
print "Last: ", $page->last_page, "\n"; |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=head2 pageset |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
This returns a L instance. |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
my $pageset = $res->pageset( 'fixed' ); |
216
|
|
|
|
|
|
|
$pageset->pages_per_set($pages_per_set); |
217
|
|
|
|
|
|
|
my $set = $pageset->pages_in_set(); |
218
|
|
|
|
|
|
|
foreach my $num ( @$set ) { |
219
|
|
|
|
|
|
|
print "$num "; |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head2 page_param |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
This returns a hash to specify the page for the next request. |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
my %hash = $res->page_param( $page->next_page ); |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=head2 page_query |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
This returns a query string to specify the page for the next request. |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
my $query = $res->page_query( $page->prev_page ); |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=head1 SEE ALSO |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
L |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=head1 AUTHOR |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
Toshimasa Ishibashi L |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
This module is unofficial and released by the author in person. |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=head1 THANKS TO |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
Yusuke Kawasaki L |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
For creating/preparing all the base modules and stuff. |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
Copyright (c) 2007 Toshimasa Ishibashi. All rights reserved. |
253
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or |
254
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
=cut |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
1; |