File Coverage

blib/lib/WebService/Recruit/Jalan/HotelSearchAdvance.pm
Criterion Covered Total %
statement 13 17 76.4
branch n/a
condition n/a
subroutine 7 11 63.6
pod 6 8 75.0
total 26 36 72.2


line stmt bran cond sub pod time code
1             package WebService::Recruit::Jalan::HotelSearchAdvance;
2 3     3   19 use strict;
  3         6  
  3         127  
3 3     3   19 use vars qw( $VERSION );
  3         5  
  3         147  
4 3     3   16 use base qw( WebService::Recruit::Jalan::Base );
  3         7  
  3         1691  
5             $VERSION = '0.10';
6              
7 0     0 1 0 sub url { 'http://jws.jalan.net/APIAdvance/HotelSearch/V1/'; }
8              
9 1     1 1 915 sub query_class { 'WebService::Recruit::Jalan::HotelSearchAdvance::Query'; }
10 3     3 0 83 sub query_fields { [qw(
11             key reg pref l_area s_area h_id o_area_id o_id x y range h_name
12             h_type o_pool parking pub_bath onsen prv_bath v_bath sauna jacz
13             mssg r_ski r_brd pet esthe p_pong limo room_b room_d prv_b prv_d
14             early_in late_out no_smk net r_room high p_ok sp_room bath_to
15             o_bath pour cloudy i_pool fitness gym p_field bbq hall 5_station
16             5_beach 5_slope c_card c_jcb c_visa c_master c_amex c_uc c_dc
17             c_nicos c_diners c_saison c_ufj cvs no_meal b_only d_only 2_meals
18             sng_room twn_room dbl_room tri_room 4bed_room jpn_room j_w_room
19             child_price c_bed_meal c_no_bed_meal c_meal_only c_bed_only
20             pict_size picts order start count xml_ptn
21             )]; }
22 0     0 1 0 sub notnull_param { [qw( key )]; }
23              
24 0     0 1 0 sub elem_class { 'WebService::Recruit::Jalan::HotelSearchAdvance::Element'; }
25 3     3 1 41 sub root_elem { 'Results'; }
26             sub elem_fields { {
27 3     3 0 74 Results => [qw(
28             NumberOfResults DisplayPerPage DisplayFrom APIVersion Hotel
29             )],
30             Hotel => [qw(
31             HotelID HotelName PostCode HotelAddress Area HotelType
32             HotelDetailURL HotelCatchCopy HotelCaption PictureURL
33             PictureCaption AccessInformation CheckInTime CheckOutTime
34             X Y SampleRateFrom LastUpdate OnsenName HotelNameKana
35             CreditCard NumberOfRatings Rating Plan
36             )],
37             Area => [qw(
38             Region Prefecture LargeArea SmallArea
39             )],
40             AccessInformation => [qw(
41             name _text
42             )],
43             LastUpdate => [qw(
44             day month year
45             )],
46             CreditCard => [qw(
47             AMEX DC DINNERS ETC JCB MASTER MILLION NICOS SAISON UC UFJ VISA _text
48             )],
49             Plan => [qw(
50             PlanName RoomType RoomName PlanCheckIn PlanCheckOut PlanPictureURL
51             PlanPictureCaption Meal PlanSampleRateFrom
52             )],
53             }; }
54 0     0 1   sub force_array { [qw(
55             Hotel PictureURL PictureCaption AccessInformation
56             Plan RoomType PlanPictureURL PlanPictureCaption
57             )]; }
58              
59             # __PACKAGE__->mk_query_accessors();
60              
61             @WebService::Recruit::Jalan::HotelSearchAdvance::Query::ISA = qw( Class::Accessor::Fast );
62             WebService::Recruit::Jalan::HotelSearchAdvance::Query->mk_accessors( @{query_fields()} );
63              
64             # __PACKAGE__->mk_elem_accessors();
65              
66             @WebService::Recruit::Jalan::HotelSearchAdvance::Element::ISA = qw( Class::Accessor::Children::Fast );
67             WebService::Recruit::Jalan::HotelSearchAdvance::Element->mk_ro_accessors( root_elem() );
68             WebService::Recruit::Jalan::HotelSearchAdvance::Element->mk_child_ro_accessors( %{elem_fields()} );
69              
70             =head1 NAME
71              
72             WebService::Recruit::Jalan::HotelSearchAdvance - Jalan Web Service "HotelSearchAdvance" API
73              
74             =head1 SYNOPSIS
75              
76             use WebService::Recruit::Jalan;
77              
78             my $jalan = WebService::Recruit::Jalan->new();
79             $jalan->key( 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' );
80              
81             my $param = {
82             s_area => '162612',
83             xml_ptn => '2',
84             };
85             my $res = $jalan->HotelSearchAdvance( %$param );
86             die "error!" if $res->is_error;
87              
88             my $list = $res->root->Hotel;
89             foreach my $hotel ( @$list ) {
90             print "HotelID: ", $hotel->HotelID, "\n";
91             print "HotelName: ", $hotel->HotelName, "\n";
92             }
93              
94             =head1 DESCRIPTION
95              
96             This module is a interface for the C API.
97             It accepts following query parameters to make an request.
98              
99             my $param = {
100             reg => '10',
101             pref => '130000',
102             l_area => '136200',
103             s_area => '136202',
104             h_id => '324994',
105             o_area_id => '50024',
106             o_id => '0042',
107             x => '503037529',
108             y => '128366212',
109             range => '10',
110             h_name => 'Hotel Name',
111             h_type => '0',
112             o_pool => '0',
113             parking => '0',
114             pub_bath => '0',
115             onsen => '0',
116             prv_bath => '0',
117             v_bath => '0',
118             sauna => '0',
119             jacz => '0',
120             mssg => '0',
121             r_ski => '0',
122             r_brd => '0',
123             pet => '0',
124             esthe => '0',
125             p_pong => '0',
126             limo => '0',
127             room_b => '0',
128             room_d => '0',
129             prv_b => '0',
130             prv_d => '0',
131             early_in => '0',
132             late_out => '0',
133             no_smk => '0',
134             net => '0',
135             r_room => '0',
136             high => '0',
137             p_ok => '0',
138             sp_room => '0',
139             bath_to => '0',
140             o_bath => '0',
141             pour => '0',
142             cloudy => '0',
143             i_pool => '0',
144             fitness => '0',
145             gym => '0',
146             p_field => '0',
147             bbq => '0',
148             hall => '0',
149             5_station => '0',
150             5_beach => '0',
151             5_slope => '0',
152             c_card => '0',
153             c_jcb => '0',
154             c_visa => '0',
155             c_master => '0',
156             c_amex => '0',
157             c_uc => '0',
158             c_dc => '0',
159             c_nicos => '0',
160             c_diners => '0',
161             c_saison => '0',
162             c_ufj => '0',
163             cvs => '0',
164             no_meal => '0',
165             b_only => '0',
166             d_only => '0',
167             2_meals => '0',
168             sng_room => '0',
169             twn_room => '0',
170             dbl_room => '0',
171             tri_room => '0',
172             4bed_room => '0',
173             jpn_room => '0',
174             j_w_room => '0',
175             child_price => '0',
176             c_bed_meal => '0',
177             c_no_bed_meal => '0',
178             c_meal_only => '0',
179             c_bed_only => '0',
180             pict_size => '3', # pictM
181             picts => '5',
182             order => '0',
183             start => '1',
184             count => '10',
185             xml_ptn => '2',
186             };
187              
188             C<$jalan> above is an instance of L.
189              
190             =head1 METHODS
191              
192             =head2 root
193              
194             This returns the root element of the response.
195              
196             my $root = $res->root;
197              
198             You can retrieve each element by the following accessors.
199              
200             $root->NumberOfResults;
201             $root->DisplayPerPage;
202             $root->DisplayFrom;
203             $root->APIVersion;
204             $root->Hotel;
205             $root->Hotel->[0]->HotelID;
206             $root->Hotel->[0]->HotelName;
207             $root->Hotel->[0]->PostCode;
208             $root->Hotel->[0]->HotelAddress;
209             $root->Hotel->[0]->Area;
210             $root->Hotel->[0]->Area->Region;
211             $root->Hotel->[0]->Area->Prefecture;
212             $root->Hotel->[0]->Area->LargeArea;
213             $root->Hotel->[0]->Area->SmallArea;
214             $root->Hotel->[0]->HotelType;
215             $root->Hotel->[0]->HotelDetailURL;
216             $root->Hotel->[0]->HotelCatchCopy;
217             $root->Hotel->[0]->HotelCaption;
218             $root->Hotel->[0]->PictureURL->[0];
219             $root->Hotel->[0]->PictureCaption->[0];
220             $root->Hotel->[0]->AccessInformation;
221             $root->Hotel->[0]->AccessInformation->[0]->name;
222             $root->Hotel->[0]->CheckInTime;
223             $root->Hotel->[0]->CheckOutTime;
224             $root->Hotel->[0]->X;
225             $root->Hotel->[0]->Y;
226             $root->Hotel->[0]->SampleRateFrom;
227             $root->Hotel->[0]->LastUpdate;
228             $root->Hotel->[0]->LastUpdate->day;
229             $root->Hotel->[0]->LastUpdate->month;
230             $root->Hotel->[0]->LastUpdate->year;
231             $root->Hotel->[0]->OnsenName;
232             $root->Hotel->[0]->HotelNameKana;
233             $root->Hotel->[0]->CreditCard;
234             $root->Hotel->[0]->CreditCard->AMEX;
235             $root->Hotel->[0]->CreditCard->DC;
236             $root->Hotel->[0]->CreditCard->DINNERS;
237             $root->Hotel->[0]->CreditCard->ETC;
238             $root->Hotel->[0]->CreditCard->JCB;
239             $root->Hotel->[0]->CreditCard->MASTER;
240             $root->Hotel->[0]->CreditCard->MILLION;
241             $root->Hotel->[0]->CreditCard->NICOS;
242             $root->Hotel->[0]->CreditCard->SAISON;
243             $root->Hotel->[0]->CreditCard->UC;
244             $root->Hotel->[0]->CreditCard->UFJ;
245             $root->Hotel->[0]->CreditCard->VISA;
246             $root->Hotel->[0]->NumberOfRatings;
247             $root->Hotel->[0]->Rating;
248             $root->Hotel->[0]->Plan;
249             $root->Hotel->[0]->Plan->[0]->PlanName;
250             $root->Hotel->[0]->Plan->[0]->RoomType->[0];
251             $root->Hotel->[0]->Plan->[0]->RoomName;
252             $root->Hotel->[0]->Plan->[0]->PlanCheckIn;
253             $root->Hotel->[0]->Plan->[0]->PlanCheckOut;
254             $root->Hotel->[0]->Plan->[0]->PlanPictureURL;
255             $root->Hotel->[0]->Plan->[0]->PlanPictureCaption;
256             $root->Hotel->[0]->Plan->[0]->Meal;
257             $root->Hotel->[0]->Plan->[0]->PlanSampleRateFrom;
258              
259             =head2 xml
260              
261             This returns the raw response context itself.
262              
263             print $res->xml, "\n";
264              
265             =head2 code
266              
267             This returns the response status code.
268              
269             my $code = $res->code; # usually "200" when succeeded
270              
271             =head2 is_error
272              
273             This returns true value when the response has an error.
274              
275             die 'error!' if $res->is_error;
276              
277             =head2 page
278              
279             This returns a L instance.
280              
281             my $page = $res->page();
282             print "Total: ", $page->total_entries, "\n";
283             print "Page: ", $page->current_page, "\n";
284             print "Last: ", $page->last_page, "\n";
285              
286             =head2 pageset
287              
288             This returns a L instance.
289              
290             my $pageset = $res->pageset( 'fixed' );
291             $pageset->pages_per_set($pages_per_set);
292             my $set = $pageset->pages_in_set();
293             foreach my $num ( @$set ) {
294             print "$num ";
295             }
296              
297             =head2 page_param
298              
299             This returns a hash to specify the page for the next request.
300              
301             my %hash = $res->page_param( $page->next_page );
302              
303             =head2 page_query
304              
305             This returns a query string to specify the page for the next request.
306              
307             my $query = $res->page_query( $page->prev_page );
308              
309             =head1 SEE ALSO
310              
311             L
312              
313             =head1 AUTHOR
314              
315             Yusuke Kawasaki L
316              
317             This module is unofficial and released by the author in person.
318              
319             =head1 COPYRIGHT AND LICENSE
320              
321             Copyright (c) 2007 Yusuke Kawasaki. All rights reserved.
322             This program is free software; you can redistribute it and/or
323             modify it under the same terms as Perl itself.
324              
325             =cut
326             1;