Skip to content

Commit 67885b9

Browse files
committed
remove create_and_buy from batch
1 parent d578a73 commit 67885b9

File tree

4 files changed

+1
-111
lines changed

4 files changed

+1
-111
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Next major release
44

55
- Removed `withCarbonOffset` parameter from `create`, `buy`, and `regenerateRates` functions of the Shipment service as EasyPost now offers Carbon Neutral shipments by default for free
6+
- Removed the undocumented `createAndBuy` function from the `Batch` service. The proper usage is to create a batch first and buy it separately
67

78
## v8.2.1 (2023-10-30)
89

easypost/services/batch_service.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,6 @@ def retrieve(self, id: str) -> Batch:
3434
"""Retrieve a Batch."""
3535
return self._retrieve_resource(self._model_class, id)
3636

37-
def create_and_buy(self, **params) -> Batch:
38-
"""Create and buy a Batch in a single call."""
39-
url = f"{self._class_url(self._model_class)}/create_and_buy"
40-
wrapped_params = {self._snakecase_name(self._model_class): params}
41-
42-
response = Requestor(self._client).request(method=RequestMethod.POST, url=url, params=wrapped_params)
43-
44-
return convert_to_easypost_object(response=response)
45-
4637
def buy(self, id: str, **params) -> Batch:
4738
"""Buy a Batch."""
4839
url = f"{self._instance_url(self._model_class, id)}/buy"

tests/cassettes/test_batch_create_and_buy.yaml

Lines changed: 0 additions & 88 deletions
This file was deleted.

tests/test_batch.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,6 @@ def test_batch_all(page_size, test_client):
3737
assert all(isinstance(batch, Batch) for batch in batches_array)
3838

3939

40-
@pytest.mark.vcr()
41-
def test_batch_create_and_buy(one_call_buy_shipment, test_client):
42-
batch = test_client.batch.create_and_buy(
43-
shipments=[
44-
one_call_buy_shipment,
45-
one_call_buy_shipment,
46-
],
47-
)
48-
49-
assert isinstance(batch, Batch)
50-
assert str.startswith(batch.id, "batch_")
51-
assert batch.num_shipments == 2
52-
53-
5440
@pytest.mark.vcr()
5541
def test_batch_buy(one_call_buy_shipment, test_client, synchronous_sleep_seconds):
5642
function_name = inspect.stack()[0][3]

0 commit comments

Comments
 (0)