From b7a84a8674c650e9f69e9ab359df88a21b962a88 Mon Sep 17 00:00:00 2001 From: jonathan zollinger Date: Mon, 27 May 2024 12:17:06 -0600 Subject: [PATCH 1/9] chore: bump version to 0.0.13-SNAPSHOT Signed-off-by: jonathan zollinger --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3f3bdf1..10fec43 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.graqr threshr - 0.0.12 + 0.0.13-SNAPSHOT ${packaging} From 3d540787f1da96b274af048a42346885a70f6981 Mon Sep 17 00:00:00 2001 From: jonathan zollinger Date: Mon, 27 May 2024 12:17:49 -0600 Subject: [PATCH 2/9] chore: bump mn version to 4.4.3 Signed-off-by: jonathan zollinger --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 10fec43..9e91e97 100644 --- a/pom.xml +++ b/pom.xml @@ -10,14 +10,14 @@ io.micronaut.platform micronaut-parent - 4.4.1 + 4.4.3 jar 17 17 - 4.2.0 + 4.4.3 graqr graqr https://sonarcloud.io From caf37aca0ad0e27159f62076bf6e85e730a45539 Mon Sep 17 00:00:00 2001 From: jonathan zollinger Date: Tue, 18 Jun 2024 23:36:10 -0600 Subject: [PATCH 3/9] fix(build): disable maven shade plugin this configures compiled jar to be not-a-fat-jar Signed-off-by: jonathan zollinger --- pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pom.xml b/pom.xml index 9e91e97..1fe91fa 100644 --- a/pom.xml +++ b/pom.xml @@ -131,6 +131,12 @@ + + maven-shade-plugin + + true + + io.micronaut.maven micronaut-maven-plugin From 132bb49e6682cba8173bcad49b20f474338eca66 Mon Sep 17 00:00:00 2001 From: jonathan zollinger Date: Tue, 18 Jun 2024 23:56:25 -0600 Subject: [PATCH 4/9] fix: remove opportunity for nullpointer in checkForNull Signed-off-by: jonathan zollinger --- src/main/java/com/graqr/threshr/Threshr.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/com/graqr/threshr/Threshr.java b/src/main/java/com/graqr/threshr/Threshr.java index 914fad7..c71ba5c 100644 --- a/src/main/java/com/graqr/threshr/Threshr.java +++ b/src/main/java/com/graqr/threshr/Threshr.java @@ -142,10 +142,7 @@ public Store getStore(String storeId, String channel, Page page) throws ThreshrE */ 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())); + throw new ThreshrException("response body is null or of an unexpected type.\n" + response); } return response.body(); } From a4895e4a9ee7fd1adff09755d48675a0402c5720 Mon Sep 17 00:00:00 2001 From: jonathan zollinger Date: Wed, 19 Jun 2024 11:22:04 -0600 Subject: [PATCH 5/9] refactor: remove old, irrelevant comment Signed-off-by: jonathan zollinger --- src/test/groovy/com/graqr/threshr/ThreshrControllerSpec.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/groovy/com/graqr/threshr/ThreshrControllerSpec.groovy b/src/test/groovy/com/graqr/threshr/ThreshrControllerSpec.groovy index c85f0f8..86b069e 100644 --- a/src/test/groovy/com/graqr/threshr/ThreshrControllerSpec.groovy +++ b/src/test/groovy/com/graqr/threshr/ThreshrControllerSpec.groovy @@ -23,7 +23,6 @@ class ThreshrControllerSpec extends ThreshrSpec { sql = Sql.newInstance(url) } - // https://github.com/Graqr/Threshr/issues/67 void "query pdp for #tcinArg tcin strings"() { when: if (count == 1){ From 56dc6b13d95214b0253ec6a4f3af6d63dc744f4f Mon Sep 17 00:00:00 2001 From: jonathan zollinger Date: Wed, 19 Jun 2024 14:51:39 -0600 Subject: [PATCH 6/9] test: validate bad requests are handled Signed-off-by: jonathan zollinger --- .../groovy/com/graqr/threshr/ThreshrControllerSpec.groovy | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/test/groovy/com/graqr/threshr/ThreshrControllerSpec.groovy b/src/test/groovy/com/graqr/threshr/ThreshrControllerSpec.groovy index 86b069e..3823ffb 100644 --- a/src/test/groovy/com/graqr/threshr/ThreshrControllerSpec.groovy +++ b/src/test/groovy/com/graqr/threshr/ThreshrControllerSpec.groovy @@ -23,6 +23,14 @@ class ThreshrControllerSpec extends ThreshrSpec { sql = Sql.newInstance(url) } + void "null-bodied response from redsky is handled gracefully"() { + when: "querying a non-existent tcin" + threshrController.fetchProductSummaries(targetStore, "imAFakeTcin") + + then: "Threshr exception thrown" + thrown(ThreshrException) + } + void "query pdp for #tcinArg tcin strings"() { when: if (count == 1){ From 61c1f93bfcb4b7180f0ea3933eb585fba924f642 Mon Sep 17 00:00:00 2001 From: jonathan zollinger Date: Wed, 19 Jun 2024 15:05:09 -0600 Subject: [PATCH 7/9] chore: bump micronaut version to 4.5.0 Signed-off-by: jonathan zollinger --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 1fe91fa..999c54c 100644 --- a/pom.xml +++ b/pom.xml @@ -10,14 +10,14 @@ io.micronaut.platform micronaut-parent - 4.4.3 + 4.5.0 jar 17 17 - 4.4.3 + 4.5.0 graqr graqr https://sonarcloud.io From 3af7f27a7b50f38ec63a72a5028098e655f8c13d Mon Sep 17 00:00:00 2001 From: jonathan zollinger Date: Wed, 19 Jun 2024 15:55:21 -0600 Subject: [PATCH 8/9] docs: update README per #135 --- README.md | 68 ++++++++++++++++++++----------------------------------- 1 file changed, 24 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index bc8c1cc..cdb811d 100644 --- a/README.md +++ b/README.md @@ -39,24 +39,18 @@ ## Summary -Threshr is a wrapper library for Target Corporation's redsky api. The redsky api has endpoints for querying product and store information. This includes fulfillment options, pricing, vendors, etc. +Threshr is a wrapper library for various grocery store api's. This includes querying specific store pricing and product data. +### Projects using threshr + +Other projects using threshr include other graqr projects like the [threshr cli] and [harvester] ## Install -This project's artifacts are hosted on GitHub. Follow [these instructions] in order to include threshr in your maven or -gradle projects. -
    -
    My summary of GitHub's Instructions -
      - At the time of writing this, GitHub doesn't support using GitHub-hosted artifacts without first authenticating. You can do this in two steps: -
    1. Generate a personal access token with read:packages privileges.
    2. -
    3. Add settings.xml to your ~/.m2/ directory (swapping Batman's name and password for your GitHub user and the token from step 1
    4. -
    -
    -
+Threshr is available to jvm projects via [maven central]. + +
Maven -#### Include as a Maven Dependency ```xml com.graqr @@ -64,47 +58,29 @@ gradle projects. 0.0.12 ``` -#### Include as a Gradle dependency -```groovy -compile "com.graqr:threshr:0.0.12" -``` - -#### Environment Variables - -You'll need to add api `key` and `CHANNEL` values to environment variables `THRESHR_KEY` and `THRESHR_CHANNEL`. I like using a `.env` file like the one below. -```properties -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
    -In the network tab in your browser's dev tools, search for any endpoints from the `redsky.target.com` domain. Below I'm in firefox, from whose context menu I'm given the option to copy an api call's parameters. +
-![redsky_network-tab_firefox.gif](media%2Fredsky_network-tab_firefox.gif) -
+
Gradle -## Usage +```groovy +implementation group: 'com.graqr', name: 'threshr', version: '0.0.12' +``` +
-Threshr doesn't support all redsky endpoints (not yet). There are three endpoints currently supported: +
Gradle Kotlin -```java -List fetchProductSummaries(TargetStore targetStore, Tcin tcin); -List fetchProductSummaries(TargetStore targetStore, String... tcin) throws ThreshrException; -``` -```java -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); +```kotlin +implementation("com.graqr:threshr:0.0.12") ``` +
-___ +> [!NOTE] +> See the [testing README] for more information about all the needed environment variables, as well as tips and best practices. ### Want to get involved? -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! +See our [contributing] doc before taking a whack at any [open issues]. Also be sure to read the [testing README] for some tips and tricks. We'd love for you to work with us! [Bugs]:https://sonarcloud.io/api/project_badges/measure?project=Graqr_Threshr&metric=bugs @@ -144,3 +120,7 @@ See our [contributing] doc before taking a whack at any [open issues]. Also be s [these instructions]:https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry +[testing README]:src\test\groovy\com\graqr\threshr\README.md +[maven central]:https://central.sonatype.com/artifact/com.graqr/threshr/overview +[threshr cli]:https://github.com/Graqr/threshr-cli +[harvester]:https://github.com/Graqr/Harvester \ No newline at end of file From 8745dcbb443ff6c0a8082f29526c7035b9064c54 Mon Sep 17 00:00:00 2001 From: jonathan zollinger Date: Wed, 19 Jun 2024 16:03:30 -0600 Subject: [PATCH 9/9] chore: bump threshr version to 0.0.13 --- README.md | 8 ++++---- pom.xml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index cdb811d..bafd5a0 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Threshr is available to jvm projects via [maven central]. com.graqr threshr - 0.0.12 + 0.0.13 ``` @@ -64,14 +64,14 @@ Threshr is available to jvm projects via [maven central].
Gradle ```groovy -implementation group: 'com.graqr', name: 'threshr', version: '0.0.12' +implementation group: 'com.graqr', name: 'threshr', version: '0.0.13' ```
Gradle Kotlin ```kotlin -implementation("com.graqr:threshr:0.0.12") +implementation("com.graqr:threshr:0.0.13") ```
@@ -123,4 +123,4 @@ See our [contributing] doc before taking a whack at any [open issues]. Also be s [testing README]:src\test\groovy\com\graqr\threshr\README.md [maven central]:https://central.sonatype.com/artifact/com.graqr/threshr/overview [threshr cli]:https://github.com/Graqr/threshr-cli -[harvester]:https://github.com/Graqr/Harvester \ No newline at end of file +[harvester]:https://github.com/Graqr/Harvester diff --git a/pom.xml b/pom.xml index 999c54c..5bb4589 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.graqr threshr - 0.0.13-SNAPSHOT + 0.0.13 ${packaging}