File Coverage

blib/lib/WebService/Recruit/Akasugu/SmallCategory.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::Akasugu::SmallCategory;
2              
3 3     3   1179 use strict;
  3         5  
  3         106  
4 3     3   14 use base qw( WebService::Recruit::Akasugu::Base );
  3         3  
  3         210  
5 3     3   14 use vars qw( $VERSION );
  3         4  
  3         98  
6 3     3   14 use Class::Accessor::Fast;
  3         5  
  3         16  
7 3     3   73 use Class::Accessor::Children::Fast;
  3         7  
  3         14  
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/akasugu/small_category/v1/'; }
14              
15 1     1 1 35 sub query_class { 'WebService::Recruit::Akasugu::SmallCategory::Query'; }
16              
17             sub query_fields { [
18 3     3 0 36 'key', 'large_code', 'middle_code', 'small_code', 'keyword'
19             ]; }
20              
21             sub default_param { {
22 1     1 1 517 '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::Akasugu::SmallCategory::Element'; }
30              
31 3     3 1 35 sub root_elem { 'results'; }
32              
33             sub elem_fields { {
34 3     3 0 50 'error' => ['message'],
35             'large_category' => ['code', 'name'],
36             'middle_category' => ['code', 'name'],
37             'results' => ['api_version', 'results_available', 'results_returned', 'results_start', 'small_category', 'api_version', 'error'],
38             'small_category' => ['code', 'name', 'large_category', 'middle_category'],
39              
40             }; }
41              
42             sub force_array { [
43 0     0 1   'small_category'
44             ]; }
45              
46             # __PACKAGE__->mk_query_accessors();
47              
48             @WebService::Recruit::Akasugu::SmallCategory::Query::ISA = qw( Class::Accessor::Fast );
49             WebService::Recruit::Akasugu::SmallCategory::Query->mk_accessors( @{query_fields()} );
50              
51             # __PACKAGE__->mk_elem_accessors();
52              
53             @WebService::Recruit::Akasugu::SmallCategory::Element::ISA = qw( Class::Accessor::Children::Fast );
54             WebService::Recruit::Akasugu::SmallCategory::Element->mk_ro_accessors( root_elem() );
55             WebService::Recruit::Akasugu::SmallCategory::Element->mk_child_ro_accessors( %{elem_fields()} );
56              
57             =head1 NAME
58              
59             WebService::Recruit::Akasugu::SmallCategory - Akasugu.net Web Service "small_category" API
60              
61             =head1 SYNOPSIS
62              
63             use WebService::Recruit::Akasugu;
64            
65             my $service = WebService::Recruit::Akasugu->new();
66            
67             my $param = {
68             'key' => $ENV{'WEBSERVICE_RECRUIT_KEY'},
69             };
70             my $res = $service->small_category( %$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_category: $data->small_category\n";
77             print "...\n";
78              
79             =head1 DESCRIPTION
80              
81             This module is a interface for the C API.
82             It accepts following query parameters to make an request.
83              
84             my $param = {
85             'key' => 'XXXXXXXX',
86             'large_code' => '2',
87             'middle_code' => '211',
88             'small_code' => '211001',
89             'keyword' => 'ベビー',
90             };
91             my $res = $service->small_category( %$param );
92              
93             C<$service> above is an instance of L.
94              
95             =head1 METHODS
96              
97             =head2 root
98              
99             This returns the root element of the response.
100              
101             my $root = $res->root;
102              
103             You can retrieve each element by the following accessors.
104              
105             $root->api_version
106             $root->results_available
107             $root->results_returned
108             $root->results_start
109             $root->small_category
110             $root->small_category->[0]->code
111             $root->small_category->[0]->name
112             $root->small_category->[0]->large_category
113             $root->small_category->[0]->middle_category
114             $root->small_category->[0]->large_category->code
115             $root->small_category->[0]->large_category->name
116             $root->small_category->[0]->middle_category->code
117             $root->small_category->[0]->middle_category->name
118              
119              
120             =head2 xml
121              
122             This returns the raw response context itself.
123              
124             print $res->xml, "\n";
125              
126             =head2 code
127              
128             This returns the response status code.
129              
130             my $code = $res->code; # usually "200" when succeeded
131              
132             =head2 is_error
133              
134             This returns true value when the response has an error.
135              
136             die 'error!' if $res->is_error;
137              
138             =head1 SEE ALSO
139              
140             L
141              
142             =head1 AUTHOR
143              
144             RECRUIT Media Technology Labs
145              
146             =head1 COPYRIGHT
147              
148             Copyright 2008 RECRUIT Media Technology Labs
149              
150             =cut
151             1;