Lines 79-85
sub get {
Link Here
|
79 |
openapi => { error => "Library not found" } ); |
79 |
openapi => { error => "Library not found" } ); |
80 |
} |
80 |
} |
81 |
|
81 |
|
82 |
return $c->render( status => 200, openapi => _to_api( $library->TO_JSON ) ); |
82 |
return $c->render( |
|
|
83 |
status => 200, |
84 |
openapi => $library->to_api |
85 |
); |
83 |
} |
86 |
} |
84 |
|
87 |
|
85 |
=head3 add |
88 |
=head3 add |
Lines 95-101
sub add {
Link Here
|
95 |
my $library = Koha::Library->new( _to_model( $c->validation->param('body') ) ); |
98 |
my $library = Koha::Library->new( _to_model( $c->validation->param('body') ) ); |
96 |
$library->store; |
99 |
$library->store; |
97 |
$c->res->headers->location( $c->req->url->to_string . '/' . $library->branchcode ); |
100 |
$c->res->headers->location( $c->req->url->to_string . '/' . $library->branchcode ); |
98 |
return $c->render( status => 201, openapi => _to_api( $library->TO_JSON ) ); |
101 |
|
|
|
102 |
return $c->render( |
103 |
status => 201, |
104 |
openapi => $library->to_api |
105 |
); |
99 |
} |
106 |
} |
100 |
catch { |
107 |
catch { |
101 |
unless ( blessed $_ && $_->can('rethrow') ) { |
108 |
unless ( blessed $_ && $_->can('rethrow') ) { |
Lines 141-147
sub update {
Link Here
|
141 |
my $params = $c->req->json; |
148 |
my $params = $c->req->json; |
142 |
$library->set( _to_model($params) ); |
149 |
$library->set( _to_model($params) ); |
143 |
$library->store(); |
150 |
$library->store(); |
144 |
return $c->render( status => 200, openapi => _to_api($library->TO_JSON) ); |
151 |
return $c->render( |
|
|
152 |
status => 200, |
153 |
openapi => $library->to_api |
154 |
); |
145 |
} |
155 |
} |
146 |
catch { |
156 |
catch { |
147 |
unless ( blessed $_ && $_->can('rethrow') ) { |
157 |
unless ( blessed $_ && $_->can('rethrow') ) { |
148 |
- |
|
|