$object->{capabilities} = $self->capabilities;
}
# Augment the request response with library details if appropriate
- if ( $embed->{branch} ) {
- $object->{branch} = Koha::Libraries->find(
+ if ( $embed->{library} ) {
+ $object->{library} = Koha::Libraries->find(
$self->branchcode
)->TO_JSON;
}
undef, '%embed not passed, no \'metadata\' attribute' );
is( $illreq_json->{capabilities},
undef, '%embed not passed, no \'capabilities\' attribute' );
- is( $illreq_json->{branch},
- undef, '%embed not passed, no \'branch\' attribute' );
+ is( $illreq_json->{library},
+ undef, '%embed not passed, no \'library\' attribute' );
$illreq_json = $illreq->TO_JSON(
- { patron => 1, metadata => 1, capabilities => 1, branch => 1 } );
+ { patron => 1, metadata => 1, capabilities => 1, library => 1 } );
is( $illreq_json->{patron}->{firstname},
$patron->firstname,
'%embed passed, \'patron\' attribute correct (firstname)' );
'metawhat?', '%embed passed, \'metadata\' attribute correct' );
is( $illreq_json->{capabilities},
'capable', '%embed passed, \'capabilities\' attribute correct' );
- is( $illreq_json->{branch}->{branchcode},
- $library->branchcode, '%embed not passed, no \'branch\' attribute' );
+ is( $illreq_json->{library}->{branchcode},
+ $library->branchcode, '%embed not passed, no \'library\' attribute' );
$schema->storage->txn_rollback;
};
# One illrequest created, returned with augmented data
$tx = $t->ua->build_tx( GET =>
- '/api/v1/illrequests?embed=patron,branch,capabilities,metadata' );
+ '/api/v1/illrequests?embed=patron,library,capabilities,metadata' );
$tx->req->cookies( { name => 'CGISESSID', value => $session_id } );
$tx->req->env( { REMOTE_ADDR => $remote_address } );
$t->request_ok($tx)->status_is(200)->json_is(
[
$illrequest->TO_JSON(
- { patron => 1, branch => 1, capabilities => 1, metadata => 1 }
+ { patron => 1, library => 1, capabilities => 1, metadata => 1 }
)
]
);