@easypost/api
Advanced tools
Comparing version 3.8.1 to 3.9.1
{ | ||
"name": "@easypost/api", | ||
"description": "EasyPost Node Client Library", | ||
"version": "3.8.1", | ||
"version": "3.9.1", | ||
"author": "Easypost Engineering <support@easypost.com>", | ||
@@ -6,0 +6,0 @@ "homepage": "https://easypost.com", |
108
README.md
# EasyPost Node Client Library | ||
EasyPost is a simple shipping API. You can sign up for an account at https://easypost.com | ||
EasyPost is a simple shipping API. You can sign up for an account at https://easypost.com. | ||
[![Build Status](https://travis-ci.org/EasyPost/easypost-node.svg?branch=master)](https://travis-ci.org/EasyPost/easypost-node) | ||
[![Build Status](https://travis-ci.com/EasyPost/easypost-node.svg?branch=master)](https://travis-ci.com/EasyPost/easypost-node) | ||
[![npm version](https://badge.fury.io/js/%40easypost%2Fapi.svg)](https://badge.fury.io/js/%40easypost%2Fapi) | ||
Installation | ||
------------ | ||
## Installation | ||
``` | ||
```bash | ||
npm install --save @easypost/api | ||
``` | ||
Note: if you are using a version of Node less than 6.9, you will need to install and | ||
**Note:** if you are using a version of Node less than 6.9, you will need to install and | ||
include a polyfill, such as `babel-polyfill`, and include it in your project: | ||
``` | ||
```bash | ||
npm install --save babel-polyfill | ||
@@ -23,3 +23,3 @@ ``` | ||
``` | ||
```javascript | ||
require('babel-polyfill'); | ||
@@ -29,21 +29,12 @@ const EasyPost = require('@easypost/api'); | ||
To test out the API, you can run `npm install -g @easypost/api` and run | ||
`easypost`. you can also clone this repository, `npm install` to install | ||
dependencies, `npm run build` to build the project, and run | ||
`API_KEY=yourkey ./repl.js --local easypost.js` to try out an interactive CLI. | ||
(Replace easypost.js with whatever compatabile version you wish, as defined | ||
below.) | ||
## Compatability | ||
Compatability | ||
------------- | ||
By default, @easypost/api works with Node v6 LTS. To include for other versions | ||
of node, you can use: | ||
* `require('@easypost/api/easypost.8-lts.js')` (Node 8.9+ | ||
* `require('@easypost/api/easypost.8-lts.js')` (Node 8.9+) | ||
* `require('@easypost/api/easypost.6-lts.js')` (Node 6.9+) | ||
* `require('@easypost/api/easypost.legacy.js')` (Node 0.10+) | ||
Example | ||
------- | ||
## Example | ||
@@ -87,8 +78,7 @@ ```javascript | ||
Options | ||
------- | ||
### Options | ||
You can construct an API instance with certain options: | ||
``` | ||
```javascript | ||
const api = new Api("mykey", { | ||
@@ -105,3 +95,3 @@ timeout: 120000, | ||
Time in MS that should fail requests. | ||
Time in milliseconds that should fail requests. | ||
@@ -118,3 +108,2 @@ #### baseUrl | ||
#### superagentMiddleware | ||
@@ -125,3 +114,3 @@ | ||
``` | ||
```javascript | ||
import superagentLib from 'some-superagent-lib'; | ||
@@ -134,3 +123,2 @@ | ||
#### requestMiddleware | ||
@@ -141,3 +129,3 @@ | ||
``` | ||
```javascript | ||
import superagentLib from 'some-superagent-lib'; | ||
@@ -153,10 +141,62 @@ | ||
## Development | ||
Note on ES6 Usage | ||
----------------- | ||
To test out the API, you can run the following: | ||
```bash | ||
npm install -g @easypost/api | ||
easypost | ||
``` | ||
### Install Dependencies | ||
```bash | ||
npm install | ||
``` | ||
### Build | ||
Build the various versions of the client library by running the following: | ||
```bash | ||
npm run build | ||
``` | ||
### Testing | ||
Run unit tests by running the following: | ||
```bash | ||
npm test | ||
``` | ||
### Interactive CLI | ||
Replace `easypost.js` with whatever compatabile version you wish, as defined | ||
under `Compatibility`. | ||
```bash | ||
API_KEY=yourkey ./repl.js --local easypost.js | ||
``` | ||
## Releasing | ||
1. Update the version in the `package.json` file | ||
1. Update the `CHANGELOG` file | ||
1. Tag the release on GitHub | ||
1. Publish the updated npm package | ||
## Note on ES6 Usage | ||
You can import specific versions of the compiled code if you're using later | ||
verisons of node. `import "@easypost/api/src/easypost"` imports the | ||
un-transformed es6, or you can import `@easypost/api/easypost.6-lts`, | ||
`@easypost/api/easypost.8-lts`, or `@easypost/api/easypost.legacy.js` (v0.10) | ||
to import mininally transformed versions. | ||
versions of Node. | ||
```javascript | ||
// Imports the un-transformed es6 | ||
import "@easypost/api/src/easypost" | ||
// Use the following to import mininally transformed versions | ||
import "@easypost/api/easypost.6-lts" | ||
import "@easypost/api/easypost.8-lts" | ||
import "@easypost/api/easypost.legacy.js" // (v0.10) | ||
``` |
@@ -35,6 +35,2 @@ import T from 'proptypes'; | ||
static all() { | ||
return this.notImplemented('all'); | ||
} | ||
static delete() { | ||
@@ -41,0 +37,0 @@ return this.notImplemented('delete'); |
@@ -21,6 +21,2 @@ import T from 'proptypes'; | ||
static retrieve() { | ||
return this.notImplemented('retrieve'); | ||
} | ||
async save() { | ||
@@ -27,0 +23,0 @@ return this.constructor.notImplemented('save'); |
@@ -130,12 +130,2 @@ import T from 'proptypes'; | ||
async return() { | ||
this.verifyParameters({ | ||
this: ['id', 'to_address', 'from_address'], | ||
}); | ||
const data = this.toJSON(); | ||
data.is_return = true; | ||
return this.rpc('', data); | ||
} | ||
lowestRate(carriers, services) { | ||
@@ -142,0 +132,0 @@ let rates = this.rates || []; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
194
843887
43
8782
1