File Coverage

blib/lib/WebService/Recruit/HotPepper/MiddleArea.pm
Criterion Covered Total %
statement 12 16 75.0
branch n/a
condition n/a
subroutine 6 10 60.0
pod 5 7 71.4
total 23 33 69.7


line stmt bran cond sub pod time code
1             package WebService::Recruit::HotPepper::MiddleArea;
2 3     3   20 use strict;
  3         7  
  3         172  
3 3     3   18 use base qw( WebService::Recruit::HotPepper::Base );
  3         6  
  3         328  
4 3     3   18 use vars qw( $VERSION );
  3         6  
  3         1440  
5             $VERSION = '0.02';
6              
7 0     0 1 0 sub url { 'http://api.hotpepper.jp/MiddleArea/V110'; }
8 0     0 1 0 sub force_array { [qw( MiddleArea Error )]; }
9 0     0 1 0 sub elem_class { 'WebService::Recruit::HotPepper::MiddleArea::Element'; }
10 0     0 1 0 sub query_class { 'WebService::Recruit::HotPepper::MiddleArea::Query'; }
11              
12 3     3 0 41 sub query_fields { [qw(
13             key
14             MiddleAreaName MiddleAreaCD LargeAreaCD
15             )]; }
16 3     3 1 260 sub root_elem { 'Results'; }
17             sub elem_fields { {
18 3     3 0 40 Results => [qw(
19             NumberOfResults APIVersion
20             MiddleArea
21             )],
22             MiddleArea => [qw(
23             MiddleAreaCD MiddleAreaName LargeAreaCD
24             )],
25             }; }
26              
27             # __PACKAGE__->mk_query_accessors();
28              
29             @WebService::Recruit::HotPepper::MiddleArea::Query::ISA = qw( Class::Accessor::Fast );
30             WebService::Recruit::HotPepper::MiddleArea::Query->mk_accessors( @{query_fields()} );
31              
32             # __PACKAGE__->mk_elem_accessors();
33              
34             @WebService::Recruit::HotPepper::MiddleArea::Element::ISA = qw( Class::Accessor::Children::Fast );
35             WebService::Recruit::HotPepper::MiddleArea::Element->mk_ro_accessors( root_elem() );
36             WebService::Recruit::HotPepper::MiddleArea::Element->mk_child_ro_accessors( %{elem_fields()} );
37              
38             =head1 NAME
39              
40             WebService::Recruit::HotPepper::MiddleArea - HotPepper Web Service "MiddleArea" API
41              
42             =head1 SYNOPSIS
43              
44             use WebService::Recruit::HotPepper;
45              
46             my $api = WebService::Recruit::HotPepper->new();
47             $api->key( 'xxxxxxxxxxxxxxxx' );
48              
49             my $res = $api->MiddleArea();
50             die 'error!' if $res->is_error;
51              
52             my $list = $res->root->MiddleArea;
53             foreach my $area ( @$list ) {
54             print "name: ", $area->MiddleAreaName, "\n";
55             print "code: ", $area->MiddleAreaCD, "\n";
56             print "\n";
57             }
58              
59             =head1 DESCRIPTION
60              
61             This module is an interface for the C API.
62             It accepts following query parameters to make an request.
63              
64             my $res = $hpp->MiddleArea();
65              
66             C<$hpp> above is an instance of L.
67              
68             =head1 METHODS
69              
70             =head2 root
71              
72             This returns the root element of the response.
73              
74             my $root = $res->root;
75              
76             You can retrieve each element by the following accessors.
77              
78             $root->NumberOfResults;
79             $root->APIVersion;
80             $root->MiddleArea->[0]->MiddleAreaName;
81             $root->MiddleArea->[0]->MiddleAreaCD;
82             $root->MiddleArea->[0]->LargeAreaCD;
83              
84             =head2 xml
85              
86             This returns the raw response context itself.
87              
88             print $res->xml, "\n";
89              
90             =head2 code
91              
92             This returns the response status code.
93              
94             my $code = $res->code; # usually "200" when succeeded
95              
96             =head2 is_error
97              
98             This returns true value when the response has an error.
99              
100             die 'error!' if $res->is_error;
101              
102             =head1 SEE ALSO
103              
104             L
105              
106             =head1 AUTHOR
107              
108             Toshimasa Ishibashi L
109              
110             This module is unofficial and released by the author in person.
111              
112             =head1 THANKS TO
113              
114             Yusuke Kawasaki L
115              
116             For creating/preparing all the base modules and stuff.
117              
118             =head1 COPYRIGHT AND LICENSE
119              
120             Copyright (c) 2007 Toshimasa Ishibashi. All rights reserved.
121             This program is free software; you can redistribute it and/or
122             modify it under the same terms as Perl itself.
123              
124             =cut
125              
126             1;