File Coverage

blib/lib/WebService/Recruit/AbRoad/Tour.pm
Criterion Covered Total %
statement 20 25 80.0
branch n/a
condition n/a
subroutine 10 15 66.6
pod 8 10 80.0
total 38 50 76.0


line stmt bran cond sub pod time code
1             package WebService::Recruit::AbRoad::Tour;
2              
3 3     3   3457 use strict;
  3         7  
  3         444  
4 3     3   18 use base qw( WebService::Recruit::AbRoad::Base );
  3         6  
  3         15750  
5 3     3   18 use vars qw( $VERSION );
  3         6  
  3         113  
6 3     3   16 use Class::Accessor::Fast;
  3         7  
  3         29  
7 3     3   82 use Class::Accessor::Children::Fast;
  3         53  
  3         11  
8              
9             $VERSION = '0.0.1';
10              
11 0     0 1 0 sub http_method { 'GET'; }
12              
13 0     0 1 0 sub url { 'http://webservice.recruit.co.jp/ab-road/tour/v1/'; }
14              
15 1     1 1 40 sub query_class { 'WebService::Recruit::AbRoad::Tour::Query'; }
16              
17             sub query_fields { [
18 3     3 0 55 'key', 'id', 'area', 'country', 'city', 'hotel', 'keyword', 'dept', 'ym', 'ymd', 'price_min', 'price_max', 'term_min', 'term_max', 'airline', 'kodaw', 'order', 'start', 'count'
19             ]; }
20              
21             sub default_param { {
22 1     1 1 440 'format' => 'xml'
23             }; }
24              
25             sub notnull_param { [
26 0     0 1 0 'key'
27             ]; }
28              
29 0     0 1 0 sub elem_class { 'WebService::Recruit::AbRoad::Tour::Element'; }
30              
31 3     3 1 36 sub root_elem { 'results'; }
32              
33             sub elem_fields { {
34 3     3 0 117 'airline' => ['code', 'name'],
35             'all_month' => ['min', 'max'],
36             'area' => ['code', 'name'],
37             'brand' => ['code', 'name'],
38             'city' => ['code', 'name', 'code', 'name', 'lat', 'lng', 'area', 'country'],
39             'country' => ['code', 'name'],
40             'dept_city' => ['name', 'code'],
41             'error' => ['message'],
42             'hotel' => ['code', 'name', 'city'],
43             'kodawari' => ['code', 'name'],
44             'price' => ['all_month', 'min', 'max'],
45             'results' => ['api_version', 'results_available', 'results_returned', 'results_start', 'tour', 'api_version', 'error'],
46             'sche' => ['day', 'city'],
47             'tour' => ['id', 'last_update', 'term', 'title', 'airline', 'airline_summary', 'brand', 'city_summary', 'dept_city', 'hotel', 'hotel_summary', 'kodawari', 'price', 'sche', 'urls'],
48             'urls' => ['mobile', 'pc', 'qr'],
49              
50             }; }
51              
52             sub force_array { [
53 0     0 1   'airline', 'hotel', 'kodawari', 'sche', 'tour'
54             ]; }
55              
56             # __PACKAGE__->mk_query_accessors();
57              
58             @WebService::Recruit::AbRoad::Tour::Query::ISA = qw( Class::Accessor::Fast );
59             WebService::Recruit::AbRoad::Tour::Query->mk_accessors( @{query_fields()} );
60              
61             # __PACKAGE__->mk_elem_accessors();
62              
63             @WebService::Recruit::AbRoad::Tour::Element::ISA = qw( Class::Accessor::Children::Fast );
64             WebService::Recruit::AbRoad::Tour::Element->mk_ro_accessors( root_elem() );
65             WebService::Recruit::AbRoad::Tour::Element->mk_child_ro_accessors( %{elem_fields()} );
66              
67             =head1 NAME
68              
69             WebService::Recruit::AbRoad::Tour - AB-ROAD Web Service "tour" API
70              
71             =head1 SYNOPSIS
72              
73             use WebService::Recruit::AbRoad;
74            
75             my $service = WebService::Recruit::AbRoad->new();
76            
77             my $param = {
78             'area' => 'EUR',
79             'key' => $ENV{'WEBSERVICE_RECRUIT_KEY'},
80             };
81             my $res = $service->tour( %$param );
82             my $data = $res->root;
83             print "api_version: $data->api_version\n";
84             print "results_available: $data->results_available\n";
85             print "results_returned: $data->results_returned\n";
86             print "results_start: $data->results_start\n";
87             print "tour: $data->tour\n";
88             print "...\n";
89              
90             =head1 DESCRIPTION
91              
92             This module is a interface for the C API.
93             It accepts following query parameters to make an request.
94              
95             my $param = {
96             'key' => 'XXXXXXXX',
97             'id' => 'AB123456',
98             'area' => 'EUR',
99             'country' => 'BE',
100             'city' => 'NYC',
101             'hotel' => '73393',
102             'keyword' => 'ベトナム 癒し',
103             'dept' => 'XXXXXXXX',
104             'ym' => '0708',
105             'ymd' => '070812',
106             'price_min' => '30000',
107             'price_max' => '100000',
108             'term_min' => '3',
109             'term_max' => '10',
110             'airline' => 'A0',
111             'kodaw' => 'XXXXXXXX',
112             'order' => 'XXXXXXXX',
113             'start' => 'XXXXXXXX',
114             'count' => 'XXXXXXXX',
115             };
116             my $res = $service->tour( %$param );
117              
118             C<$service> above is an instance of L.
119              
120             =head1 METHODS
121              
122             =head2 root
123              
124             This returns the root element of the response.
125              
126             my $root = $res->root;
127              
128             You can retrieve each element by the following accessors.
129              
130             $root->api_version
131             $root->results_available
132             $root->results_returned
133             $root->results_start
134             $root->tour
135             $root->tour->[0]->id
136             $root->tour->[0]->last_update
137             $root->tour->[0]->term
138             $root->tour->[0]->title
139             $root->tour->[0]->airline
140             $root->tour->[0]->airline_summary
141             $root->tour->[0]->brand
142             $root->tour->[0]->city_summary
143             $root->tour->[0]->dept_city
144             $root->tour->[0]->hotel
145             $root->tour->[0]->hotel_summary
146             $root->tour->[0]->kodawari
147             $root->tour->[0]->price
148             $root->tour->[0]->sche
149             $root->tour->[0]->urls
150             $root->tour->[0]->airline->[0]->code
151             $root->tour->[0]->airline->[0]->name
152             $root->tour->[0]->brand->code
153             $root->tour->[0]->brand->name
154             $root->tour->[0]->dept_city->name
155             $root->tour->[0]->dept_city->code
156             $root->tour->[0]->hotel->[0]->code
157             $root->tour->[0]->hotel->[0]->name
158             $root->tour->[0]->hotel->[0]->city
159             $root->tour->[0]->kodawari->[0]->code
160             $root->tour->[0]->kodawari->[0]->name
161             $root->tour->[0]->price->all_month
162             $root->tour->[0]->price->min
163             $root->tour->[0]->price->max
164             $root->tour->[0]->sche->[0]->day
165             $root->tour->[0]->sche->[0]->city
166             $root->tour->[0]->urls->mobile
167             $root->tour->[0]->urls->pc
168             $root->tour->[0]->urls->qr
169             $root->tour->[0]->hotel->[0]->city->code
170             $root->tour->[0]->hotel->[0]->city->name
171             $root->tour->[0]->price->all_month->min
172             $root->tour->[0]->price->all_month->max
173             $root->tour->[0]->sche->[0]->city->code
174             $root->tour->[0]->sche->[0]->city->name
175             $root->tour->[0]->sche->[0]->city->lat
176             $root->tour->[0]->sche->[0]->city->lng
177             $root->tour->[0]->sche->[0]->city->area
178             $root->tour->[0]->sche->[0]->city->country
179             $root->tour->[0]->sche->[0]->city->area->code
180             $root->tour->[0]->sche->[0]->city->area->name
181             $root->tour->[0]->sche->[0]->city->country->code
182             $root->tour->[0]->sche->[0]->city->country->name
183              
184              
185             =head2 xml
186              
187             This returns the raw response context itself.
188              
189             print $res->xml, "\n";
190              
191             =head2 code
192              
193             This returns the response status code.
194              
195             my $code = $res->code; # usually "200" when succeeded
196              
197             =head2 is_error
198              
199             This returns true value when the response has an error.
200              
201             die 'error!' if $res->is_error;
202              
203             =head1 SEE ALSO
204              
205             L
206              
207             =head1 AUTHOR
208              
209             RECRUIT Media Technology Labs
210              
211             =head1 COPYRIGHT
212              
213             Copyright 2008 RECRUIT Media Technology Labs
214              
215             =cut
216             1;