Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

shipit

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shipit

This module allows you to connect to many shipping carriers like UPS and FedEx and download tracking data for your packages in a common schema

  • 0.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
142
increased by12.7%
Maintainers
1
Weekly downloads
 
Created
Source

What is this?

shipit is a node module that allows you to retrieve data from shipping carriers like UPS and FedEx in a common format. It interfaces with tracking APIs when available, and falls back to screen scraping. For carriers that expose tracking APIs, user is expected to acquire and provide credentials like license numbers, meter numbers, user IDs and passwords.

Carriers supported

  • UPS
  • FedEx

Usage

Add shipit to your package.json and then npm install it.

npm install shipit

Use it to initialize the shipper clients with your account credentials.

{UpsClient, FedexClient} = require 'shipit'

ups = new UpsClient
  licenseNumber: '1C999A999B999999'
  userId: 'shipit-user'
  password: 'shhh-secret'

fedex = new FedexClient
  key: 'xyxyxyxyabababab'
  password: 'asdfawasfdasdfasdf1'
  account: '123456789'
  meter: '99999999'

Use an initialized client to request tracking data.

ups.requestData {trackingNumber: '1Z1234567890123456'}, (err, result) ->
  console.log "[ERROR] error retrieving tracking data #{err}" if err?
  console.log "[DEBUG] new tracking data received #{JSON.stringify(result)}" if result?

Example response returned:

{
    "status": 2,
    "activities": [
        {
            "location": "Memphis, TN 38118",
            "timestamp": "2014-02-16T22:19:00.000Z",
            "details": "Departed FedEx location"
        },
        {
            "location": "East Hanover, NJ 07936",
            "timestamp": "2014-02-15T23:57:00.000Z",
            "details": "Left FedEx origin facility"
        },
        {
            "location": "East Hanover, NJ 07936",
            "timestamp": "2014-02-15T15:57:00.000Z",
            "details": "Picked up"
        }
    ],
    "weight": "0.2 LB",
    "service": "FedEx Priority Overnight",
    "eta": "2014-02-17T15:30:00.000Z",
    "destination": "US"
}

Building

Clone this repo (or first fork it)

git clone git@github.com:sailrish/shipit.git

Install dependencies

npm install

Just use grunt.

$ grunt
Running "coffee:compile" (coffee) task

Running "mochaTest:src" (mochaTest) task
 3   -_-__,------,
 0   -_-__|  /\_/\ 
 0   -_-_~|_( ^ .^) 
     -_-_ ""  "" 

  3 passing (11ms)


Done, without errors.

Adding new shipping carriers

  • Extend the common class ShipperClient
  • Implement necessary methods
    • generateRequest(trk, reference)
    • requestOptions({trk, reference})
    • validateResponse(response, cb)

Credits

I learnt how to build a node module from Nick Desaulniers here. This article talks about everything you need to know - using grunt to set up test tasks, using mocha and chai for testing, and how to npm publish, etc.

Keywords

FAQs

Package last updated on 22 Feb 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc