Skip to content

Commit

Permalink
- Remove createAndBuy function (#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
nwithan8 authored Dec 1, 2023
1 parent b70489a commit 676653d
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 200 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- 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
- Remove `createAndBuy` function from `Batch` service (deprecated endpoint server-side)

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

Expand Down
19 changes: 0 additions & 19 deletions src/services/batch_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,25 +105,6 @@ export default (easypostClient) =>
}
}

/**
* Create and purchase a {@link Batch batch} in a single request.
* See {@link https://www.easypost.com/docs/api/node#batches EasyPost API Documentation} for more information.
* @param {Object} params - Parameters for the batch to be created and purchased.
* @returns {Batch} - The created and purchased batch.
*/
static async createAndBuy(params) {
const url = `batches/create_and_buy`;
const wrappedParams = { batch: params };

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

return this._convertToEasyPostObject(response.body, wrappedParams);
} catch (e) {
return Promise.reject(e);
}
}

/**
* Purchase a {@link Batch batch}.
* See {@link https://www.easypost.com/docs/api/node#buy-a-batch EasyPost API Documentation} for more information.
Expand Down

This file was deleted.

10 changes: 0 additions & 10 deletions test/services/batch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,6 @@ describe('Batch Service', function () {
});
});

it('creates and buys a batch in a single call', async function () {
const batch = await this.client.Batch.createAndBuy({
shipments: [Fixture.oneCallBuyShipment(), Fixture.oneCallBuyShipment()],
});

expect(batch).to.be.an.instanceOf(Batch);
expect(batch.id).to.match(/^batch_/);
expect(batch.num_shipments).to.equal(2);
});

it('buys a batch', async function () {
const batch = await this.client.Batch.create({
shipments: [Fixture.oneCallBuyShipment()],
Expand Down

0 comments on commit 676653d

Please sign in to comment.