Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

rubenochiavone/rastreio-java

Repository files navigation

rastreio-java

Build status Coverage report

A Java library for tracking Correios' shipments. Heavily inspired by https://github.com/talesluna/rastrojs.

Installation

Gradle

implementation 'java.rastreio:rastreio:1.1.0'

Maven

<dependency>
  <groupId>java.rastreio</groupId>
  <artifactId>rastreio</artifactId>
  <version>1.1.0</version>
  <type>pom</type>
</dependency>

Ivy

<dependency org='java.rastreio' name='rastreio' rev='1.1.0'>
  <artifact name='rastreio' ext='pom' ></artifact>
</dependency>

Usage

Track object async:

Rastreio.track("JT124720455BR", new Rastreio.Listener() {
  @Override
  public void onSuccess(TrackObject trackObject) {
    // Use this tracking object
  }
   
  @Override
  public void onFailure(Exception e) {
    // Report exception
    e.printStackTrace();
  }
});

Track object sync:

try {
  TrackObject trackObject = Rastreio.trackSync("JT124720455BR");

  // Use this tracking object
} catch (IOException e) {
  // Report exception
  e.printStackTrace();
}

Docs

Check documentation at https://rubenochiavone.github.io/rastreio-java.

License

Apache License 2.0. See LICENSE.md.