Skip to content

Commit b70489a

Browse files
authored
[chore] Remove carbon offset (#423)
- Remove `withCarbonOffset` parameter for shipment creation and buy functions - Remove `carbon_offset` property of `Rate` object - Remove carbon offset unit tests, TypeScript definitions - Remove old cassettes, re-record as needed
1 parent 4f6c442 commit b70489a

File tree

49 files changed

+1235
-2757
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1235
-2757
lines changed

CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# CHANGELOG
22

3-
## NEXT
3+
## Next Release (Major Version)
44

5+
- Remove `withCarbonOffset` parameter from shipment create and buy functions
6+
- Remove `carbon_offset` property of `Rate` object
57
- Fixes a pagination issue by passing along additional params used when fetching first page
68

79
## v6.8.2 (2023-10-20)

examples

Submodule examples updated 517 files

src/models/rate.js

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import EasyPostObject from './easypost_object';
77
*/
88
export default class Rate extends EasyPostObject {
99
static billing_type;
10-
static carbon_offset;
1110
static carrier_account_id;
1211
static carrier;
1312
static currency;

src/services/shipment_service.js

+4-15
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@ export default (easypostClient) =>
1111
* Create a {@link Shipment shipment}.
1212
* See {@link https://www.easypost.com/docs/api/node#create-a-shipment EasyPost API Documentation} for more information.
1313
* @param {Object} params - The parameters to create a shipment with.
14-
* @param {boolean} withCarbonOffset - Whether to include a carbon offset for the shipment.
1514
* @returns {Shipment} - The created shipment.
1615
*/
17-
static async create(params, withCarbonOffset = false) {
16+
static async create(params) {
1817
const url = 'shipments';
1918

2019
const wrappedParams = {
2120
shipment: params,
22-
carbon_offset: withCarbonOffset,
2321
};
2422

2523
return this._create(url, wrappedParams);
@@ -31,17 +29,10 @@ export default (easypostClient) =>
3129
* @param {string} id - The ID of the shipment to purchase.
3230
* @param {Rate} rate - The rate to purchase the shipment with.
3331
* @param {number|null} [insuranceAmount] - The amount of insurance to purchase for the shipment.
34-
* @param {boolean} [withCarbonOffset] - Whether to purchase a carbon offset for the shipment.
3532
* @param {string|null} [endShipperId] - The ID of the end shipper to purchase the shipment with.
3633
* @returns {Shipment} - The purchased shipment.
3734
*/
38-
static async buy(
39-
id,
40-
rate,
41-
insuranceAmount = null,
42-
withCarbonOffset = false,
43-
endShipperId = null,
44-
) {
35+
static async buy(id, rate, insuranceAmount = null, endShipperId = null) {
4536
let rateId = rate;
4637

4738
if (typeof rate === 'object') {
@@ -54,7 +45,6 @@ export default (easypostClient) =>
5445
rate: {
5546
id: rateId,
5647
},
57-
carbon_offset: withCarbonOffset,
5848
};
5949

6050
if (insuranceAmount) {
@@ -98,12 +88,11 @@ export default (easypostClient) =>
9888
* Regenerate {@link Rate rates} for a {@link Shipment shipment}.
9989
* See {@link https://www.easypost.com/docs/api/node#regenerate-rates-for-a-shipment EasyPost API Documentation} for more information.
10090
* @param {string} id - The ID of the shipment to regenerate rates for.
101-
* @param {boolean} withCarbonOffset - Whether to include a carbon offset for the shipment.
10291
* @returns {Shipment} - The shipment with regenerated rates.
10392
*/
104-
static async regenerateRates(id, withCarbonOffset = false) {
93+
static async regenerateRates(id) {
10594
const url = `shipments/${id}/rerate`;
106-
const wrappedParams = { carbon_offset: withCarbonOffset };
95+
const wrappedParams = {};
10796

10897
try {
10998
const response = await easypostClient._post(url, wrappedParams);

test/cassettes/Batch-Service_3950244400/adds-and-removes-shipments-from-a-batch_444431701/recording.har

+67-79
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/cassettes/Error-Service_386538342/pulls-out-error-properties-of-an-API-error_2733221812/recording.har

+13-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/cassettes/Insurance-Service_1251316388/creates-an-insurance-object_4069302148/recording.har

+29-37
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/cassettes/Insurance-Service_1251316388/retrieves-an-insurance-object_1368608920/recording.har

+56-60
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/cassettes/Pickup-Service_2981084322/buys-a-pickup_1934475561/recording.har

+46-62
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/cassettes/Pickup-Service_2981084322/cancels-a-pickup_4207662041/recording.har

+61-77
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/cassettes/Pickup-Service_2981084322/creates-a-pickup_320342919/recording.har

+34-42
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/cassettes/Pickup-Service_2981084322/gets-the-lowest-rate_906620131/recording.har

+38-46
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/cassettes/Pickup-Service_2981084322/retrieves-a-pickup_3320623723/recording.har

+52-60
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)