diff --git a/ramls/examples/external_patron.json b/ramls/examples/external_patron.json index fbf90b8..b96a6c4 100644 --- a/ramls/examples/external_patron.json +++ b/ramls/examples/external_patron.json @@ -6,15 +6,7 @@ "middleName": "M", "lastName": "Doe" }, - "address0": { - "addressLine0": "123 Main St", - "addressLine1": "Apt 4B", - "city": "Metropolis", - "province": "NY", - "zip": "12345", - "country": "USA" - }, - "address1": { + "address": { "addressLine0": "456 Side St", "addressLine1": "Suite 500", "city": "Metropolis", diff --git a/ramls/examples/external_patron_collection.json b/ramls/examples/external_patron_collection.json index a2d182d..822643e 100644 --- a/ramls/examples/external_patron_collection.json +++ b/ramls/examples/external_patron_collection.json @@ -8,7 +8,7 @@ "middleName": "Michael", "lastName": "Doe" }, - "address0": { + "address": { "addressLine0": "123 Main St", "addressLine1": "", "city": "Anytown", @@ -30,7 +30,7 @@ "preferredFirstName": "Janey", "lastName": "Smith" }, - "address0": { + "address": { "addressLine0": "456 Oak Ave", "addressLine1": "Apt 2B", "city": "Smallville", diff --git a/ramls/external_patron.json b/ramls/external_patron.json index 0c023b5..9a8de61 100644 --- a/ramls/external_patron.json +++ b/ramls/external_patron.json @@ -32,39 +32,7 @@ "required": ["externalSystemId", "firstName", "lastName"], "additionalProperties": false }, - "address0": { - "type": "object", - "description": "Primary address info of patron", - "properties": { - "addressLine0": { - "type": "string", - "description": "Address, Line 0" - }, - "addressLine1": { - "type": "string", - "description": "Address, Line 1" - }, - "city": { - "type": "string", - "description": "City name" - }, - "province": { - "type": "string", - "description": "Province" - }, - "zip": { - "type": "string", - "description": "Zip Code" - }, - "country": { - "type": "string", - "description": "Country" - } - }, - "required": ["addressLine0", "city", "province", "zip", "country"], - "additionalProperties": false - }, - "address1": { + "address": { "type": "object", "description": "Secondary address info of patron", "properties": { @@ -126,10 +94,9 @@ }, "minItems": 1, "maxItems": 3, - "uniqueItems": true, - "description": "Preferred email communication types" + "uniqueItems": true } }, - "required": ["generalInfo", "address0", "contactInfo", "preferredEmailCommunication"], + "required": ["generalInfo", "address", "contactInfo"], "additionalProperties": false } diff --git a/src/main/java/org/folio/edge/patron/model/Patron.java b/src/main/java/org/folio/edge/patron/model/Patron.java index c058f40..ed89597 100644 --- a/src/main/java/org/folio/edge/patron/model/Patron.java +++ b/src/main/java/org/folio/edge/patron/model/Patron.java @@ -18,22 +18,19 @@ @JsonDeserialize(builder = Patron.Builder.class) @JsonPropertyOrder({ "generalInfo", - "address0", - "address1", + "address", "contactInfo", "preferredEmailCommunication" }) public final class Patron { public final GeneralInfo generalInfo; - public final Address address0; - public final Address address1; + public final Address address; public final ContactInfo contactInfo; public final List preferredEmailCommunication; private Patron(Builder builder) { this.generalInfo = builder.generalInfo; - this.address0 = builder.address0; - this.address1 = builder.address1; + this.address = builder.address; this.contactInfo = builder.contactInfo; this.preferredEmailCommunication = builder.preferredEmailCommunication; } @@ -46,11 +43,8 @@ public static class Builder { @JsonProperty("generalInfo") private GeneralInfo generalInfo; - @JsonProperty("address0") - private Address address0; - - @JsonProperty("address1") - private Address address1; + @JsonProperty("address") + private Address address; @JsonProperty("contactInfo") private ContactInfo contactInfo; @@ -63,13 +57,8 @@ public Builder generalInfo(GeneralInfo generalInfo) { return this; } - public Builder address0(Address address0) { - this.address0 = address0; - return this; - } - - public Builder address1(Address address1) { - this.address1 = address1; + public Builder address(Address address) { + this.address = address; return this; } diff --git a/src/test/java/org/folio/edge/patron/utils/PatronMockOkapi.java b/src/test/java/org/folio/edge/patron/utils/PatronMockOkapi.java index 7ceb37d..edaa063 100644 --- a/src/test/java/org/folio/edge/patron/utils/PatronMockOkapi.java +++ b/src/test/java/org/folio/edge/patron/utils/PatronMockOkapi.java @@ -661,8 +661,7 @@ public static Hold getHold(String itemId, Date holdReqDate) { public static Patron getPatron() { return Patron.builder() - .address0(new Patron.Address("fdsf","sds", "fsd", "dasd", "123", "sdsd")) - .address1(new Patron.Address("fdsf","sds", "fsd", "dasd", "123", "sdsd")) + .address(new Patron.Address("fdsf","sds", "fsd", "dasd", "123", "sdsd")) .contactInfo(new Patron.ContactInfo("342424","232321","fgh@mail")) .generalInfo(new Patron.GeneralInfo("1234","sds","a","s", "45")) .preferredEmailCommunication(new ArrayList<>())