File Coverage

blib/lib/WebService/Recruit/Eyeco/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::Eyeco::SmallCategory;
2              
3 3     3   1201 use strict;
  3         6  
  3         157  
4 3     3   14 use base qw( WebService::Recruit::Eyeco::Base );
  3         5  
  3         232  
5 3     3   14 use vars qw( $VERSION );
  3         87  
  3         113  
6 3     3   22 use Class::Accessor::Fast;
  3         6  
  3         19  
7 3     3   90 use Class::Accessor::Children::Fast;
  3         6  
  3         18  
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/eyeco/small_category/v1/'; }
14              
15 1     1 1 37 sub query_class { 'WebService::Recruit::Eyeco::SmallCategory::Query'; }
16              
17             sub query_fields { [
18 3     3 0 38 'key', 'large_code', 'small_code', 'keyword'
19             ]; }
20              
21             sub default_param { {
22 1     1 1 491 '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::Eyeco::SmallCategory::Element'; }
30              
31 3     3 1 34 sub root_elem { 'results'; }
32              
33             sub elem_fields { {
34 3     3 0 44 'error' => ['message'],
35             'large_category' => ['code', 'name'],
36             'results' => ['api_version', 'results_available', 'results_returned', 'results_start', 'small_category', 'api_version', 'error'],
37             'small_category' => ['code', 'name', 'large_category'],
38              
39             }; }
40              
41             sub force_array { [
42 0     0 1   'small_category'
43             ]; }
44              
45             # __PACKAGE__->mk_query_accessors();
46              
47             @WebService::Recruit::Eyeco::SmallCategory::Query::ISA = qw( Class::Accessor::Fast );
48             WebService::Recruit::Eyeco::SmallCategory::Query->mk_accessors( @{query_fields()} );
49              
50             # __PACKAGE__->mk_elem_accessors();
51              
52             @WebService::Recruit::Eyeco::SmallCategory::Element::ISA = qw( Class::Accessor::Children::Fast );
53             WebService::Recruit::Eyeco::SmallCategory::Element->mk_ro_accessors( root_elem() );
54             WebService::Recruit::Eyeco::SmallCategory::Element->mk_child_ro_accessors( %{elem_fields()} );
55              
56             =head1 NAME
57              
58             WebService::Recruit::Eyeco::SmallCategory - Eyeco Web Service "small_category" API
59              
60             =head1 SYNOPSIS
61              
62             use WebService::Recruit::Eyeco;
63            
64             my $service = WebService::Recruit::Eyeco->new();
65            
66             my $param = {
67             'key' => $ENV{'WEBSERVICE_RECRUIT_KEY'},
68             };
69             my $res = $service->small_category( %$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 "small_category: $data->small_category\n";
76             print "...\n";
77              
78             =head1 DESCRIPTION
79              
80             This module is a interface for the C API.
81             It accepts following query parameters to make an request.
82              
83             my $param = {
84             'key' => 'XXXXXXXX',
85             'large_code' => '102',
86             'small_code' => '102004',
87             'keyword' => 'ベビー',
88             };
89             my $res = $service->small_category( %$param );
90              
91             C<$service> above is an instance of L.
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->small_category
108             $root->small_category->[0]->code
109             $root->small_category->[0]->name
110             $root->small_category->[0]->large_category
111             $root->small_category->[0]->large_category->code
112             $root->small_category->[0]->large_category->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
136              
137             =head1 AUTHOR
138              
139             RECRUIT Media Technology Labs
140              
141             =head1 COPYRIGHT
142              
143             Copyright 2008 RECRUIT Media Technology Labs
144              
145             =cut
146             1;