diff --git a/README.md b/README.md index ae8302b..a282b7f 100644 --- a/README.md +++ b/README.md @@ -45,12 +45,12 @@ You'll need to add api `key` and `CHANNEL` values to environment variables `THRE THRESHR_KEY=BatKey THRESHR_CHANNEL=WEB ``` - +> :warning: Environment Variables on windows must be assigned as an environment variable, ie `$env:foo`.
How to find a key for the redsky api
## Usage @@ -59,7 +59,6 @@ Threshr doesn't support all redsky endpoints (not yet). There are three endpoint ```java List fetchProductSummaries(TargetStore targetStore, Tcin tcin); - List fetchProductSummaries(TargetStore targetStore, String... tcin) throws ThreshrException; ``` ```java @@ -67,34 +66,14 @@ Product fetchProductDetails(TargetStore targetStore, String tcin); ``` ```java NearbyStores queryStoreLocations(Place place); // default values for limit and within - NearbyStores queryStoreLocations(int limit, int within, Place place); ``` - -### Using threshr pojo's - -```java -/** - * Queries the availability of products at a target store. - * - * @param store location to query - * @param tcin one or more target product item numbers as string values - * - * returns a set of boolean values reflecting a product's availability. - */ -public Set isProductInStock(TargetStore store, String ... tcin) { - ProductSummary summary = threshr.fetchProductSummaries(store, tcin); - return summary().stream().map(it -> - it.fulfillment().soldOut()) - .collect(Collectors.toSet()); -} -``` ___ ### Want to get involved? -See our [contributing] doc before taking a whack at any [open issues]. We'd love for you to work with us! +See our [contributing] doc before taking a whack at any [open issues]. Also be sure to read the [Testing README](src/test/groovy/com/graqr/threshr/README.md) for some tips and tricks. We'd love for you to work with us! [these instructions]:https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry diff --git a/images/redsky_network-tab_firefox.gif b/media/redsky_network-tab_firefox.gif similarity index 100% rename from images/redsky_network-tab_firefox.gif rename to media/redsky_network-tab_firefox.gif diff --git a/src/main/java/com/graqr/threshr/Threshr.java b/src/main/java/com/graqr/threshr/Threshr.java index 737329b..d8c8c2a 100644 --- a/src/main/java/com/graqr/threshr/Threshr.java +++ b/src/main/java/com/graqr/threshr/Threshr.java @@ -4,27 +4,36 @@ import com.graqr.threshr.model.queryparam.TargetStore; import com.graqr.threshr.model.queryparam.TargetStorePdpSearch; import com.graqr.threshr.model.queryparam.Tcin; -import com.graqr.threshr.model.redsky.products.Product; -import com.graqr.threshr.model.redsky.products.ProductSummary; -import com.graqr.threshr.model.redsky.stores.NearbyStores; +import com.graqr.threshr.model.redsky.product.Product; +import com.graqr.threshr.model.redsky.product.ProductSummary; +import com.graqr.threshr.model.redsky.store.NearbyStore; import io.micronaut.core.async.annotation.SingleResult; +import io.micronaut.http.HttpResponse; import io.micronaut.http.annotation.Controller; import io.micronaut.http.annotation.Get; import jakarta.inject.Inject; +import lombok.Getter; +import lombok.Setter; import java.util.List; -import java.util.Objects; @Controller() public class Threshr { + @Setter + @Getter + private String channel = "WEB"; + @Inject ThreshrClient threshrClient; + @Get("/product/summary-with-fulfillment") @SingleResult - public List fetchProductSummaries(TargetStore targetStore, Tcin tcin) { - return Objects.requireNonNull(threshrClient.productSummaryWithFulfillment(targetStore, tcin).body()).data().productSummary(); + public List fetchProductSummaries(TargetStore targetStore, Tcin tcin) throws ThreshrException { + return checkForNull(threshrClient.getProductSummary(targetStore, tcin)) + .data() + .productSummary(); } @Get("/product/summary-with-fulfillment") @@ -35,20 +44,33 @@ public List fetchProductSummaries(TargetStore targetStore, Strin @Get("/product/details") @SingleResult - public Product fetchProductDetails(TargetStore targetStore, String tcin) { - return Objects.requireNonNull(threshrClient.productDetails(new TargetStorePdpSearch(targetStore), tcin).body()).data().product(); + public Product fetchProductDetails(TargetStore targetStore, String tcin) throws ThreshrException { + return checkForNull(threshrClient.getProductDetails(new TargetStorePdpSearch(targetStore), tcin)) + .data() + .product(); } @Get("/stores/locations-query") @SingleResult - public NearbyStores queryStoreLocations(Place place) { + public NearbyStore queryStoreLocations(Place place) throws ThreshrException { return queryStoreLocations(5, 100, place); } @Get("/stores/locations-query") @SingleResult - public NearbyStores queryStoreLocations(int limit, int within, Place place) { - return Objects.requireNonNull(threshrClient.queryNearbyStores(limit, within, place.getPlace()).body()).data().nearbyStores(); + public NearbyStore queryStoreLocations(int limit, int within, Place place) throws ThreshrException { + return checkForNull(threshrClient.getNearbyStores(limit, within, place.getPlace())) + .data() + .nearbyStores(); } + private T checkForNull(HttpResponse response) throws ThreshrException { + if (null == response.body()) { + throw new ThreshrException(String.format("response body of HttpResponse<%s> is null", response + .body() + .getClass() + .getName())); + } + return response.body(); + } } \ No newline at end of file diff --git a/src/main/java/com/graqr/threshr/ThreshrClient.java b/src/main/java/com/graqr/threshr/ThreshrClient.java index 03ed3c7..4bcfdbe 100644 --- a/src/main/java/com/graqr/threshr/ThreshrClient.java +++ b/src/main/java/com/graqr/threshr/ThreshrClient.java @@ -1,12 +1,12 @@ package com.graqr.threshr; -import com.graqr.threshr.model.queryparam.Place; import com.graqr.threshr.model.queryparam.TargetStore; import com.graqr.threshr.model.queryparam.TargetStorePdpSearch; import com.graqr.threshr.model.queryparam.Tcin; -import com.graqr.threshr.model.redsky.products.pdp.client.PdpClientRoot; -import com.graqr.threshr.model.redsky.products.summary.ProductSummaryRoot; -import com.graqr.threshr.model.redsky.stores.NearbyStoresRoot; +import com.graqr.threshr.model.redsky.product.pdp.client.PdpClientRoot; +import com.graqr.threshr.model.redsky.product.summary.ProductSummaryRoot; +import com.graqr.threshr.model.redsky.store.location.StoreLocationRoot; +import com.graqr.threshr.model.redsky.store.nearby.NearbyStoreRoot; import io.micronaut.http.HttpResponse; import io.micronaut.http.annotation.Get; import io.micronaut.http.annotation.Header; @@ -39,7 +39,6 @@ @Header(name = ACCEPT, value = "application/vnd.github.v3+json, application/json") interface ThreshrClient { - /** * Queries target's product summaries from of the given tcins at a given target store. * A product summary does not include pricing. @@ -54,7 +53,7 @@ interface ThreshrClient { "{&tcins*}" + "{&targetStore*}" + "&CHANNEL=${threshr.channel}") - HttpResponse productSummaryWithFulfillment( + HttpResponse getProductSummary( TargetStore targetStore, Tcin tcins); @@ -67,7 +66,7 @@ HttpResponse productSummaryWithFulfillment( "?key=${threshr.key}" + "{&tcin}" + "{&targetStorePdpSearch*}") - HttpResponse productDetails( + HttpResponse getProductDetails( TargetStorePdpSearch targetStorePdpSearch, @Pattern(regexp = "(\\d{8})|(\\d{9})") String tcin); @@ -88,5 +87,16 @@ HttpResponse productDetails( "{&within}" + "{&place}" + "&CHANNEL=${threshr.channel}") - HttpResponse queryNearbyStores(int limit, int within, String place); + HttpResponse getNearbyStores(int limit, int within, String place); + + /** + * Get Store Information (ie store hours) for a specific Target Store + * @return Store object, generally with more information about the store than other store endpoints. + */ + @Get("store_location_v1" + + "?key=${threshr.key}" + + "{&storeId}" + + "{&channel}") + HttpResponse getStoreInformation(String storeId, String channel, String page); + } \ No newline at end of file diff --git a/src/main/java/com/graqr/threshr/model/queryparam/Page.java b/src/main/java/com/graqr/threshr/model/queryparam/Page.java new file mode 100644 index 0000000..5c2acd5 --- /dev/null +++ b/src/main/java/com/graqr/threshr/model/queryparam/Page.java @@ -0,0 +1,40 @@ +package com.graqr.threshr.model.queryparam; + +import com.graqr.threshr.ThreshrException; +import lombok.Getter; + +/** + * Query parameter in redsky api. Specifies from where an api call is made in the browser. + */ +@Getter +public class Page { + private String page; + + /** + * Sets string value as "/c/" + provided value. + * + * @param page Query parameter in redsky api to specify from where an api call is made in the browser + * @throws ThreshrException if string contains anything other than letters or is empty + */ + public Page(String page) throws ThreshrException { + setPage(page); + } + + /** + * Sets string value as "/c/" + provided value. + * + * @param page Query parameter in redsky api to specify from where an api call is made in the browser + * @throws ThreshrException if string contains anything other than letters or is empty + */ + public void setPage(String page) throws ThreshrException { + String tempPage = page.trim().toLowerCase(); + if (tempPage.startsWith("/c/")) { + tempPage = tempPage.substring(3); + } + if (tempPage.matches(".+([^(a-z|\\-)]).+") || tempPage.isEmpty()) { + throw new ThreshrException(String.format( + "Expected only letters for the page value, but received \"%s\".", tempPage)); + } + this.page = "/c/" + tempPage; + } +} diff --git a/src/main/java/com/graqr/threshr/model/queryparam/Place.java b/src/main/java/com/graqr/threshr/model/queryparam/Place.java index 30bb9aa..a3f748b 100644 --- a/src/main/java/com/graqr/threshr/model/queryparam/Place.java +++ b/src/main/java/com/graqr/threshr/model/queryparam/Place.java @@ -7,14 +7,12 @@ @Data public class Place { private final String place; - public Place(String zipcode) { if (!String.valueOf(zipcode).matches("^\\d{5}(-|\\s*)?(\\d{4})?$")) { throw new IllegalArgumentException("Invalid zipcode provided, \"" + zipcode + "\". Zipcode provided " + "must match this regex: \"^\\d{5}(-|\\s*)?(\\d{4})?$\""); } place = zipcode; - } public Place(String city, String state) { diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/AddOn.java b/src/main/java/com/graqr/threshr/model/redsky/product/AddOn.java similarity index 80% rename from src/main/java/com/graqr/threshr/model/redsky/products/AddOn.java rename to src/main/java/com/graqr/threshr/model/redsky/product/AddOn.java index 4bfd831..4669235 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/AddOn.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/AddOn.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Author.java b/src/main/java/com/graqr/threshr/model/redsky/product/Author.java similarity index 82% rename from src/main/java/com/graqr/threshr/model/redsky/products/Author.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Author.java index 3c6aa6a..7e1daa8 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Author.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Author.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Category.java b/src/main/java/com/graqr/threshr/model/redsky/product/Category.java similarity index 83% rename from src/main/java/com/graqr/threshr/model/redsky/products/Category.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Category.java index d03c4c3..bb257db 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Category.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Category.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Compliance.java b/src/main/java/com/graqr/threshr/model/redsky/product/Compliance.java similarity index 87% rename from src/main/java/com/graqr/threshr/model/redsky/products/Compliance.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Compliance.java index 6a6a295..2ffd21c 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Compliance.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Compliance.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/ContentLabel.java b/src/main/java/com/graqr/threshr/model/redsky/product/ContentLabel.java similarity index 80% rename from src/main/java/com/graqr/threshr/model/redsky/products/ContentLabel.java rename to src/main/java/com/graqr/threshr/model/redsky/product/ContentLabel.java index 09afcf2..c8b1ed1 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/ContentLabel.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/ContentLabel.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Disclaimer.java b/src/main/java/com/graqr/threshr/model/redsky/product/Disclaimer.java similarity index 74% rename from src/main/java/com/graqr/threshr/model/redsky/products/Disclaimer.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Disclaimer.java index 451754f..1e75459 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Disclaimer.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Disclaimer.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Distribution.java b/src/main/java/com/graqr/threshr/model/redsky/product/Distribution.java similarity index 80% rename from src/main/java/com/graqr/threshr/model/redsky/products/Distribution.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Distribution.java index 81ba7f6..116feee 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Distribution.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Distribution.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/EligibilityRules.java b/src/main/java/com/graqr/threshr/model/redsky/product/EligibilityRules.java similarity index 90% rename from src/main/java/com/graqr/threshr/model/redsky/products/EligibilityRules.java rename to src/main/java/com/graqr/threshr/model/redsky/product/EligibilityRules.java index ddd4e01..7914039 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/EligibilityRules.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/EligibilityRules.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Enrichment.java b/src/main/java/com/graqr/threshr/model/redsky/product/Enrichment.java similarity index 89% rename from src/main/java/com/graqr/threshr/model/redsky/products/Enrichment.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Enrichment.java index 48e0550..f76b8ed 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Enrichment.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Enrichment.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/EnvironmentalSegmentation.java b/src/main/java/com/graqr/threshr/model/redsky/product/EnvironmentalSegmentation.java similarity index 83% rename from src/main/java/com/graqr/threshr/model/redsky/products/EnvironmentalSegmentation.java rename to src/main/java/com/graqr/threshr/model/redsky/product/EnvironmentalSegmentation.java index bf82f09..4442031 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/EnvironmentalSegmentation.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/EnvironmentalSegmentation.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Facet.java b/src/main/java/com/graqr/threshr/model/redsky/product/Facet.java similarity index 86% rename from src/main/java/com/graqr/threshr/model/redsky/products/Facet.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Facet.java index c2bc7a0..9c74b08 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Facet.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Facet.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/FindsPost.java b/src/main/java/com/graqr/threshr/model/redsky/product/FindsPost.java similarity index 88% rename from src/main/java/com/graqr/threshr/model/redsky/products/FindsPost.java rename to src/main/java/com/graqr/threshr/model/redsky/product/FindsPost.java index 8f0308d..52553b4 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/FindsPost.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/FindsPost.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/FindsStory.java b/src/main/java/com/graqr/threshr/model/redsky/product/FindsStory.java similarity index 91% rename from src/main/java/com/graqr/threshr/model/redsky/products/FindsStory.java rename to src/main/java/com/graqr/threshr/model/redsky/product/FindsStory.java index a639f5d..b13600e 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/FindsStory.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/FindsStory.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Fulfillment.java b/src/main/java/com/graqr/threshr/model/redsky/product/Fulfillment.java similarity index 94% rename from src/main/java/com/graqr/threshr/model/redsky/products/Fulfillment.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Fulfillment.java index 064e870..30dc688 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Fulfillment.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Fulfillment.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.core.annotation.Nullable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Grocery.java b/src/main/java/com/graqr/threshr/model/redsky/product/Grocery.java similarity index 79% rename from src/main/java/com/graqr/threshr/model/redsky/products/Grocery.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Grocery.java index 990a58c..e821e51 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Grocery.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Grocery.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Handling.java b/src/main/java/com/graqr/threshr/model/redsky/product/Handling.java similarity index 82% rename from src/main/java/com/graqr/threshr/model/redsky/products/Handling.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Handling.java index 03e6613..7307cd4 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Handling.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Handling.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Hold.java b/src/main/java/com/graqr/threshr/model/redsky/product/Hold.java similarity index 78% rename from src/main/java/com/graqr/threshr/model/redsky/products/Hold.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Hold.java index 53ccb07..17ef35a 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Hold.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Hold.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Image.java b/src/main/java/com/graqr/threshr/model/redsky/product/Image.java similarity index 86% rename from src/main/java/com/graqr/threshr/model/redsky/products/Image.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Image.java index df75639..ce0f88d 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Image.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Image.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Images.java b/src/main/java/com/graqr/threshr/model/redsky/product/Images.java similarity index 93% rename from src/main/java/com/graqr/threshr/model/redsky/products/Images.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Images.java index b89c261..b52d32f 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Images.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Images.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.core.annotation.Nullable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/InStoreOnly.java b/src/main/java/com/graqr/threshr/model/redsky/product/InStoreOnly.java similarity index 82% rename from src/main/java/com/graqr/threshr/model/redsky/products/InStoreOnly.java rename to src/main/java/com/graqr/threshr/model/redsky/product/InStoreOnly.java index fb01fed..34d9936 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/InStoreOnly.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/InStoreOnly.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/InventoryNotificationToGuestExcluded.java b/src/main/java/com/graqr/threshr/model/redsky/product/InventoryNotificationToGuestExcluded.java similarity index 82% rename from src/main/java/com/graqr/threshr/model/redsky/products/InventoryNotificationToGuestExcluded.java rename to src/main/java/com/graqr/threshr/model/redsky/product/InventoryNotificationToGuestExcluded.java index 587e77c..658f5a5 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/InventoryNotificationToGuestExcluded.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/InventoryNotificationToGuestExcluded.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Item.java b/src/main/java/com/graqr/threshr/model/redsky/product/Item.java similarity index 97% rename from src/main/java/com/graqr/threshr/model/redsky/products/Item.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Item.java index f36f7dc..c4422a3 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Item.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Item.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.core.annotation.Nullable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/ItemType.java b/src/main/java/com/graqr/threshr/model/redsky/product/ItemType.java similarity index 72% rename from src/main/java/com/graqr/threshr/model/redsky/products/ItemType.java rename to src/main/java/com/graqr/threshr/model/redsky/product/ItemType.java index 1789e65..1fca48a 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/ItemType.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/ItemType.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/MerchandiseClassification.java b/src/main/java/com/graqr/threshr/model/redsky/product/MerchandiseClassification.java similarity index 87% rename from src/main/java/com/graqr/threshr/model/redsky/products/MerchandiseClassification.java rename to src/main/java/com/graqr/threshr/model/redsky/product/MerchandiseClassification.java index 591c2b5..2638579 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/MerchandiseClassification.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/MerchandiseClassification.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Metadata.java b/src/main/java/com/graqr/threshr/model/redsky/product/Metadata.java similarity index 93% rename from src/main/java/com/graqr/threshr/model/redsky/products/Metadata.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Metadata.java index 6dea575..de4b63e 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Metadata.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Metadata.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.core.annotation.Nullable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/MostRecent.java b/src/main/java/com/graqr/threshr/model/redsky/product/MostRecent.java similarity index 80% rename from src/main/java/com/graqr/threshr/model/redsky/products/MostRecent.java rename to src/main/java/com/graqr/threshr/model/redsky/product/MostRecent.java index 85e2ea7..c78994b 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/MostRecent.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/MostRecent.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Nutrient.java b/src/main/java/com/graqr/threshr/model/redsky/product/Nutrient.java similarity index 87% rename from src/main/java/com/graqr/threshr/model/redsky/products/Nutrient.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Nutrient.java index b642606..1081bc5 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Nutrient.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Nutrient.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/NutritionFacts.java b/src/main/java/com/graqr/threshr/model/redsky/product/NutritionFacts.java similarity index 88% rename from src/main/java/com/graqr/threshr/model/redsky/products/NutritionFacts.java rename to src/main/java/com/graqr/threshr/model/redsky/product/NutritionFacts.java index 83503af..c72358d 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/NutritionFacts.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/NutritionFacts.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Options.java b/src/main/java/com/graqr/threshr/model/redsky/product/Options.java similarity index 90% rename from src/main/java/com/graqr/threshr/model/redsky/products/Options.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Options.java index 332427a..67330dc 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Options.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Options.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.core.annotation.Nullable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/OrderPickup.java b/src/main/java/com/graqr/threshr/model/redsky/product/OrderPickup.java similarity index 91% rename from src/main/java/com/graqr/threshr/model/redsky/products/OrderPickup.java rename to src/main/java/com/graqr/threshr/model/redsky/product/OrderPickup.java index e0a1e04..1855c28 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/OrderPickup.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/OrderPickup.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.core.annotation.Nullable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/PackageDimensions.java b/src/main/java/com/graqr/threshr/model/redsky/product/PackageDimensions.java similarity index 88% rename from src/main/java/com/graqr/threshr/model/redsky/products/PackageDimensions.java rename to src/main/java/com/graqr/threshr/model/redsky/product/PackageDimensions.java index e2bcc85..a24b304 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/PackageDimensions.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/PackageDimensions.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Price.java b/src/main/java/com/graqr/threshr/model/redsky/product/Price.java similarity index 94% rename from src/main/java/com/graqr/threshr/model/redsky/products/Price.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Price.java index 3384d3a..e2a1a55 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Price.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Price.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/PrimaryBrand.java b/src/main/java/com/graqr/threshr/model/redsky/product/PrimaryBrand.java similarity index 85% rename from src/main/java/com/graqr/threshr/model/redsky/products/PrimaryBrand.java rename to src/main/java/com/graqr/threshr/model/redsky/product/PrimaryBrand.java index 263944b..f33c779 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/PrimaryBrand.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/PrimaryBrand.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Product.java b/src/main/java/com/graqr/threshr/model/redsky/product/Product.java similarity index 92% rename from src/main/java/com/graqr/threshr/model/redsky/products/Product.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Product.java index 1ea1b9b..c2bcfc6 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Product.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Product.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/ProductClassification.java b/src/main/java/com/graqr/threshr/model/redsky/product/ProductClassification.java similarity index 90% rename from src/main/java/com/graqr/threshr/model/redsky/products/ProductClassification.java rename to src/main/java/com/graqr/threshr/model/redsky/product/ProductClassification.java index 0502488..b200e05 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/ProductClassification.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/ProductClassification.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.core.annotation.Nullable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/ProductDescription.java b/src/main/java/com/graqr/threshr/model/redsky/product/ProductDescription.java similarity index 90% rename from src/main/java/com/graqr/threshr/model/redsky/products/ProductDescription.java rename to src/main/java/com/graqr/threshr/model/redsky/product/ProductDescription.java index 1dacd42..c145c90 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/ProductDescription.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/ProductDescription.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/ProductSummary.java b/src/main/java/com/graqr/threshr/model/redsky/product/ProductSummary.java similarity index 87% rename from src/main/java/com/graqr/threshr/model/redsky/products/ProductSummary.java rename to src/main/java/com/graqr/threshr/model/redsky/product/ProductSummary.java index 731655b..259a5b2 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/ProductSummary.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/ProductSummary.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.core.annotation.Nullable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/ProductVendor.java b/src/main/java/com/graqr/threshr/model/redsky/product/ProductVendor.java similarity index 82% rename from src/main/java/com/graqr/threshr/model/redsky/products/ProductVendor.java rename to src/main/java/com/graqr/threshr/model/redsky/product/ProductVendor.java index 0290999..5ea86f3 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/ProductVendor.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/ProductVendor.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Rating.java b/src/main/java/com/graqr/threshr/model/redsky/product/Rating.java similarity index 91% rename from src/main/java/com/graqr/threshr/model/redsky/products/Rating.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Rating.java index 7aa6a70..68a2148 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Rating.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Rating.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.core.annotation.Nullable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/RatingsAndReviews.java b/src/main/java/com/graqr/threshr/model/redsky/product/RatingsAndReviews.java similarity index 87% rename from src/main/java/com/graqr/threshr/model/redsky/products/RatingsAndReviews.java rename to src/main/java/com/graqr/threshr/model/redsky/product/RatingsAndReviews.java index ae78c95..f68a2b7 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/RatingsAndReviews.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/RatingsAndReviews.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/RelatedCategory.java b/src/main/java/com/graqr/threshr/model/redsky/product/RelatedCategory.java similarity index 73% rename from src/main/java/com/graqr/threshr/model/redsky/products/RelatedCategory.java rename to src/main/java/com/graqr/threshr/model/redsky/product/RelatedCategory.java index 9c951f0..e9fc4eb 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/RelatedCategory.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/RelatedCategory.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/ReturnPolicy.java b/src/main/java/com/graqr/threshr/model/redsky/product/ReturnPolicy.java similarity index 82% rename from src/main/java/com/graqr/threshr/model/redsky/products/ReturnPolicy.java rename to src/main/java/com/graqr/threshr/model/redsky/product/ReturnPolicy.java index 6bf3e91..6c62316 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/ReturnPolicy.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/ReturnPolicy.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/ScheduledDelivery.java b/src/main/java/com/graqr/threshr/model/redsky/product/ScheduledDelivery.java similarity index 88% rename from src/main/java/com/graqr/threshr/model/redsky/products/ScheduledDelivery.java rename to src/main/java/com/graqr/threshr/model/redsky/product/ScheduledDelivery.java index 2733359..4e20adc 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/ScheduledDelivery.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/ScheduledDelivery.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.core.annotation.Nullable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Search.java b/src/main/java/com/graqr/threshr/model/redsky/product/Search.java similarity index 86% rename from src/main/java/com/graqr/threshr/model/redsky/products/Search.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Search.java index 8353943..0b7b45f 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Search.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Search.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/SearchQueryArgs.java b/src/main/java/com/graqr/threshr/model/redsky/product/SearchQueryArgs.java similarity index 94% rename from src/main/java/com/graqr/threshr/model/redsky/products/SearchQueryArgs.java rename to src/main/java/com/graqr/threshr/model/redsky/product/SearchQueryArgs.java index 4e678b5..431001d 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/SearchQueryArgs.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/SearchQueryArgs.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import io.micronaut.core.annotation.Introspected; import io.micronaut.core.annotation.Nullable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/SearchRecommendations.java b/src/main/java/com/graqr/threshr/model/redsky/product/SearchRecommendations.java similarity index 86% rename from src/main/java/com/graqr/threshr/model/redsky/products/SearchRecommendations.java rename to src/main/java/com/graqr/threshr/model/redsky/product/SearchRecommendations.java index 737308b..439c53a 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/SearchRecommendations.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/SearchRecommendations.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/SearchResponse.java b/src/main/java/com/graqr/threshr/model/redsky/product/SearchResponse.java similarity index 87% rename from src/main/java/com/graqr/threshr/model/redsky/products/SearchResponse.java rename to src/main/java/com/graqr/threshr/model/redsky/product/SearchResponse.java index 22a0c7e..c39ed48 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/SearchResponse.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/SearchResponse.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/SecondaryAverage.java b/src/main/java/com/graqr/threshr/model/redsky/product/SecondaryAverage.java similarity index 76% rename from src/main/java/com/graqr/threshr/model/redsky/products/SecondaryAverage.java rename to src/main/java/com/graqr/threshr/model/redsky/product/SecondaryAverage.java index 0a0ebd6..65689af 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/SecondaryAverage.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/SecondaryAverage.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/ShippingOptions.java b/src/main/java/com/graqr/threshr/model/redsky/product/ShippingOptions.java similarity index 88% rename from src/main/java/com/graqr/threshr/model/redsky/products/ShippingOptions.java rename to src/main/java/com/graqr/threshr/model/redsky/product/ShippingOptions.java index edc74ce..fa979ca 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/ShippingOptions.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/ShippingOptions.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/SoftBullet.java b/src/main/java/com/graqr/threshr/model/redsky/product/SoftBullet.java similarity index 74% rename from src/main/java/com/graqr/threshr/model/redsky/products/SoftBullet.java rename to src/main/java/com/graqr/threshr/model/redsky/product/SoftBullet.java index 723ba7a..eba5551 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/SoftBullet.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/SoftBullet.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/SoftBullets.java b/src/main/java/com/graqr/threshr/model/redsky/product/SoftBullets.java similarity index 75% rename from src/main/java/com/graqr/threshr/model/redsky/products/SoftBullets.java rename to src/main/java/com/graqr/threshr/model/redsky/product/SoftBullets.java index 5f2af36..dc31349 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/SoftBullets.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/SoftBullets.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Statistics.java b/src/main/java/com/graqr/threshr/model/redsky/product/Statistics.java similarity index 90% rename from src/main/java/com/graqr/threshr/model/redsky/products/Statistics.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Statistics.java index 757111f..075e8a3 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Statistics.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Statistics.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Store.java b/src/main/java/com/graqr/threshr/model/redsky/product/Store.java similarity index 54% rename from src/main/java/com/graqr/threshr/model/redsky/products/Store.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Store.java index 807f636..7edd569 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Store.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Store.java @@ -1,8 +1,12 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; +/** + * This class is kept separate from ...redsky.store.Store as this object only has a location name + * @param locationName + */ @Serdeable public record Store(@JsonProperty("location_name") String locationName) { diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/StoreOption.java b/src/main/java/com/graqr/threshr/model/redsky/product/StoreOption.java similarity index 92% rename from src/main/java/com/graqr/threshr/model/redsky/products/StoreOption.java rename to src/main/java/com/graqr/threshr/model/redsky/product/StoreOption.java index 83db6e3..92b9280 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/StoreOption.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/StoreOption.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/User.java b/src/main/java/com/graqr/threshr/model/redsky/product/User.java similarity index 87% rename from src/main/java/com/graqr/threshr/model/redsky/products/User.java rename to src/main/java/com/graqr/threshr/model/redsky/product/User.java index daa5eb1..d5c600a 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/User.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/User.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/ValuePreparedList.java b/src/main/java/com/graqr/threshr/model/redsky/product/ValuePreparedList.java similarity index 90% rename from src/main/java/com/graqr/threshr/model/redsky/products/ValuePreparedList.java rename to src/main/java/com/graqr/threshr/model/redsky/product/ValuePreparedList.java index ec4c892..5c80471 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/ValuePreparedList.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/ValuePreparedList.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/Video.java b/src/main/java/com/graqr/threshr/model/redsky/product/Video.java similarity index 92% rename from src/main/java/com/graqr/threshr/model/redsky/products/Video.java rename to src/main/java/com/graqr/threshr/model/redsky/product/Video.java index 0c23958..8013b65 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/Video.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/Video.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/VideoCaption.java b/src/main/java/com/graqr/threshr/model/redsky/product/VideoCaption.java similarity index 82% rename from src/main/java/com/graqr/threshr/model/redsky/products/VideoCaption.java rename to src/main/java/com/graqr/threshr/model/redsky/product/VideoCaption.java index 19aed43..b4d5f38 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/VideoCaption.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/VideoCaption.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/VideoFile.java b/src/main/java/com/graqr/threshr/model/redsky/product/VideoFile.java similarity index 86% rename from src/main/java/com/graqr/threshr/model/redsky/products/VideoFile.java rename to src/main/java/com/graqr/threshr/model/redsky/product/VideoFile.java index 0f857b5..fb8323b 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/VideoFile.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/VideoFile.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products; +package com.graqr.threshr.model.redsky.product; import com.fasterxml.jackson.annotation.JsonProperty; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/product/pdp/client/Data.java b/src/main/java/com/graqr/threshr/model/redsky/product/pdp/client/Data.java new file mode 100644 index 0000000..b0778ae --- /dev/null +++ b/src/main/java/com/graqr/threshr/model/redsky/product/pdp/client/Data.java @@ -0,0 +1,8 @@ +package com.graqr.threshr.model.redsky.product.pdp.client; + +import com.graqr.threshr.model.redsky.product.Product; +import io.micronaut.serde.annotation.Serdeable; + +@Serdeable +public record Data(Product product) { +} diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/pdp/client/PdpClientRoot.java b/src/main/java/com/graqr/threshr/model/redsky/product/pdp/client/PdpClientRoot.java similarity index 63% rename from src/main/java/com/graqr/threshr/model/redsky/products/pdp/client/PdpClientRoot.java rename to src/main/java/com/graqr/threshr/model/redsky/product/pdp/client/PdpClientRoot.java index 2a3f2da..11fdfed 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/pdp/client/PdpClientRoot.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/pdp/client/PdpClientRoot.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products.pdp.client; +package com.graqr.threshr.model.redsky.product.pdp.client; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/product/plp/search/Data.java b/src/main/java/com/graqr/threshr/model/redsky/product/plp/search/Data.java new file mode 100644 index 0000000..2d41fae --- /dev/null +++ b/src/main/java/com/graqr/threshr/model/redsky/product/plp/search/Data.java @@ -0,0 +1,8 @@ +package com.graqr.threshr.model.redsky.product.plp.search; + +import com.graqr.threshr.model.redsky.product.Search; +import io.micronaut.serde.annotation.Serdeable; + +@Serdeable +public record Data(Search search) { +} diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/plp/search/plpSearchRoot.java b/src/main/java/com/graqr/threshr/model/redsky/product/plp/search/plpSearchRoot.java similarity index 63% rename from src/main/java/com/graqr/threshr/model/redsky/products/plp/search/plpSearchRoot.java rename to src/main/java/com/graqr/threshr/model/redsky/product/plp/search/plpSearchRoot.java index ef55211..1951746 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/plp/search/plpSearchRoot.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/plp/search/plpSearchRoot.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products.plp.search; +package com.graqr.threshr.model.redsky.product.plp.search; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/summary/Data.java b/src/main/java/com/graqr/threshr/model/redsky/product/summary/Data.java similarity index 66% rename from src/main/java/com/graqr/threshr/model/redsky/products/summary/Data.java rename to src/main/java/com/graqr/threshr/model/redsky/product/summary/Data.java index fd0f7b2..a472129 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/summary/Data.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/summary/Data.java @@ -1,7 +1,7 @@ -package com.graqr.threshr.model.redsky.products.summary; +package com.graqr.threshr.model.redsky.product.summary; import com.fasterxml.jackson.annotation.JsonProperty; -import com.graqr.threshr.model.redsky.products.ProductSummary; +import com.graqr.threshr.model.redsky.product.ProductSummary; import io.micronaut.serde.annotation.Serdeable; import java.util.List; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/summary/ProductSummaryRoot.java b/src/main/java/com/graqr/threshr/model/redsky/product/summary/ProductSummaryRoot.java similarity index 65% rename from src/main/java/com/graqr/threshr/model/redsky/products/summary/ProductSummaryRoot.java rename to src/main/java/com/graqr/threshr/model/redsky/product/summary/ProductSummaryRoot.java index 65a4d41..d602848 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/products/summary/ProductSummaryRoot.java +++ b/src/main/java/com/graqr/threshr/model/redsky/product/summary/ProductSummaryRoot.java @@ -1,4 +1,4 @@ -package com.graqr.threshr.model.redsky.products.summary; +package com.graqr.threshr.model.redsky.product.summary; import io.micronaut.serde.annotation.Serdeable; diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/pdp/client/Data.java b/src/main/java/com/graqr/threshr/model/redsky/products/pdp/client/Data.java deleted file mode 100644 index 94284e5..0000000 --- a/src/main/java/com/graqr/threshr/model/redsky/products/pdp/client/Data.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.graqr.threshr.model.redsky.products.pdp.client; - -import com.graqr.threshr.model.redsky.products.Product; -import io.micronaut.serde.annotation.Serdeable; - -@Serdeable -public record Data(Product product) { -} diff --git a/src/main/java/com/graqr/threshr/model/redsky/products/plp/search/Data.java b/src/main/java/com/graqr/threshr/model/redsky/products/plp/search/Data.java deleted file mode 100644 index 7d24883..0000000 --- a/src/main/java/com/graqr/threshr/model/redsky/products/plp/search/Data.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.graqr.threshr.model.redsky.products.plp.search; - -import com.graqr.threshr.model.redsky.products.Search; -import io.micronaut.serde.annotation.Serdeable; - -@Serdeable -public record Data(Search search) { -} diff --git a/src/main/java/com/graqr/threshr/model/redsky/store/Capability.java b/src/main/java/com/graqr/threshr/model/redsky/store/Capability.java new file mode 100644 index 0000000..4036f6f --- /dev/null +++ b/src/main/java/com/graqr/threshr/model/redsky/store/Capability.java @@ -0,0 +1,9 @@ +package com.graqr.threshr.model.redsky.store; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.micronaut.serde.annotation.Serdeable; + +@Serdeable +public record Capability(@JsonProperty("capability_code") String capabilityCode, + @JsonProperty("capability_name") String capabilityName, + @JsonProperty("effective_date") String effectiveDate) {} diff --git a/src/main/java/com/graqr/threshr/model/redsky/store/CapabilityHour.java b/src/main/java/com/graqr/threshr/model/redsky/store/CapabilityHour.java new file mode 100644 index 0000000..ac56dba --- /dev/null +++ b/src/main/java/com/graqr/threshr/model/redsky/store/CapabilityHour.java @@ -0,0 +1,11 @@ +package com.graqr.threshr.model.redsky.store; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.micronaut.serde.annotation.Serdeable; + +import java.util.List; + +@Serdeable +public record CapabilityHour(@JsonProperty("capability_code") String capabilityCode, + List days) { +} diff --git a/src/main/java/com/graqr/threshr/model/redsky/store/ContactInformation.java b/src/main/java/com/graqr/threshr/model/redsky/store/ContactInformation.java new file mode 100644 index 0000000..b4314ee --- /dev/null +++ b/src/main/java/com/graqr/threshr/model/redsky/store/ContactInformation.java @@ -0,0 +1,11 @@ +package com.graqr.threshr.model.redsky.store; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.micronaut.serde.annotation.Serdeable; + +@Serdeable +public record ContactInformation(@JsonProperty("building_area") String buildingArea, + @JsonProperty("telephone_type") String telephoneType, + @JsonProperty("is_international_phone_number") Boolean isInternationalPhoneNumber, + @JsonProperty("telephone_number") String telephoneNumber, + String capability) {} diff --git a/src/main/java/com/graqr/threshr/model/redsky/stores/Day.java b/src/main/java/com/graqr/threshr/model/redsky/store/Day.java similarity index 58% rename from src/main/java/com/graqr/threshr/model/redsky/stores/Day.java rename to src/main/java/com/graqr/threshr/model/redsky/store/Day.java index 50a9047..8f6e4fd 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/stores/Day.java +++ b/src/main/java/com/graqr/threshr/model/redsky/store/Day.java @@ -1,9 +1,8 @@ -package com.graqr.threshr.model.redsky.stores; +package com.graqr.threshr.model.redsky.store; import com.fasterxml.jackson.annotation.JsonProperty; +import io.micronaut.core.annotation.Nullable; import io.micronaut.serde.annotation.Serdeable; -import lombok.AllArgsConstructor; -import lombok.Data; import java.util.List; @@ -13,5 +12,7 @@ public record Day( String date, @JsonProperty("day_name") String dayName, - List hours) { + List hours, + @Nullable @JsonProperty("sequence_number") + String sequenceNumber) { } \ No newline at end of file diff --git a/src/main/java/com/graqr/threshr/model/redsky/store/DriveUp.java b/src/main/java/com/graqr/threshr/model/redsky/store/DriveUp.java new file mode 100644 index 0000000..49531c9 --- /dev/null +++ b/src/main/java/com/graqr/threshr/model/redsky/store/DriveUp.java @@ -0,0 +1,5 @@ +package com.graqr.threshr.model.redsky.store; +import io.micronaut.serde.annotation.Serdeable; + +@Serdeable +public record DriveUp(Double latitude, Double longitude, Long radius) {} diff --git a/src/main/java/com/graqr/threshr/model/redsky/store/Geofence.java b/src/main/java/com/graqr/threshr/model/redsky/store/Geofence.java new file mode 100644 index 0000000..015a94c --- /dev/null +++ b/src/main/java/com/graqr/threshr/model/redsky/store/Geofence.java @@ -0,0 +1,6 @@ +package com.graqr.threshr.model.redsky.store; + +import io.micronaut.serde.annotation.Serdeable; + +@Serdeable +public record Geofence(Double latitude, Double longitude, Long radius) {} diff --git a/src/main/java/com/graqr/threshr/model/redsky/store/GeographicSpecifications.java b/src/main/java/com/graqr/threshr/model/redsky/store/GeographicSpecifications.java new file mode 100644 index 0000000..7ca801f --- /dev/null +++ b/src/main/java/com/graqr/threshr/model/redsky/store/GeographicSpecifications.java @@ -0,0 +1,16 @@ +package com.graqr.threshr.model.redsky.store; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.micronaut.serde.annotation.Serdeable; + +@Serdeable +public record GeographicSpecifications( + Double latitude, + Double longitude, + @JsonProperty("time_zone_code") String timeZoneCode, + @JsonProperty("time_zone_description") String timeZoneDescription, + @JsonProperty("time_zone_utc_offset_name") String timeZoneUtcOffsetName, + @JsonProperty("time_zone_offset_hours") String timeZoneOffsetHours, + @JsonProperty("is_daylight_savings_time_recognized") Boolean isDaylightSavingsTimeRecognized, + @JsonProperty("iso_time_zone_code") String isoTimeZoneCode) { +} diff --git a/src/main/java/com/graqr/threshr/model/redsky/stores/Hour.java b/src/main/java/com/graqr/threshr/model/redsky/store/Hour.java similarity index 64% rename from src/main/java/com/graqr/threshr/model/redsky/stores/Hour.java rename to src/main/java/com/graqr/threshr/model/redsky/store/Hour.java index 6650810..1d47826 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/stores/Hour.java +++ b/src/main/java/com/graqr/threshr/model/redsky/store/Hour.java @@ -1,12 +1,13 @@ -package com.graqr.threshr.model.redsky.stores; +package com.graqr.threshr.model.redsky.store; import com.fasterxml.jackson.annotation.JsonProperty; +import io.micronaut.core.annotation.Nullable; import io.micronaut.serde.annotation.Serdeable; -import lombok.AllArgsConstructor; -import lombok.Data; @Serdeable public record Hour( + @Nullable @JsonProperty("begin_date") + String beginDate, @JsonProperty("begin_time") String beginTime, @JsonProperty("end_date") String endDate, @JsonProperty("end_time") String endTime) { diff --git a/src/main/java/com/graqr/threshr/model/redsky/store/MailingAddress.java b/src/main/java/com/graqr/threshr/model/redsky/store/MailingAddress.java new file mode 100644 index 0000000..d4e392c --- /dev/null +++ b/src/main/java/com/graqr/threshr/model/redsky/store/MailingAddress.java @@ -0,0 +1,19 @@ +package com.graqr.threshr.model.redsky.store; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.micronaut.core.annotation.Nullable; +import io.micronaut.serde.annotation.Serdeable; + +@Serdeable +public record MailingAddress( + @JsonProperty("address_line1") + String addressLine1, + String city, + @JsonProperty("country_code") + String countryCode, + String region, + String state, + @JsonProperty("postal_code") + String postalCode, + @Nullable String country) { +} diff --git a/src/main/java/com/graqr/threshr/model/redsky/stores/MainHours.java b/src/main/java/com/graqr/threshr/model/redsky/store/MainHours.java similarity index 65% rename from src/main/java/com/graqr/threshr/model/redsky/stores/MainHours.java rename to src/main/java/com/graqr/threshr/model/redsky/store/MainHours.java index 8a6d57d..117f03b 100644 --- a/src/main/java/com/graqr/threshr/model/redsky/stores/MainHours.java +++ b/src/main/java/com/graqr/threshr/model/redsky/store/MainHours.java @@ -1,7 +1,6 @@ -package com.graqr.threshr.model.redsky.stores; +package com.graqr.threshr.model.redsky.store; import io.micronaut.serde.annotation.Serdeable; -import lombok.Data; import java.util.List; diff --git a/src/main/java/com/graqr/threshr/model/redsky/store/Miscellaneous.java b/src/main/java/com/graqr/threshr/model/redsky/store/Miscellaneous.java new file mode 100644 index 0000000..4f36253 --- /dev/null +++ b/src/main/java/com/graqr/threshr/model/redsky/store/Miscellaneous.java @@ -0,0 +1,7 @@ +package com.graqr.threshr.model.redsky.store; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.micronaut.serde.annotation.Serdeable; + +@Serdeable +public record Miscellaneous(@JsonProperty("google_cid") String googleCid) {} diff --git a/src/main/java/com/graqr/threshr/model/redsky/store/NearbyStore.java b/src/main/java/com/graqr/threshr/model/redsky/store/NearbyStore.java new file mode 100644 index 0000000..cd0a416 --- /dev/null +++ b/src/main/java/com/graqr/threshr/model/redsky/store/NearbyStore.java @@ -0,0 +1,9 @@ +package com.graqr.threshr.model.redsky.store; + +import io.micronaut.serde.annotation.Serdeable; + +import java.util.List; + +@Serdeable +public record NearbyStore(Long count, List stores) { +} diff --git a/src/main/java/com/graqr/threshr/model/redsky/store/PhysicalSpecifications.java b/src/main/java/com/graqr/threshr/model/redsky/store/PhysicalSpecifications.java new file mode 100644 index 0000000..a708c87 --- /dev/null +++ b/src/main/java/com/graqr/threshr/model/redsky/store/PhysicalSpecifications.java @@ -0,0 +1,9 @@ +package com.graqr.threshr.model.redsky.store; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.micronaut.serde.annotation.Serdeable; + +@Serdeable +public record PhysicalSpecifications(@JsonProperty("total_building_area") Long totalBuildingArea, + @JsonProperty("merchandise_level") Long merchandiseLevel, + String format) {} diff --git a/src/main/java/com/graqr/threshr/model/redsky/store/RollingOperatingHours.java b/src/main/java/com/graqr/threshr/model/redsky/store/RollingOperatingHours.java new file mode 100644 index 0000000..0fdf3a0 --- /dev/null +++ b/src/main/java/com/graqr/threshr/model/redsky/store/RollingOperatingHours.java @@ -0,0 +1,14 @@ +package com.graqr.threshr.model.redsky.store; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.micronaut.core.annotation.Nullable; +import io.micronaut.serde.annotation.Serdeable; + +import java.util.List; + +@Serdeable +public record RollingOperatingHours( + @JsonProperty("main_hours") MainHours mainHours, + @Nullable @JsonProperty("capability_hours") + List capabilityHours) { +} diff --git a/src/main/java/com/graqr/threshr/model/redsky/store/Store.java b/src/main/java/com/graqr/threshr/model/redsky/store/Store.java new file mode 100644 index 0000000..842bc39 --- /dev/null +++ b/src/main/java/com/graqr/threshr/model/redsky/store/Store.java @@ -0,0 +1,27 @@ +package com.graqr.threshr.model.redsky.store; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.micronaut.core.annotation.Nullable; +import io.micronaut.serde.annotation.Serdeable; + +import java.util.List; + +@Serdeable +public record Store(String status, + @JsonProperty("store_id") String storeId, + @JsonProperty("location_name") String locationName, + Double distance, + @JsonProperty("main_voice_phone_number") String mainVoicePhoneNumber, + @JsonProperty("mailing_address") MailingAddress mailingAddress, + @JsonProperty("rolling_operating_hours") RollingOperatingHours rollingOperatingHours, + @Nullable Geofence geofence, + @Nullable List capabilities, + @Nullable @JsonProperty("drive_up") + DriveUp driveUp, + @Nullable @JsonProperty("contact_information") + List contactInformation, + @Nullable @JsonProperty("physical_specifications") + PhysicalSpecifications physicalSpecifications, + @Nullable @JsonProperty("geographic_specifications") + GeographicSpecifications geographicSpecifications, + @Nullable Miscellaneous miscellaneous) {} diff --git a/src/main/java/com/graqr/threshr/model/redsky/store/location/Data.java b/src/main/java/com/graqr/threshr/model/redsky/store/location/Data.java new file mode 100644 index 0000000..1dde818 --- /dev/null +++ b/src/main/java/com/graqr/threshr/model/redsky/store/location/Data.java @@ -0,0 +1,8 @@ +package com.graqr.threshr.model.redsky.store.location; + +import com.graqr.threshr.model.redsky.store.Store; +import io.micronaut.serde.annotation.Serdeable; + +@Serdeable +public record Data(Store store) { +} diff --git a/src/main/java/com/graqr/threshr/model/redsky/store/location/StoreLocationRoot.java b/src/main/java/com/graqr/threshr/model/redsky/store/location/StoreLocationRoot.java new file mode 100644 index 0000000..a00eeb9 --- /dev/null +++ b/src/main/java/com/graqr/threshr/model/redsky/store/location/StoreLocationRoot.java @@ -0,0 +1,7 @@ +package com.graqr.threshr.model.redsky.store.location; + +import com.graqr.threshr.model.redsky.store.nearby.Data; +import io.micronaut.serde.annotation.Serdeable; + +@Serdeable +public record StoreLocationRoot(Data data) {} diff --git a/src/main/java/com/graqr/threshr/model/redsky/store/nearby/Data.java b/src/main/java/com/graqr/threshr/model/redsky/store/nearby/Data.java new file mode 100644 index 0000000..7efc6ae --- /dev/null +++ b/src/main/java/com/graqr/threshr/model/redsky/store/nearby/Data.java @@ -0,0 +1,10 @@ +package com.graqr.threshr.model.redsky.store.nearby; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.graqr.threshr.model.redsky.store.NearbyStore; +import io.micronaut.serde.annotation.Serdeable; + +@Serdeable +public record Data(@JsonProperty("nearby_stores") NearbyStore nearbyStores) { +} + diff --git a/src/main/java/com/graqr/threshr/model/redsky/store/nearby/NearbyStoreRoot.java b/src/main/java/com/graqr/threshr/model/redsky/store/nearby/NearbyStoreRoot.java new file mode 100644 index 0000000..e3e3527 --- /dev/null +++ b/src/main/java/com/graqr/threshr/model/redsky/store/nearby/NearbyStoreRoot.java @@ -0,0 +1,10 @@ +package com.graqr.threshr.model.redsky.store.nearby; + +import io.micronaut.core.annotation.Introspected; +import io.micronaut.serde.annotation.Serdeable; + +@Serdeable +@Introspected +public record NearbyStoreRoot(Data data) { +} + diff --git a/src/main/java/com/graqr/threshr/model/redsky/stores/Data.java b/src/main/java/com/graqr/threshr/model/redsky/stores/Data.java deleted file mode 100644 index aa8618a..0000000 --- a/src/main/java/com/graqr/threshr/model/redsky/stores/Data.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.graqr.threshr.model.redsky.stores; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.micronaut.serde.annotation.Serdeable; - -@Serdeable -public record Data(@JsonProperty("nearby_stores") NearbyStores nearbyStores) { -} - diff --git a/src/main/java/com/graqr/threshr/model/redsky/stores/MailingAddress.java b/src/main/java/com/graqr/threshr/model/redsky/stores/MailingAddress.java deleted file mode 100644 index 4028f4d..0000000 --- a/src/main/java/com/graqr/threshr/model/redsky/stores/MailingAddress.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.graqr.threshr.model.redsky.stores; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.micronaut.serde.annotation.Serdeable; -import lombok.AllArgsConstructor; -import lombok.Data; - -@Serdeable -public record MailingAddress( - @JsonProperty("address_line1") String addressLine1, - String city, - @JsonProperty("country_code") String countryCode, - String region, - String state, - @JsonProperty("postal_code") String postalCode) { -} diff --git a/src/main/java/com/graqr/threshr/model/redsky/stores/NearbyStores.java b/src/main/java/com/graqr/threshr/model/redsky/stores/NearbyStores.java deleted file mode 100644 index 6a2910b..0000000 --- a/src/main/java/com/graqr/threshr/model/redsky/stores/NearbyStores.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.graqr.threshr.model.redsky.stores; - -import io.micronaut.serde.annotation.Serdeable; -import lombok.AllArgsConstructor; -import lombok.Data; - -import java.util.List; - -@Serdeable -public record NearbyStores(Long count, List stores) { -} diff --git a/src/main/java/com/graqr/threshr/model/redsky/stores/NearbyStoresRoot.java b/src/main/java/com/graqr/threshr/model/redsky/stores/NearbyStoresRoot.java deleted file mode 100644 index 2f105f6..0000000 --- a/src/main/java/com/graqr/threshr/model/redsky/stores/NearbyStoresRoot.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.graqr.threshr.model.redsky.stores; - -import io.micronaut.serde.annotation.Serdeable; - -@Serdeable -public record NearbyStoresRoot(Data data) { -} - diff --git a/src/main/java/com/graqr/threshr/model/redsky/stores/RollingOperatingHours.java b/src/main/java/com/graqr/threshr/model/redsky/stores/RollingOperatingHours.java deleted file mode 100644 index c886605..0000000 --- a/src/main/java/com/graqr/threshr/model/redsky/stores/RollingOperatingHours.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.graqr.threshr.model.redsky.stores; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.micronaut.serde.annotation.Serdeable; -import lombok.Data; - -@Serdeable -public record RollingOperatingHours(@JsonProperty("main_hours") MainHours mainHours) { -} diff --git a/src/main/java/com/graqr/threshr/model/redsky/stores/Store.java b/src/main/java/com/graqr/threshr/model/redsky/stores/Store.java deleted file mode 100644 index b43b08e..0000000 --- a/src/main/java/com/graqr/threshr/model/redsky/stores/Store.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.graqr.threshr.model.redsky.stores; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.micronaut.serde.annotation.Serdeable; -import lombok.AllArgsConstructor; -import lombok.Data; - -@Serdeable -public record Store(String status, @JsonProperty("store_id") String storeId, - @JsonProperty("location_name") String locationName, - Double distance, - @JsonProperty("main_voice_phone_number") String mainVoicePhoneNumber, - @JsonProperty("mailing_address") MailingAddress mailingAddress, - @JsonProperty("rolling_operating_hours") RollingOperatingHours rollingOperatingHours) { -} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 2757772..22e80cf 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -12,4 +12,5 @@ threshr: channel: test: data: - stores: ${TEST_STORE_FILE_DATA:nearby_stores.json} \ No newline at end of file + stores: ${TEST_DATA_STORES:nearby_stores.json} + categories: ${TEST_DATA_CATEGORIES:target_categories.txt} \ No newline at end of file diff --git a/src/test/groovy/com/graqr/threshr/PlaceSpec.groovy b/src/test/groovy/com/graqr/threshr/PlaceSpec.groovy deleted file mode 100644 index 93e78f7..0000000 --- a/src/test/groovy/com/graqr/threshr/PlaceSpec.groovy +++ /dev/null @@ -1,56 +0,0 @@ -package com.graqr.threshr - - -import com.graqr.threshr.model.queryparam.Place -import io.micronaut.test.extensions.spock.annotation.MicronautTest - -@MicronautTest -class PlaceSpec extends ThreshrSpec { - - void 'creating a Place object with "#badZipCode" throws an error'() { - when: - new Place(badZipCode) - - then: - thrown(IllegalArgumentException) - - where: - badZipCode << cities + List.of("", " ") - } - - void 'creating a Place object with "#badCity" and "#badState" throws an error'() { - when: - new Place(badCity, badState) - - then: - thrown(IllegalArgumentException) - - where: - badCity << cities + emptyStrings - badState << emptyStrings + states - } - - void 'creating a Place object with "#goodZip" throws no error'() { - when: - new Place(goodZip) - - then: - noExceptionThrown() - - where: - goodZip << zipCodesPlus4 + zipCodes - } - - void 'creating a Place object with "#goodCity" and "#goodState" throws no error'() { - when: - new Place(goodCity, goodState) - - then: - noExceptionThrown() - - where: - goodCity << cities - goodState << states - } -} - diff --git a/src/test/groovy/com/graqr/threshr/README.md b/src/test/groovy/com/graqr/threshr/README.md new file mode 100644 index 0000000..3882439 --- /dev/null +++ b/src/test/groovy/com/graqr/threshr/README.md @@ -0,0 +1,120 @@ +# Threshr Tests +Assuming your environment is setup to build a graalvm image and all that goes with building Threshr, these tests require file inputs. + +### Environment Variables +Aside from the environment variables needed to build threshr, variables can be used to specify data to use in testing. These variables are found in `application.yml` at the repo's resource root directory. + +
Tip for Windows Users +
    +
      + +> :warning: You'll need Windows Terminal and winget on your machine for this setup. In good news, you may have these installed and not know it. + +
    +The GraalVM requires the visual studio sdk in order to work. Graal has some instructions on getting this all setup. I'd suggest going through with the winget installer, it does the same thing doesn't require your input. +
      + +```PowerShell +winget install Microsoft.VisualStudio.2022.Community +``` +
    +After installing, your Windows terminal will have a couple new profiles, one named `Develop PowerShell for VS 2022`. Begin adding a new profile based on this new one to find the commandline executable used for this profile. It will read something like: +
      + +```sh +powershell.exe -NoExit -Command \ + "&{Import-Module """C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"""; \ + Enter-VsDevShell a33f35bb \ + -SkipAutomaticLocation \ + -DevCmdArguments """-arch=x64 -host_arch=x64"""}" +``` +
    + +All we need from this entry is that string given after the `Enter-VsDevShell` command (in the previous example, `a33f35bb`). This relies on Add-ToPath. +
      + +```PowerShell +function Start-DevTerminal { + <# + .SYNOPSIS + Configures shell to use a fully fledged java dev environment + + .DESCRIPTION + Adds JAVA_HOME, GRAALVM_HOME and MAVEN_HOME variables and verifies they're each on system's PATH. + Imports VScode dev shell module and calls Enter-VsDevShell + + .PARAMETER Java + Path to graalvm directory, defaults to ~\.jdks\graalvm-ce-17 + + .PARAMETER Maven + Path to maven directory, defaults to 'C:\Program Files\Apache Maven\' + + .EXAMPLE + # Valid use could be as simple as calling with no args + Start-DevTerminal + + #> + [CmdletBinding()] + param ( + [Parameter()] + [String] + [ValidateScript({ Test-Path -Path $_ -PathType Container })] + $Java = "$($HOME)\.jdks\graalvm-ce-17", + [Parameter()] + [String] + [ValidateScript({ Test-Path -Path $_ -PathType Container })] + $Maven = "C:\Program Files\Apache Maven\" + ) + @("JAVA_HOME", "GRAALVM_HOME") | ForEach-Object { + [System.Environment]::SetEnvironmentVariable($_, $Java) + } + [System.Environment]::SetEnvironmentVariable("MAVEN_HOME", "C:\Program Files\Apache Maven\") + $devShellGeneratedName = "a33f35bb" + Add-ToPath "$env:JAVA_HOME\bin" + Add-ToPath "$env:MAVEN_HOME\bin" + + Import-Module "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" + Enter-VsDevShell $devShellGeneratedName -SkipAutomaticLocation -DevCmdArguments "-arch=x64 -host_arch=x64" +} +``` +
    +
