Skip to content

Commit

Permalink
[chore] Remove carbon offset (#423)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
nwithan8 authored Nov 30, 2023
1 parent 4f6c442 commit b70489a
Show file tree
Hide file tree
Showing 49 changed files with 1,235 additions and 2,757 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# CHANGELOG

## NEXT
## Next Release (Major Version)

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

## v6.8.2 (2023-10-20)
Expand Down
2 changes: 1 addition & 1 deletion examples
Submodule examples updated 517 files
1 change: 0 additions & 1 deletion src/models/rate.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import EasyPostObject from './easypost_object';
*/
export default class Rate extends EasyPostObject {
static billing_type;
static carbon_offset;
static carrier_account_id;
static carrier;
static currency;
Expand Down
19 changes: 4 additions & 15 deletions src/services/shipment_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ export default (easypostClient) =>
* Create a {@link Shipment shipment}.
* See {@link https://www.easypost.com/docs/api/node#create-a-shipment EasyPost API Documentation} for more information.
* @param {Object} params - The parameters to create a shipment with.
* @param {boolean} withCarbonOffset - Whether to include a carbon offset for the shipment.
* @returns {Shipment} - The created shipment.
*/
static async create(params, withCarbonOffset = false) {
static async create(params) {
const url = 'shipments';

const wrappedParams = {
shipment: params,
carbon_offset: withCarbonOffset,
};

return this._create(url, wrappedParams);
Expand All @@ -31,17 +29,10 @@ export default (easypostClient) =>
* @param {string} id - The ID of the shipment to purchase.
* @param {Rate} rate - The rate to purchase the shipment with.
* @param {number|null} [insuranceAmount] - The amount of insurance to purchase for the shipment.
* @param {boolean} [withCarbonOffset] - Whether to purchase a carbon offset for the shipment.
* @param {string|null} [endShipperId] - The ID of the end shipper to purchase the shipment with.
* @returns {Shipment} - The purchased shipment.
*/
static async buy(
id,
rate,
insuranceAmount = null,
withCarbonOffset = false,
endShipperId = null,
) {
static async buy(id, rate, insuranceAmount = null, endShipperId = null) {
let rateId = rate;

if (typeof rate === 'object') {
Expand All @@ -54,7 +45,6 @@ export default (easypostClient) =>
rate: {
id: rateId,
},
carbon_offset: withCarbonOffset,
};

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

try {
const response = await easypostClient._post(url, wrappedParams);
Expand Down

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading

0 comments on commit b70489a

Please sign in to comment.