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