Giter Club home page Giter Club logo

courier_tracking_couriers_please's Introduction

courier_tracking_couriers_please

Gets tracking information for a Couriers Please connote and returns normalized json response.

Build Status

Usage

const cp_tracker = require('courier_tracking_couriers_please');

cp_tracker("API_KEY", "COURIERS_PLEASE_ACCOUNT", "CONNOTE", (err, r) => {
  if (err) {
    console.log(err);
  } else {
    console.log(r);
  }
});

A valid result will return a response like

{
    connote: 'CPAHOWE000000',
    statusCode: 200,
    courier: 'Couriers Please',
    status: 'delivered',
    pickedUp: true,
    pickedupAt: {
        date: 'Sep 25, 2017',
        time: '10:50am'
    },
    delivered: true,
    deliveredAt: {
        date: 'Sep 27, 2017',
        time: '3:16pm'
    },
    signature: 'http://edi.couriersplease.com.au/api/track/signature.php?image',
    activity: [{
            date: 'Sep 27, 2017',
            time: '3:16pm',
            action: 'Goods delivered: Signed for by:ROB',
            location: 'Australia'
        },
        {
            date: 'Sep 27, 2017',
            time: '12:00pm',
            action: 'On-board for delivery',
            location: 'Australia'
        },
        {
            date: 'Sep 27, 2017',
            time: '5:41am',
            action: 'Arrive at destination depot in transit',
            location: 'Australia'
        },
        {
            date: 'Sep 25, 2017',
            time: '11:24am',
            action: 'Transfer to new depot',
            location: 'Australia'
        },
        {
            date: 'Sep 25, 2017',
            time: '10:50am',
            action: 'Picked Up',
            location: 'Australia'
        }
    ]
}

An error result will look like:

{
  connote: "BLAHBLAH",
  statusCode: 500,
  message: { error: "Invalid Couriers Please connote" }
}

Command Line testing

There is a command line script livetest.js that can be run to get responses in the terminal.

Usage for this is: node livetest.js apikey account connote

Installation

npm install courier_tracking_couriers_please

or

yarn add courier_tracking_couriers_please

Licence

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.