+
+ +### Default values and Test Data + +
Check out my source function to make using a .env file easier on windows.
+ +
+ + + + + + + + + + + + + + + + + +
Variable NameDefault ValueFile Content
TEST_DATA_STORESnearby_stores.jsonEmulated return json from the redsky `nearby_stores_v1` endpoint
TEST_DATA_CATEGORIEStarget_categories.txtTarget categories scraped from html on target's "all categories" page
+ +### Run Tests + +From the root directory, populate the environment variables and use the maven wrapper to execute the tests. +```PowerShell +source .env +Start-DevTerminal +./mvnw test +``` +#### Log Levels +By default, Threshr's log level is set to Info. You can define log levels for packages by defining the variable package name as a variable, swapping `.` for `_` and prepending with `LOGGER_LEVELS`. As an example, to enable debug logging for the micronaut httpclient you'd create this variable and assignment: +```properties +LOGGER_LEVELS_IO_MICRONAUT_HTTP_CLIENT=DEBUG +``` diff --git a/src/test/groovy/com/graqr/threshr/ThreshrClientSpec.groovy b/src/test/groovy/com/graqr/threshr/ThreshrClientSpec.groovy index c3e4a70..623a093 100644 --- a/src/test/groovy/com/graqr/threshr/ThreshrClientSpec.groovy +++ b/src/test/groovy/com/graqr/threshr/ThreshrClientSpec.groovy @@ -2,9 +2,9 @@ package com.graqr.threshr import com.graqr.threshr.model.queryparam.Place import com.graqr.threshr.model.queryparam.TargetStorePdpSearch -import com.graqr.threshr.model.redsky.products.pdp.client.PdpClientRoot -import com.graqr.threshr.model.redsky.products.summary.ProductSummaryRoot -import com.graqr.threshr.model.redsky.stores.NearbyStoresRoot +import com.graqr.threshr.model.redsky.product.pdp.client.PdpClientRoot +import com.graqr.threshr.model.redsky.product.summary.ProductSummaryRoot +import com.graqr.threshr.model.redsky.store.nearby.NearbyStoreRoot import io.micronaut.http.HttpResponse import java.util.stream.Collectors @@ -16,7 +16,7 @@ class ThreshrClientSpec extends ThreshrSpec { void "no error requesting product summaries"() { when: - HttpResponse response = threshrClient.productSummaryWithFulfillment( + HttpResponse response = threshrClient.getProductSummary( targetStore, tcin) then: @@ -26,7 +26,7 @@ class ThreshrClientSpec extends ThreshrSpec { void "no error calling pdp client search"() { when: - HttpResponse response = threshrClient.productDetails( + HttpResponse response = threshrClient.getProductDetails( new TargetStorePdpSearch(targetStore), tcin.getTcins().split(",")[0]) @@ -37,7 +37,7 @@ class ThreshrClientSpec extends ThreshrSpec { void 'querying "#place.getPlace()" returns the "#expectedLocationName" store'() { when: - HttpResponse response = threshrClient.queryNearbyStores(5,100, place.getPlace()) + HttpResponse response = threshrClient.getNearbyStores(5,100, place.getPlace()) then: response.body().data().nearbyStores().stores() diff --git a/src/test/groovy/com/graqr/threshr/ThreshrSpec.groovy b/src/test/groovy/com/graqr/threshr/ThreshrSpec.groovy index abe0875..274b9b2 100644 --- a/src/test/groovy/com/graqr/threshr/ThreshrSpec.groovy +++ b/src/test/groovy/com/graqr/threshr/ThreshrSpec.groovy @@ -3,20 +3,18 @@ package com.graqr.threshr import com.graqr.threshr.model.queryparam.Place import com.graqr.threshr.model.queryparam.TargetStore import com.graqr.threshr.model.queryparam.Tcin -import com.graqr.threshr.model.redsky.stores.NearbyStores -import com.graqr.threshr.model.redsky.stores.NearbyStoresRoot -import com.graqr.threshr.model.redsky.stores.Store +import com.graqr.threshr.model.redsky.store.NearbyStore +import com.graqr.threshr.model.redsky.store.Store +import com.graqr.threshr.model.redsky.store.nearby.NearbyStoreRoot import io.micronaut.context.annotation.Value import io.micronaut.core.io.ResourceLoader import io.micronaut.serde.ObjectMapper import io.micronaut.test.extensions.spock.annotation.MicronautTest import jakarta.inject.Inject -import net.datafaker.Faker import spock.lang.Shared import spock.lang.Specification import java.util.stream.Collectors -import java.util.stream.Stream @MicronautTest class ThreshrSpec extends Specification { @@ -30,47 +28,37 @@ class ThreshrSpec extends Specification { @Shared ThreshrClient threshrClient + @Inject @Shared - Faker faker = new Faker() - @Shared - List zipCodesPlus4 = Stream.generate(faker.address()::zipCodePlus4).distinct().limit(50).collect(Collectors.toList()) - @Shared - List zipCodes = Stream.generate(faker.address()::zipCode).distinct().limit(50).collect(Collectors.toList()) - @Shared - List cities = Stream.generate(faker.address()::cityName).limit(50).collect(Collectors.toList()) - @Shared - List states = Stream.generate(faker.address()::state).limit(50).collect(Collectors.toList()) - @Shared - List emptyStrings = Collections.nCopies(26, "").toList() + (Collections.nCopies(26, " ")) + ObjectMapper mapper - @Inject @Shared + @Inject + @Shared ResourceLoader resourceLoader - @Inject @Shared - ObjectMapper mapper - - @Shared @Value('${threshr.test.data.stores}') // $env:THRESHR_TEST_DATA_STORES + @Shared + @Value('${threshr.test.data.stores}') String storesFilePath @Shared List expectedStores - void setupSpec() { - expectedStores = getExpectedLocations(String.format("classpath:%s", storesFilePath)) - } - - List getExpectedLocations(String filePath) { - mapper.readValue(getResourceFromFile(filePath), NearbyStoresRoot.class).data().nearbyStores().stores() - } - byte[] getResourceFromFile(String filepath) { try { return resourceLoader.getResourceAsStream(filepath).get().readAllBytes() - } catch (NoSuchElementException e) { - throw new ThreshrException(String.format("failed to load '%s' for %s.", filepath, this.class.name), e) + } catch (IOException e) { + throw new ThreshrException(String.format("failed to load '%s'.", filepath), e) } } + + void setupSpec() { + expectedStores = mapper.readValue(getResourceFromFile("classpath:" + storesFilePath), NearbyStoreRoot.class) + .data() + .nearbyStores() + .stores() + } + @Shared // TODO configure test data to be provided, not hardcoded TargetStore targetStore = new TargetStore( @@ -89,7 +77,7 @@ class ThreshrSpec extends Specification { void 'querying "#place.getPlace()" returns the "#expectedLocationName" store'() { when: - NearbyStores response = threshrController.queryStoreLocations(place) + NearbyStore response = threshrController.queryStoreLocations(place) then: response.stores() diff --git a/src/test/groovy/com/graqr/threshr/model/queryparam/PageSpec.groovy b/src/test/groovy/com/graqr/threshr/model/queryparam/PageSpec.groovy new file mode 100644 index 0000000..5be9ae7 --- /dev/null +++ b/src/test/groovy/com/graqr/threshr/model/queryparam/PageSpec.groovy @@ -0,0 +1,100 @@ +package com.graqr.threshr.model.queryparam + +import com.graqr.threshr.ThreshrException +import io.micronaut.context.annotation.Value +import io.micronaut.core.io.ResourceLoader +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import jakarta.inject.Inject +import spock.lang.Shared +import spock.lang.Specification + +import java.util.function.Function +import java.util.stream.Stream + +@MicronautTest +class PageSpec extends Specification { + + @Shared + @Value('${threshr.test.data.categories}') + String pagesFilepath + + @Shared + String[] expectedPages + + /** + * Removes any trailing directories in the url. + * + * Example: + * "/c/laundry-care-household-essentials/-/N-5xsyr" is trimmed to "/c/laundry-care-household-essentials" + * "laundry-care-household-essentials/-/N-5xsyr" is trimmed to "laundry-care-household-essentials" + * + */ + @Shared + Function trimExcessPath = original -> { + int endStart = original.trim().startsWith("/c/") ? 3 : 0 + return (original.substring(endStart).contains("/") ? + original.substring(0, original.indexOf("/", endStart)) : + original) + } + + @Inject + @Shared + ResourceLoader resourceLoader + + String[] getLinesFromFile(String filepath) { + try (ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(getResourceFromFile(filepath))) { + try (InputStreamReader inputStreamReader = new InputStreamReader(byteArrayInputStream)) { + try (BufferedReader bufferedReader = new BufferedReader(inputStreamReader)) { + return bufferedReader.lines().toArray(String[]::new) + } + } + } + } + + /** + * Reads in a file as a byte array. + * + * @param filepath prepend "classpath:" if path is in test resource root dir + * @return byte array of the file contents + */ + byte[] getResourceFromFile(String filepath) { + try { + return resourceLoader.getResourceAsStream(filepath).get().readAllBytes() + } catch (NoSuchElementException e) { + throw new ThreshrException(String.format("failed to load '%s'. ", filepath) + e.getMessage(), e) + } + } + + def setupSpec() { + expectedPages = getLinesFromFile("classpath:" + pagesFilepath) + } + + + def "test create new Page from #pageValue seed data creates object with expected value"() { + given: + pageValue = trimExcessPath.apply(pageValue as String) + Page page + + when: + page = new Page(pageValue) //assumed data has "/c/" prepended to string + + then: + page.getPage() == pageValue + + and: + page.setPage(pageValue.replace("/c/", "")) + + then: + page.getPage() == pageValue + + where: + pageValue << Stream.of(expectedPages).map(it -> { + String tempPage = (it as String).trim() + int start = tempPage.startsWith("/c/") ? 3 : 0 + if (tempPage.indexOf("/", start + 1)) { + return tempPage.substring(0, tempPage.indexOf("/", start + 1)) + } + return tempPage + }).toArray(String[]::new) + } +} \ No newline at end of file diff --git a/src/test/groovy/com/graqr/threshr/model/queryparam/PlaceSpec.groovy b/src/test/groovy/com/graqr/threshr/model/queryparam/PlaceSpec.groovy new file mode 100644 index 0000000..92341c7 --- /dev/null +++ b/src/test/groovy/com/graqr/threshr/model/queryparam/PlaceSpec.groovy @@ -0,0 +1,96 @@ +package com.graqr.threshr.model.queryparam + +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import net.datafaker.Faker +import spock.lang.Shared +import spock.lang.Specification + +import java.util.function.Supplier +import java.util.stream.Collectors +import java.util.stream.Stream + +@MicronautTest +class PlaceSpec extends Specification { + + @Shared + Faker faker = new Faker() + + /** + * @param supplier source for string values + * @return list of 50 Strings + */ + List getDistinctList(Supplier supplier) { + return getDistinctList(supplier, 50) + } + + /** + * @param supplier source for string values + * @param count list size to be returned + * @return list of Strings of a given size. + */ + List getDistinctList(Supplier supplier, int count) { + return Stream.generate(supplier).distinct().limit(count).collect(Collectors.toList()) + } + + @Shared + List zipCodesPlus4 = getDistinctList(faker.address()::zipCodePlus4) + + @Shared + List zipCodes = getDistinctList(faker.address()::zipCode) + + @Shared + List cities = getDistinctList(faker.address()::cityName) + + @Shared + List states = getDistinctList(faker.address()::state) + + @Shared + List emptyStrings = Collections.nCopies(26, "").toList() + (Collections.nCopies(26, " ")) + + void 'creating a Place object with "#badZipCode" throws an error'() { + when: + new Place(badZipCode) + + then: + thrown(IllegalArgumentException) + + where: + badZipCode << cities + List.of("", " ") + } + + void 'creating a Place object with "#badCity" and "#badState" throws an error'() { + when: + new Place(badCity, badState) + + then: + thrown(IllegalArgumentException) + + where: + badCity << cities + emptyStrings + badState << emptyStrings + states + } + + void 'creating a Place object with "#goodZip" throws no error'() { + when: + new Place(goodZip) + + then: + noExceptionThrown() + + where: + goodZip << zipCodesPlus4 + zipCodes + } + + void 'creating a Place object with "#goodCity" and "#goodState" throws no error'() { + when: + new Place(goodCity, goodState) + + then: + noExceptionThrown() + + where: + goodCity << cities + goodState << states + } +} + diff --git a/src/test/resources/target_categories.txt b/src/test/resources/target_categories.txt new file mode 100644 index 0000000..1c679cf --- /dev/null +++ b/src/test/resources/target_categories.txt @@ -0,0 +1,94 @@ +/c/shop-all-categories/-/N-5xsxf?prehydrateClick=true +/c/weekly-deals/-/N-4xw74?prehydrateClick=true +/c/target-new-arrivals/-/N-o9rnh?prehydrateClick=true +/c/order-pickup/-/N-ng0a0?l1_nid=5xt1a&prehydrateClick=true +/c/women/-/N-5xtd3 +/c/men/-/N-18y1l +/c/young-adult/-/N-qh1tf +/c/kids/-/N-xcoz4 +/c/shoes/-/N-55b0t +/c/family-outfits/-/N-gi92u +/c/home/-/N-5xtvd +/c/patio-garden/-/N-5xtq9 +/c/kitchen-dining/-/N-hz89j +/c/storage-organization-home/-/N-5xto8 +/c/furniture/-/N-5xtnr +/c/bath-home/-/N-5xtvc +/c/baby/-/N-5xtly +/c/car-seats-baby/-/N-5xtlx +/c/strollers-baby/-/N-5xtk7 +/c/diapering-baby/-/N-5xtlp +/c/nursery-baby/-/N-54v3g +/c/gear-activity-baby/-/N-5xtjv +/c/electronics/-/N-5xtg6 +/c/video-games/-/N-5xtg5 +/c/tvs-home-theater-electronics/-/N-5xtdw +/c/cell-phones-electronics/-/N-5xte8 +/c/wearable-technology-electronics/-/N-551ss +/c/computers-office-electronics/-/N-5xtfc +/c/school-office-supplies/-/N-5xsxr +/c/desk-organization-school-office-supplies/-/N-5xtnz +/c/kids-back-to-school/-/N-5xtyp +/c/on-to-college/-/N-5q0g0 +/c/at-home-learning/-/N-wiae5 +/c/home-office-ideas/-/N-4sm54 +/c/toys/-/N-5xtb0 +/c/character-shop/-/N-5oux8 +/c/stuffed-animals-plush-toys/-/N-5xtat +/c/dolls-toys/-/N-5xt90 +/c/outdoor-toys/-/N-5xtai +/c/sports-outdoors/-/N-5xt85 +/c/exercise-fitness-sports-outdoors/-/N-5xt7d +/c/sports-equipment-outdoors/-/N-5xt52 +/c/swimming-pools-camping-outdoor-recreation-sports-outdoors/-/N-5xt5e +/c/bikes-sports-outdoors/-/N-5xt83 +/c/camping-outdoors-sports/-/N-5xt6e +/c/movies-music-books/-/N-5xsx0 +/c/tv-shows-movies-music-books/-/N-5xswt +/c/music-movies-books/-/N-5xswr +/c/books-movies-music/-/N-5xsxd +/c/ulta-beauty-at-target/-/N-ueo8r +/c/beauty/-/N-55r1x +/c/personal-care/-/N-5xtzq +/c/makeup-beauty/-/N-5xu1e +/c/hair-care-beauty/-/N-5xu0k +/c/skin-care-beauty/-/N-5xtzj +/c/health/-/N-5xu1n +/c/vitamins-supplements-health/-/N-5xu07 +/c/medicines-treatments-health/-/N-5xu09 +/c/nutrition-weight-loss-health/-/N-5xu0d +/c/first-aid-health/-/N-5xu0c +/c/home-health-care/-/N-5xu0a +/c/household-essentials/-/N-5xsz1 +/c/laundry-care-household-essentials/-/N-5xsyr +/c/paper-towels-household-essentials/-/N-4y1o4 +/c/tissue-toilet-paper-household-essentials/-/N-5xsyk +/c/cleaning-supplies-household-essentials/-/N-5xsyy +/c/pets/-/N-5xt44 +/c/dog-supplies-pets/-/N-5xt3t +/c/cat-supplies-pets/-/N-5xt42 +/c/small-animal-supplies-pets/-/N-5xt3d +/c/bird-supplies-pets/-/N-5xt43 +/c/fish-supplies-pets/-/N-5xt3e +/c/grocery/-/N-5xt1a +/c/produce-grocery/-/N-u7fty +/c/meat-seafood-grocery/-/N-5xsyh +/c/dairy-grocery/-/N-5xszm +/c/frozen-foods-grocery/-/N-5xszd +/c/snacks-grocery/-/N-5xsy9 +/c/gift-ideas/-/N-96d2i +/c/party-supplies/-/N-5xt3c +/c/halloween/-/N-5xt2o +/c/christmas/-/N-5xt30 +/c/easter/-/N-5xt1n +/c/gift-ideas-for-mothers/-/N-fh5dt +/c/top-deals/-/N-4xw74 +/c/clearance/-/N-5q0ga +/c/gift-cards/-/N-5xsxu +/c/bullseye-s-playground/-/N-tr36l +/c/target-black-friday/-/N-5q0f2 +/c/furniture-assembly-powered-by-handy/-/N-xluim +/c/optical/-/N-4y8o9 +/c/easy-install/-/N-raym1 +/c/new-parent-services-by-tot-squad/-/N-vorfo +/c/target-privacy-policy/-/N-4sr7p