Bug 17932: (followup) Fix /patrons endpoint
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 23 Jan 2017 12:47:54 +0000 (09:47 -0300)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 17 Feb 2017 15:33:00 +0000 (15:33 +0000)
commit39d090a8b6ecb2c97197f839a05c930a36ea6504
treeda8c09f9cb2aa73ce09533357e69ae5c8175f955
parent51f62ccb302e02b04ca608d382ce343ffd18726e
Bug 17932: (followup) Fix /patrons endpoint

Bug 17927 introduced data type fixes on the /patrons endpoint (integer
and boolean types got fixed). This led to the /patrons endpoint not to
work because the underlying code didn't provide the right data.

With the introduction of TO_JSON on Koha::Object(s) we now have a way to
output the proper data types.

This patch does so by:
- Adding is_boolean => 1 to the relevant columns on the Borrower.pm
  schema file.
- Tweaking the controller class for the /patrons endpoint so it doesn't
  use the $object(s)->unblessed call but just let the Mojo::JSON library
  pick out TO_JSON implementation instead on rendering the output.
- It adds a new test for booleans.

To test:
- Have 17927 applied
- Run:
  $ prove t/db_dependent/api/v1/patrons.t
=> FAIL: Tests fail [1]
- Apply this patches
- Run:
  $ prove t/db_dependent/api/v1/patrons.t
=> SUCCESS: Tests pass!
- Sign off! :-D

[1] It is self explanatory to just try the API using any of the
available tools (I use HttpRequester on Firefox)

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Koha/REST/V1/Patron.pm
Koha/Schema/Result/Borrower.pm
t/db_dependent/api/v1/patrons.t