File Coverage

blib/lib/WebService/Recruit/AbRoad/TourTally.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::TourTally;
2              
3 3     3   1445 use strict;
  3         7  
  3         116  
4 3     3   17 use base qw( WebService::Recruit::AbRoad::Base );
  3         5  
  3         245  
5 3     3   18 use vars qw( $VERSION );
  3         6  
  3         119  
6 3     3   14 use Class::Accessor::Fast;
  3         5  
  3         19  
7 3     3   74 use Class::Accessor::Children::Fast;
  3         15  
  3         17  
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_tally/v1/'; }
14              
15 1     1 1 45 sub query_class { 'WebService::Recruit::AbRoad::TourTally::Query'; }
16              
17             sub query_fields { [
18 3     3 0 190 'key', 'keyword', 'dept', 'ym', 'ymd', 'price_min', 'price_max', 'term_min', 'term_max', 'airline', 'kodaw', 'axis', 'order', 'start', 'count'
19             ]; }
20              
21             sub default_param { {
22 1     1 1 509 'format' => 'xml'
23             }; }
24              
25             sub notnull_param { [
26 0     0 1 0 'key', 'keyword'
27             ]; }
28              
29 0     0 1 0 sub elem_class { 'WebService::Recruit::AbRoad::TourTally::Element'; }
30              
31 3     3 1 34 sub root_elem { 'results'; }
32              
33             sub elem_fields { {
34 3     3 0 56 'area' => ['code', 'name'],
35             'country' => ['code', 'name'],
36             'error' => ['message'],
37             'results' => ['api_version', 'results_available', 'results_returned', 'results_start', 'tour_tally', 'api_version', 'error'],
38             'tour_tally' => ['type', 'code', 'name', 'tour_count', 'lat', 'lng', 'area', 'country'],
39              
40             }; }
41              
42             sub force_array { [
43 0     0 1   'tour_tally'
44             ]; }
45              
46             # __PACKAGE__->mk_query_accessors();
47              
48             @WebService::Recruit::AbRoad::TourTally::Query::ISA = qw( Class::Accessor::Fast );
49             WebService::Recruit::AbRoad::TourTally::Query->mk_accessors( @{query_fields()} );
50              
51             # __PACKAGE__->mk_elem_accessors();
52              
53             @WebService::Recruit::AbRoad::TourTally::Element::ISA = qw( Class::Accessor::Children::Fast );
54             WebService::Recruit::AbRoad::TourTally::Element->mk_ro_accessors( root_elem() );
55             WebService::Recruit::AbRoad::TourTally::Element->mk_child_ro_accessors( %{elem_fields()} );
56              
57             =head1 NAME
58              
59             WebService::Recruit::AbRoad::TourTally - AB-ROAD Web Service "tour_tally" API
60              
61             =head1 SYNOPSIS
62              
63             use WebService::Recruit::AbRoad;
64            
65             my $service = WebService::Recruit::AbRoad->new();
66            
67             my $param = {
68             'key' => $ENV{'WEBSERVICE_RECRUIT_KEY'},
69             'keyword' => '登山',
70             };
71             my $res = $service->tour_tally( %$param );
72             my $data = $res->root;
73             print "api_version: $data->api_version\n";
74             print "results_available: $data->results_available\n";
75             print "results_returned: $data->results_returned\n";
76             print "results_start: $data->results_start\n";
77             print "tour_tally: $data->tour_tally\n";
78             print "...\n";
79              
80             =head1 DESCRIPTION
81              
82             This module is a interface for the C API.
83             It accepts following query parameters to make an request.
84              
85             my $param = {
86             'key' => 'XXXXXXXX',
87             'keyword' => '登山',
88             'dept' => 'XXXXXXXX',
89             'ym' => 'XXXXXXXX',
90             'ymd' => 'XXXXXXXX',
91             'price_min' => 'XXXXXXXX',
92             'price_max' => 'XXXXXXXX',
93             'term_min' => 'XXXXXXXX',
94             'term_max' => 'XXXXXXXX',
95             'airline' => 'XXXXXXXX',
96             'kodaw' => 'XXXXXXXX',
97             'axis' => 'XXXXXXXX',
98             'order' => 'XXXXXXXX',
99             'start' => 'XXXXXXXX',
100             'count' => 'XXXXXXXX',
101             };
102             my $res = $service->tour_tally( %$param );
103              
104             C<$service> above is an instance of L.
105              
106             =head1 METHODS
107              
108             =head2 root
109              
110             This returns the root element of the response.
111              
112             my $root = $res->root;
113              
114             You can retrieve each element by the following accessors.
115              
116             $root->api_version
117             $root->results_available
118             $root->results_returned
119             $root->results_start
120             $root->tour_tally
121             $root->tour_tally->[0]->type
122             $root->tour_tally->[0]->code
123             $root->tour_tally->[0]->name
124             $root->tour_tally->[0]->tour_count
125             $root->tour_tally->[0]->lat
126             $root->tour_tally->[0]->lng
127             $root->tour_tally->[0]->area
128             $root->tour_tally->[0]->country
129             $root->tour_tally->[0]->area->code
130             $root->tour_tally->[0]->area->name
131             $root->tour_tally->[0]->country->code
132             $root->tour_tally->[0]->country->name
133              
134              
135             =head2 xml
136              
137             This returns the raw response context itself.
138              
139             print $res->xml, "\n";
140              
141             =head2 code
142              
143             This returns the response status code.
144              
145             my $code = $res->code; # usually "200" when succeeded
146              
147             =head2 is_error
148              
149             This returns true value when the response has an error.
150              
151             die 'error!' if $res->is_error;
152              
153             =head1 SEE ALSO
154              
155             L
156              
157             =head1 AUTHOR
158              
159             RECRUIT Media Technology Labs
160              
161             =head1 COPYRIGHT
162              
163             Copyright 2008 RECRUIT Media Technology Labs
164              
165             =cut
166             1;