Skip to content

Graqr/Threshr

Repository files navigation

Threshr - The Target Grocery Harvester

GitHub code size in bytes license GitHub last commit GitHub commit activity


Quality Gate Status

    Security

    Security Rating Code Smells Bugs Coverage Vulnerabilities

    Usability / Maintainability

    Reliability Rating Duplicated Lines Lines of Code Technical Debt


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.

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. Add settings.xml to your ~/.m2/ directory (swapping Batman's name and password for your GitHub user and the token from step 1

Include as a Maven Dependency

<dependency>
  <groupId>com.graqr</groupId>
  <artifactId>threshr</artifactId>
  <version>0.0.12</version>
</dependency>

Include as a Gradle dependency

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.

THRESHR_KEY=BatKey
THRESHR_CHANNEL=WEB

⚠️ 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

Usage

Threshr doesn't support all redsky endpoints (not yet). There are three endpoints currently supported:

List<ProductSummary> 	fetchProductSummaries(TargetStore targetStore, Tcin tcin);
List<ProductSummary> 	fetchProductSummaries(TargetStore targetStore, String... tcin) throws ThreshrException;
Product 	fetchProductDetails(TargetStore targetStore, String tcin);
NearbyStores 	queryStoreLocations(Place place); // default values for limit and within
NearbyStores 	queryStoreLocations(int limit, int within, Place place);

Want to get involved?

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!