Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] Remove carbon offset #423

Merged
merged 3 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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