npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

shipwire

v1.0.3

Published

Node library to communicate with the Shipwire API

Downloads

3

Readme

shipwire

Node.js library to communicate with the Shipwire API

Note: this library is no longer in development as Shipwire's XML API (V2) has been superseded by their recently released REST API (V3). This library will not be compatible with API V3.

Features

Current

Install

npm install --save shipwire

Usage

var Shipwire = require('shipwire');
var shipwire = new Shipwire(USERNAME, PASSWORD);

shipwire.trackAll(function(err, orders) {
	//array of orders;
})

Methods

Shipwire

new Shipwire(username, password, options)

Sets your credentials and connection settings, and returns a shipwire object to use for your requests.

username - String (required). Your Shipwire account username, typically an email.

password - String (required). Your Shipwire account password.

options - Object (optional)

  • sandbox - Boolean. Whether to use the sandboxed environment, or production environment. Default: false
  • test - Boolean. Whether to use Shipwire's Test server (which returns properly formatted sample responses), or the Production server, which returns responses based on the data in your account. Default: false

Track

trackAll

shipwire.trackAll(options, callback)

options - Object (optional)

  • raw - Boolean. Whether to return the raw XML response. Otherwise returns JSON. Default: false
  • bookmark - Number. 1 returns all orders, 2 returns orders since the last bookmark, 3 return all orders since bookmark, and resets the bookmark to the current time. Default: 1

callback - Function (required)

  • err - Object. Returns error object if applicable, otherwise null.
  • orders - Array. Returns an array of orders.

trackByOrderNumber

shipwire.trackByOrderNumber(orderNumber, options, callback)

orderNumber - String (required)

The order number to use. This is generally an id submitted along with an order to Shipwire.

options - Object (optional)

  • raw - Boolean. Whether to return the raw XML response. Otherwise returns JSON. Default: false

callback - Function (required)

  • err - Object. Returns error object if applicable, otherwise null.
  • orders - Object. Returns an array of tracking statuses for the order.

trackById

shipwire.trackById(id, options, callback)

id - String (required)

The Shipwire ID to use. This is an id generated by Shipwire.

options - Object (optional)

  • raw - Boolean. Whether to return the raw XML response. Otherwise returns JSON. Default: false

callback - Function (required)

  • err - Object. Returns error object if applicable, otherwise null.
  • orders - Object. Returns an array of tracking statuses for the order.

Inventory

inventoryStatus

shipwire.inventoryStatus(options, callback)

options - Object (optional)

  • warehouse - String. Which warehouse should be search, otherwise all are searched. Valid options are "TOR", "CHI", "LAX", "PHL", "VAN", "UK", "HKG"
  • warehouseCountry - String. Which set of warehouses should be searched. Valid options are "CA", "US", "GB", "HK"
  • productCodes - Array or String. Can be an array of product SKUs to search. Can also be a single SKU as a string.
  • includeEmpty - Boolean. If true, all products, even which have never had inventory, will be returned. Default: false
  • raw - Boolean. Whether to return the raw XML response. Otherwise returns JSON. Default: false

callback - Function (required)

  • err - Object. Returns error object if applicable, otherwise null.
  • products - Array. Returns an array of products.

Rate Request

rateRequest

shipwire.rateRequest(orders, options, callback)

orders - Array or Object (required)

Can be a single order object or an array of order objects. An order object is formatted like so:

{
	id: "12578",//a custom id for the order. String
	products: [//an array of products; can also be a single object
		{
			code: "sun-0001",//SKU code for the product
			quantity: 2//quantity of items. Number, optional, default: 1
		}
	],
	shippingAddress: {
		fullName: "Bob Loblaw.",//individual or company name. String, optional.
		company: "Bob Loblaw's Law Blog",//up to 25 characters. String, optional.
		address1: "151 Sterling Road",//address line 1. String.
		address2: "#2",//address line 2. String, optional.
		city: "Toronto",//city. String.
		province: "ON",//"state", "province", "region" are interchangeable. If state or prov, use 2-letter code, otherwise, full name. String.
		country: "CA",//2-letter ISO code. String, optional.
		postalCode: "M6R 2B2", //"zip", and "postal code" are interchangeable. String.
		commercial: true,//Is it a business address? Boolean, optional, default: false.
		POBox: ""//Is it a POBox?null by default. Boolean or null, optional, default: null.
	},
	warehouse: "00"//optimal warehouse. Possible values are: "TOR", "LAX", "VAN", "PHL", "CHI", "REN, "UK", "HKG", and "00". String, optional, default: "00".
}

options - Object (optional)

  • raw - Boolean. Whether to return the raw XML response. Otherwise, returns JSON. Default: false

callback - Function (required)

  • err - Object. Returns error object if applicable, otherwise null.
  • orders - Array or Object. Returns orders with shipping quotes as well as the original order attached. If an array was passed as the orders argument, an array will be returned. Otherwise, a single object will be returned.

Tests

Run npm test to run the tests with mocha. Tests will also run automatically before git commit

Issues and Feature Requests

If you have issues to report, or issues to request, use the issue tracker in Github.

Contributing

Currently, the library isn't very feature rich or mature. If you'd like to offer improvements:

  1. Fork it
  2. Create your feature branch git checkout -b feature-name
  3. Commit your changes git commit -am 'Add feature' *
  4. Push the branch git push origin feature-name
  5. Create a pull request

* Prior to a commit, linting and testing will be performed automatically using precommit-hook

Contact

Have a question? I'm on twitter: @dhritzkiv

License

MIT