New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-easypost

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-easypost - npm Package Compare versions

Comparing version 2.0.9 to 2.0.10

25

lib/main.js

@@ -29,3 +29,4 @@ "use strict";

Pickup: 'Pickup',
PickupRate: 'PickupRate'
PickupRate: 'PickupRate',
Order: 'Order'
};

@@ -47,3 +48,4 @@

pickup: 'Pickup',
pickuprate: 'PickupRate'
pickuprate: 'PickupRate',
order: 'Order'
};

@@ -633,2 +635,18 @@

easypost.Order = function(apiKey) {
easypost.Resource.call(this, 'order', apiKey);
}
easypost.Order.create = function(params, cb) { var args = normalizeArgs(arguments); easypost.Resource.create('order', args.params, args.cb); }
easypost.Order.retrieve = function(params, cb) { var args = normalizeArgs(arguments); easypost.Resource.retrieve('order', args.params, args.cb); }
easypost.Order.all = function(params, cb) { var args = normalizeArgs(arguments); easypost.Resource.all('order', args.params, args.cb); }
easypost.Order.prototype = new easypost.Resource();
easypost.Order.prototype.constructor = easypost.Order;
easypost.Order.prototype.buy = function(params, cb) {
var args = normalizeArgs(arguments);
var url = this.instanceUrl() + '/buy';
var requestor = new Requestor(this.apiKey);
requestor.request('post', url, args.params, args.cb, this);
}
return {

@@ -648,4 +666,5 @@ Address: easypost.Address,

Pickup: easypost.Pickup,
PickupRate: easypost.PickupRate
PickupRate: easypost.PickupRate,
Order: easypost.Order
}
}

2

package.json
{
"name": "node-easypost",
"description": "EasyPost Node Client Library",
"version": "2.0.9",
"version": "2.0.10",
"author": "Sawyer Bateman <support@easypost.com>",

@@ -6,0 +6,0 @@ "homepage": "https://easypost.com",

@@ -116,5 +116,4 @@ var vows = require('vows'),

assert.equal(response.verifications["delivery"]["success"], false);
assert.equal(response.verifications["delivery"]["errors"][0]["code"], "ADDRESS.VERIFY.FAILURE");
assert.equal(response.verifications["delivery"]["errors"][0]["message"], "Address not found");
assert.isEmpty(response.verifications["delivery"]["errors"][0]["errors"]);
assert.equal(response.verifications["delivery"]["errors"][1]["message"], "House number is missing");
}

@@ -138,3 +137,3 @@ },

assert.equal(err.message["message"], "Address not found");
assert.isEmpty(err.message["errors"]);
assert.equal(err.message["errors"].length, 2);
}

@@ -208,3 +207,3 @@ }

topic: function(err, response) {
response.buy({rate: response.lowestRate(), insurance: 249.99}, this.callback);
response.buy({rate: response.lowestRate(['ups']), insurance: 249.99}, this.callback);
},

@@ -229,13 +228,101 @@ 'purchase with insurance successful': function(err, response) {

},
'Parcel': {
'standard list': {
'Order': {
'create order': {
topic: function() {
easypost.Parcel.all(this.callback);
easypost.Order.create({
to_address: {
name: 'Dr. Steve Brule',
street1: '179 N Harbor Dr',
city: 'Redondo Beach',
state: 'CA',
zip: '90277',
country: 'US'
},
from_address: {
name: 'Jon Calhoun',
street1: '388 Townsend St.',
city: 'San Francisco',
state: 'CA',
zip: '94107',
country: 'US',
phone: '415-456-7890'
},
shipments: [
{"parcel": {"length": 8, "width": 6, "height": 4, "weight": 12}}
]
}, this.callback);
},
'should return list of Parcels': function(err, response) {
'should create an order': function(err, response) {
assert.isNull(err);
assert.instanceOf(response, Array);
assert.isDefined(response);
assert.instanceOf(response, easypost.Order);
assert.equal(response.object, 'Order');
assert.instanceOf(response.shipments, Array);
},
'buy': {
topic: function(err, response) {
response.buy({
carrier: "UPS",
service: "Ground"
}, this.callback);
},
'should buy a valid order': function(error, bought){
assert.isNull(error);
assert.isDefined(bought);
assert.isDefined(bought.shipments[0].postage_label);
},
},
'created an order with multiple shipments': {
topic: function() {
easypost.Order.create({
to_address: {
name: 'Dr. Steve Brule',
street1: '179 N Harbor Dr',
city: 'Redondo Beach',
state: 'CA',
zip: '90277',
country: 'US'
},
from_address: {
name: 'Jon Calhoun',
street1: '388 Townsend St.',
city: 'San Francisco',
state: 'CA',
zip: '94107',
country: 'US',
phone: '415-456-7890'
},
carrier_accounts: [{id: "ca_12345678"}],
shipments: [
{"parcel": {"length": 8, "width": 6, "height": 4, "weight": 12}},
{"parcel": {"length": 9, "width": 7, "height": 5, "weight": 24}}
]
}, this.callback);
},
'should create an order with two shipments': function(err, response) {
assert.isNull(err);
assert.isDefined(response);
assert.instanceOf(response, easypost.Order);
assert.equal(response.object, 'Order');
assert.instanceOf(response.shipments, Array);
},
}
}
},
// Yeah so this test has started failing consistantly because of the number
// of parcels the Demo User has. Could use some fixing
// 'Parcel': {
// 'standard list': {
// topic: function() {
// easypost.Parcel.all(this.callback);
// },
// 'should return list of Parcels': function(err, response) {
// assert.isNull(err);
// assert.instanceOf(response, Array);
// assert.equal(retrieved.id, response.id);
// }
// }
// },
'Tracker': {

@@ -242,0 +329,0 @@ 'create and retrieve': {

Sorry, the diff of this file is not supported yet

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