Skip to content

Commit c3d183c

Browse files
committed
Re-add and format Node Luma examples
1 parent 30718d1 commit c3d183c

3 files changed

Lines changed: 90 additions & 0 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const EasyPost = require("@easypost/api");
2+
3+
const api = new EasyPost("EASYPOST_API_KEY");
4+
5+
(async () => {
6+
const shipment = await api.Shipment.retrieve("shp_...");
7+
await shipment.buy(shipment.lowestRate());
8+
9+
console.log(shipment);
10+
})();
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const EasyPost = require("@easypost/api");
2+
3+
const api = new EasyPost("EASYPOST_API_KEY");
4+
5+
(async () => {
6+
const shipment = await api.Shipment.create({
7+
to_address: {
8+
name: "Dr. Steve Brule",
9+
street1: "5744 Silverton Ave",
10+
city: "McKinney",
11+
state: "TX",
12+
zip: "75070",
13+
country: "US",
14+
phone: "8573875756",
15+
email: "dr_steve_brule@gmail.com",
16+
},
17+
from_address: {
18+
name: "EasyPost",
19+
street1: "417 Montgomery Street",
20+
street2: "5th Floor",
21+
city: "San Francisco",
22+
state: "CA",
23+
zip: "94104",
24+
country: "US",
25+
phone: "4153334445",
26+
email: "support@easypost.com",
27+
},
28+
parcel: {
29+
length: 20.2,
30+
width: 10.9,
31+
height: 5,
32+
weight: 65.9,
33+
},
34+
carrier_accounts: ["ca_1", "ca_2"],
35+
service: "Priority",
36+
carrier: "USPS",
37+
});
38+
39+
console.log(shipment);
40+
})();
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const EasyPostClient = require("@easypost/api");
2+
3+
const client = new EasyPostClient("EASYPOST_API_KEY");
4+
5+
(async () => {
6+
const promise = await client.Shipment.lumaPromise({
7+
to_address: {
8+
name: "Dr. Steve Brule",
9+
street1: "5744 Silverton Ave",
10+
city: "McKinney",
11+
state: "TX",
12+
zip: "75070",
13+
country: "US",
14+
phone: "8573875756",
15+
email: "dr_steve_brule@gmail.com",
16+
},
17+
from_address: {
18+
name: "EasyPost",
19+
street1: "417 Montgomery Street",
20+
street2: "5th Floor",
21+
city: "San Francisco",
22+
state: "CA",
23+
zip: "94104",
24+
country: "US",
25+
phone: "4153334445",
26+
email: "support@easypost.com",
27+
},
28+
parcel: {
29+
length: 20.2,
30+
width: 10.9,
31+
height: 5,
32+
weight: 65.9,
33+
},
34+
ruleset_name: "test_ruleset_deliver_by_2",
35+
planned_ship_date: "2025-07-03",
36+
deliver_by_date: "2025-07-06",
37+
});
38+
39+
console.log(promise);
40+
})();

0 commit comments

Comments
 (0)