Skip to content

Commit

Permalink
object_status changes
Browse files Browse the repository at this point in the history
  • Loading branch information
guozhen-la committed Apr 5, 2017
1 parent e2b8585 commit 6172f17
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 21 deletions.
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ The snippet below demonstrates how to create an address object (a Shippo `Resour
var shippo = require('shippo')('<YOUR_PRIVATE_KEY>');

shippo.address.create({
'object_purpose' : 'PURCHASE',
'name' : 'Mr Hippo',
'company' : 'SF Zoo',
'street1' : '2945 Sloat Blvd',
Expand All @@ -58,7 +57,6 @@ the creation of CustomsItems and CustomsDeclaration objects.
```js

var addressFrom = {
"object_purpose":"PURCHASE",
"name":"Ms Hippo",
"company":"Shippo",
"street1":"215 Clayton St.",
Expand All @@ -72,7 +70,6 @@ var addressFrom = {

// example address_to object dict
var addressTo = {
"object_purpose":"PURCHASE",
"name":"Ms Hippo",
"company":"Shippo",
"street1":"803 Clayton St.",
Expand Down Expand Up @@ -104,11 +101,9 @@ var parcelTwo = {
};

var shipment = {
"object_purpose": "PURCHASE",
"address_from": addressFrom,
"address_to": addressTo,
"parcel": [parcelOne, parcelTwo],
"submission_type": "DROPOFF"
"parcels": [parcelOne, parcelTwo],
};

shippo.transaction.create({
Expand All @@ -123,7 +118,7 @@ shippo.transaction.create({
})
.then(function(mpsTransactions) {
mpsTransactions.results.forEach(function(mpsTransaction){
if(mpsTransaction.object_status == "SUCCESS") {
if(mpsTransaction.status == "SUCCESS") {
console.log("Label URL: %s", mpsTransaction.label_url);
console.log("Tracking Number: %s", mpsTransaction.tracking_number);
} else {
Expand Down
2 changes: 1 addition & 1 deletion example.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ shippo.customsdeclaration.create({
return shippo.shipment.create({
"address_from": addressFrom,
"address_to": addressTo,
"parcel": parcel,
"parcels": [parcel],
"customs_declaration": customsDeclaration.object_id,
"async": false
})
Expand Down
10 changes: 5 additions & 5 deletions example_batch.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ var myBatch = {
"phone": "4151234567",
"email": "[email protected]"
},
"parcel": {
"parcels": {
"length": "5",
"width": "5",
"height": "5",
"distance_unit": "in",
"weight": "2",
"mass_unit": "oz"
}
}]
}
},
{
Expand All @@ -77,14 +77,14 @@ var myBatch = {
"phone": "4151234567",
"email": "[email protected]"
},
"parcel": {
"parcels": [{
"length": "5",
"width": "5",
"height": "5",
"distance_unit": "in",
"weight": "20",
"mass_unit": "lb"
}
}]
}
}
]
Expand Down Expand Up @@ -132,7 +132,7 @@ var shipments = []
shippo.shipment.create({
"address_from": addressFrom,
"address_to": addressTo,
"parcel": parcel,
"parcels": [parcel],
"async": false
}).then(function(shipmentResponse) {
console.log("Shipment created with object id: %s", shipmentResponse.object_id);
Expand Down
16 changes: 8 additions & 8 deletions test/Batch.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ describe('Batch Resource', function() {
"phone": "4151234567",
"email": "[email protected]"
},
"parcel": {
"parcels": [{
"length": "5",
"width": "5",
"height": "5",
"distance_unit": "in",
"weight": "2",
"mass_unit": "oz"
}
}]
}
},
{
Expand All @@ -158,14 +158,14 @@ describe('Batch Resource', function() {
"phone": "4151234567",
"email": "[email protected]"
},
"parcel": {
"parcels": [{
"length": "5",
"width": "5",
"height": "5",
"distance_unit": "in",
"weight": "20",
"mass_unit": "lb"
}
}]
},
"carrier_account": "a4391cd4ab974f478f55dc08b5c8e3b3",
"servicelevel_token": "fedex_2_day"
Expand Down Expand Up @@ -206,14 +206,14 @@ describe('Batch Resource', function() {
"phone": "4151234567",
"email": "[email protected]"
},
"parcel": {
"parcels": [{
"length": "5",
"width": "5",
"height": "5",
"distance_unit": "in",
"weight": "2",
"mass_unit": "oz"
}
}]
}
},
{
Expand All @@ -240,14 +240,14 @@ describe('Batch Resource', function() {
"phone": "4151234567",
"email": "[email protected]"
},
"parcel": {
"parcels": [{
"length": "5",
"width": "5",
"height": "5",
"distance_unit": "in",
"weight": "20",
"mass_unit": "lb"
}
}]
},
"carrier_account": "a4391cd4ab974f478f55dc08b5c8e3b3",
"servicelevel_token": "fedex_2_day"
Expand Down

0 comments on commit 6172f17

Please sign in to comment.