File Coverage

blib/lib/WebService/Recruit/HotPepperBeauty/Salon.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::HotPepperBeauty::Salon;
2              
3 3     3   982 use strict;
  3         6  
  3         124  
4 3     3   16 use base qw( WebService::Recruit::HotPepperBeauty::Base );
  3         5  
  3         1874  
5 3     3   18 use vars qw( $VERSION );
  3         5  
  3         120  
6 3     3   16 use Class::Accessor::Fast;
  3         4  
  3         23  
7 3     3   67 use Class::Accessor::Children::Fast;
  3         5  
  3         11  
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/beauty/salon/v1/'; }
14              
15 1     1 1 50 sub query_class { 'WebService::Recruit::HotPepperBeauty::Salon::Query'; }
16              
17             sub query_fields { [
18 3     3 0 63 'key', 'id', 'name', 'name_kana', 'address', 'service_area', 'middle_area', 'small_area', 'keyword', 'lat', 'lng', 'range', 'datum', 'hair_image', 'hair_length', 'hair_ryou', 'hair_shitsu', 'hair_futosa', 'hair_kuse', 'hair_kaogata', 'kodawari', 'kodawari_setsubi', 'kodawari_menu', 'order', 'start', 'count'
19             ]; }
20              
21             sub default_param { {
22 1     1 1 902 '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::HotPepperBeauty::Salon::Element'; }
30              
31 3     3 1 37 sub root_elem { 'results'; }
32              
33             sub elem_fields { {
34 3     3 0 104 'coupon_urls' => ['pc'],
35             'error' => ['message'],
36             'feature' => ['name', 'caption', 'description'],
37             'main' => ['photo', 'caption'],
38             'middle_area' => ['code', 'name'],
39             'mood' => ['photo', 'caption'],
40             'photo' => ['s', 'm', 'l'],
41             'results' => ['api_version', 'results_available', 'results_returned', 'results_start', 'salon', 'api_version', 'error'],
42             'salon' => ['id', 'last_update', 'name', 'name_kana', 'urls', 'coupon_urls', 'address', 'service_area', 'middle_area', 'small_area', 'open', 'close', 'credit_card', 'price', 'stylist_num', 'capacity', 'parking', 'note', 'kodawari', 'lat', 'lng', 'catch_copy', 'description', 'main', 'mood', 'feature'],
43             'service_area' => ['code', 'name'],
44             'small_area' => ['code', 'name'],
45             'urls' => ['pc'],
46              
47             }; }
48              
49             sub force_array { [
50 0     0 1   'feature', 'mood', 'salon'
51             ]; }
52              
53             # __PACKAGE__->mk_query_accessors();
54              
55             @WebService::Recruit::HotPepperBeauty::Salon::Query::ISA = qw( Class::Accessor::Fast );
56             WebService::Recruit::HotPepperBeauty::Salon::Query->mk_accessors( @{query_fields()} );
57              
58             # __PACKAGE__->mk_elem_accessors();
59              
60             @WebService::Recruit::HotPepperBeauty::Salon::Element::ISA = qw( Class::Accessor::Children::Fast );
61             WebService::Recruit::HotPepperBeauty::Salon::Element->mk_ro_accessors( root_elem() );
62             WebService::Recruit::HotPepperBeauty::Salon::Element->mk_child_ro_accessors( %{elem_fields()} );
63              
64             =head1 NAME
65              
66             WebService::Recruit::HotPepperBeauty::Salon - HotPepperBeauty Web Service "salon" API
67              
68             =head1 SYNOPSIS
69              
70             use WebService::Recruit::HotPepperBeauty;
71            
72             my $service = WebService::Recruit::HotPepperBeauty->new();
73            
74             my $param = {
75             'key' => $ENV{'WEBSERVICE_RECRUIT_KEY'},
76             'name' => 'サロン',
77             'order' => '3',
78             };
79             my $res = $service->salon( %$param );
80             my $data = $res->root;
81             print "api_version: $data->api_version\n";
82             print "results_available: $data->results_available\n";
83             print "results_returned: $data->results_returned\n";
84             print "results_start: $data->results_start\n";
85             print "salon: $data->salon\n";
86             print "...\n";
87              
88             =head1 DESCRIPTION
89              
90             This module is a interface for the C API.
91             It accepts following query parameters to make an request.
92              
93             my $param = {
94             'key' => 'XXXXXXXX',
95             'id' => 'H0123456789',
96             'name' => 'XXXXXXXX',
97             'name_kana' => 'XXXXXXXX',
98             'address' => 'XXXXXXXX',
99             'service_area' => 'SA',
100             'middle_area' => 'AAAA',
101             'small_area' => 'X001',
102             'keyword' => 'XXXXXXXX',
103             'lat' => '35.669220',
104             'lng' => '139.761457',
105             'range' => 'XXXXXXXX',
106             'datum' => 'world',
107             'hair_image' => '2',
108             'hair_length' => '5',
109             'hair_ryou' => 'XXXXXXXX',
110             'hair_shitsu' => 'XXXXXXXX',
111             'hair_futosa' => 'XXXXXXXX',
112             'hair_kuse' => 'XXXXXXXX',
113             'hair_kaogata' => 'XXXXXXXX',
114             'kodawari' => '4',
115             'kodawari_setsubi' => '2',
116             'kodawari_menu' => '3',
117             'order' => 'XXXXXXXX',
118             'start' => 'XXXXXXXX',
119             'count' => 'XXXXXXXX',
120             };
121             my $res = $service->salon( %$param );
122              
123             C<$service> above is an instance of L.
124              
125             =head1 METHODS
126              
127             =head2 root
128              
129             This returns the root element of the response.
130              
131             my $root = $res->root;
132              
133             You can retrieve each element by the following accessors.
134              
135             $root->api_version
136             $root->results_available
137             $root->results_returned
138             $root->results_start
139             $root->salon
140             $root->salon->[0]->id
141             $root->salon->[0]->last_update
142             $root->salon->[0]->name
143             $root->salon->[0]->name_kana
144             $root->salon->[0]->urls
145             $root->salon->[0]->coupon_urls
146             $root->salon->[0]->address
147             $root->salon->[0]->service_area
148             $root->salon->[0]->middle_area
149             $root->salon->[0]->small_area
150             $root->salon->[0]->open
151             $root->salon->[0]->close
152             $root->salon->[0]->credit_card
153             $root->salon->[0]->price
154             $root->salon->[0]->stylist_num
155             $root->salon->[0]->capacity
156             $root->salon->[0]->parking
157             $root->salon->[0]->note
158             $root->salon->[0]->kodawari
159             $root->salon->[0]->lat
160             $root->salon->[0]->lng
161             $root->salon->[0]->catch_copy
162             $root->salon->[0]->description
163             $root->salon->[0]->main
164             $root->salon->[0]->mood
165             $root->salon->[0]->feature
166             $root->salon->[0]->urls->pc
167             $root->salon->[0]->coupon_urls->pc
168             $root->salon->[0]->service_area->code
169             $root->salon->[0]->service_area->name
170             $root->salon->[0]->middle_area->code
171             $root->salon->[0]->middle_area->name
172             $root->salon->[0]->small_area->code
173             $root->salon->[0]->small_area->name
174             $root->salon->[0]->main->photo
175             $root->salon->[0]->main->caption
176             $root->salon->[0]->mood->[0]->photo
177             $root->salon->[0]->mood->[0]->caption
178             $root->salon->[0]->feature->[0]->name
179             $root->salon->[0]->feature->[0]->caption
180             $root->salon->[0]->feature->[0]->description
181             $root->salon->[0]->main->photo->s
182             $root->salon->[0]->main->photo->m
183             $root->salon->[0]->main->photo->l
184              
185              
186             =head2 xml
187              
188             This returns the raw response context itself.
189              
190             print $res->xml, "\n";
191              
192             =head2 code
193              
194             This returns the response status code.
195              
196             my $code = $res->code; # usually "200" when succeeded
197              
198             =head2 is_error
199              
200             This returns true value when the response has an error.
201              
202             die 'error!' if $res->is_error;
203              
204             =head1 SEE ALSO
205              
206             L
207              
208             =head1 AUTHOR
209              
210             RECRUIT Media Technology Labs
211              
212             =head1 COPYRIGHT
213              
214             Copyright 2008 RECRUIT Media Technology Labs
215              
216             =cut
217             1;