| 1 | package WebService::Recruit::HotPepperBeauty::MiddleArea; | ||
| 2 | |||
| 3 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 3 | ▶ | use base qw( WebService::Recruit::HotPepperBeauty::Base ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 3 | ▶ | use vars qw( $VERSION ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 3 | ▶ | use Class::Accessor::Fast; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 3 | ▶ | use Class::Accessor::Children::Fast; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 3 | $VERSION = '0.0.1'; | |
| 10 | |||
| 11 | 0 | ▶ | sub http_method { 'GET'; } |
|
Subroutine
http_method: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 12 | |||
| 13 | 0 | ▶ | sub url { 'http://webservice.recruit.co.jp/beauty/middle_area/v1/'; } |
|
Subroutine
url: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 14 | |||
| 15 | 1 | ▶ | sub query_class { 'WebService::Recruit::HotPepperBeauty::MiddleArea::Query'; } |
|
Subroutine
query_class: called CC=1 SCAR=0.0
Pod
documented
| |||
| 16 | |||
| 17 | 3 | ▶ | sub query_fields { [ |
|
Subroutine
query_fields: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 18 | 3 | 'key', 'service_area', 'start', 'count' | |
| 19 | ]; } | ||
| 20 | |||
| 21 | 1 | ▶ | sub default_param { { |
|
Subroutine
default_param: called CC=1 SCAR=0.0
Pod
documented
| |||
| 22 | 1 | 'format' => 'xml' | |
| 23 | }; } | ||
| 24 | |||
| 25 | 0 | ▶ | sub notnull_param { [ |
|
Subroutine
notnull_param: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 26 | 0 | 'key' | |
| 27 | ]; } | ||
| 28 | |||
| 29 | 0 | ▶ | sub elem_class { 'WebService::Recruit::HotPepperBeauty::MiddleArea::Element'; } |
|
Subroutine
elem_class: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 30 | |||
| 31 | 3 | ▶ | sub root_elem { 'results'; } |
|
Subroutine
root_elem: called CC=1 SCAR=0.0
Pod
documented
| |||
| 32 | |||
| 33 | 3 | ▶ | sub elem_fields { { |
|
Subroutine
elem_fields: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 34 | 3 | 'error' => ['message'], | |
| 35 | 'middle_area' => ['code', 'name', 'service_area'], | ||
| 36 | 'results' => ['api_version', 'results_available', 'results_returned', 'results_start', 'middle_area', 'api_version', 'error'], | ||
| 37 | 'service_area' => ['code', 'name'], | ||
| 38 | |||
| 39 | }; } | ||
| 40 | |||
| 41 | 0 | ▶ | sub force_array { [ |
|
Subroutine
force_array: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 42 | 0 | 'middle_area' | |
| 43 | ]; } | ||
| 44 | |||
| 45 | # __PACKAGE__->mk_query_accessors(); | ||
| 46 | |||
| 47 | 3 | @WebService::Recruit::HotPepperBeauty::MiddleArea::Query::ISA = qw( Class::Accessor::Fast ); | |
| 48 | 3 | WebService::Recruit::HotPepperBeauty::MiddleArea::Query->mk_accessors( @{query_fields()} ); | |
| 49 | |||
| 50 | # __PACKAGE__->mk_elem_accessors(); | ||
| 51 | |||
| 52 | 3 | @WebService::Recruit::HotPepperBeauty::MiddleArea::Element::ISA = qw( Class::Accessor::Children::Fast ); | |
| 53 | 3 | WebService::Recruit::HotPepperBeauty::MiddleArea::Element->mk_ro_accessors( root_elem() ); | |
| 54 | 3 | WebService::Recruit::HotPepperBeauty::MiddleArea::Element->mk_child_ro_accessors( %{elem_fields()} ); | |
| 55 | |||
| 56 | =head1 NAME | ||
| 57 | |||
| 58 | WebService::Recruit::HotPepperBeauty::MiddleArea - HotPepperBeauty Web Service "middle_area" API | ||
| 59 | |||
| 60 | =head1 SYNOPSIS | ||
| 61 | |||
| 62 | use WebService::Recruit::HotPepperBeauty; | ||
| 63 | |||
| 64 | my $service = WebService::Recruit::HotPepperBeauty->new(); | ||
| 65 | |||
| 66 | my $param = { | ||
| 67 | 'key' => $ENV{'WEBSERVICE_RECRUIT_KEY'}, | ||
| 68 | }; | ||
| 69 | my $res = $service->middle_area( %$param ); | ||
| 70 | my $data = $res->root; | ||
| 71 | print "api_version: $data->api_version\n"; | ||
| 72 | print "results_available: $data->results_available\n"; | ||
| 73 | print "results_returned: $data->results_returned\n"; | ||
| 74 | print "results_start: $data->results_start\n"; | ||
| 75 | print "middle_area: $data->middle_area\n"; | ||
| 76 | print "...\n"; | ||
| 77 | |||
| 78 | =head1 DESCRIPTION | ||
| 79 | |||
| 80 | This module is a interface for the C<middle_area> API. | ||
| 81 | It accepts following query parameters to make an request. | ||
| 82 | |||
| 83 | my $param = { | ||
| 84 | 'key' => 'XXXXXXXX', | ||
| 85 | 'service_area' => 'SA', | ||
| 86 | 'start' => 'XXXXXXXX', | ||
| 87 | 'count' => 'XXXXXXXX', | ||
| 88 | }; | ||
| 89 | my $res = $service->middle_area( %$param ); | ||
| 90 | |||
| 91 | C<$service> above is an instance of L<WebService::Recruit::HotPepperBeauty>. | ||
| 92 | |||
| 93 | =head1 METHODS | ||
| 94 | |||
| 95 | =head2 root | ||
| 96 | |||
| 97 | This returns the root element of the response. | ||
| 98 | |||
| 99 | my $root = $res->root; | ||
| 100 | |||
| 101 | You can retrieve each element by the following accessors. | ||
| 102 | |||
| 103 | $root->api_version | ||
| 104 | $root->results_available | ||
| 105 | $root->results_returned | ||
| 106 | $root->results_start | ||
| 107 | $root->middle_area | ||
| 108 | $root->middle_area->[0]->code | ||
| 109 | $root->middle_area->[0]->name | ||
| 110 | $root->middle_area->[0]->service_area | ||
| 111 | $root->middle_area->[0]->service_area->code | ||
| 112 | $root->middle_area->[0]->service_area->name | ||
| 113 | |||
| 114 | |||
| 115 | =head2 xml | ||
| 116 | |||
| 117 | This returns the raw response context itself. | ||
| 118 | |||
| 119 | print $res->xml, "\n"; | ||
| 120 | |||
| 121 | =head2 code | ||
| 122 | |||
| 123 | This returns the response status code. | ||
| 124 | |||
| 125 | my $code = $res->code; # usually "200" when succeeded | ||
| 126 | |||
| 127 | =head2 is_error | ||
| 128 | |||
| 129 | This returns true value when the response has an error. | ||
| 130 | |||
| 131 | die 'error!' if $res->is_error; | ||
| 132 | |||
| 133 | =head1 SEE ALSO | ||
| 134 | |||
| 135 | L<WebService::Recruit::HotPepperBeauty> | ||
| 136 | |||
| 137 | =head1 AUTHOR | ||
| 138 | |||
| 139 | RECRUIT Media Technology Labs <mtl@cpan.org> | ||
| 140 | |||
| 141 | =head1 COPYRIGHT | ||
| 142 | |||
| 143 | Copyright 2008 RECRUIT Media Technology Labs | ||
| 144 | |||
| 145 | =cut | ||
| 146 | 3 | 1; | |