Skip to content

Commit

Permalink
remove create_and_buy from batch (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
jchen293 authored Nov 29, 2023
1 parent d578a73 commit df53807
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 111 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Next major release

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

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

Expand Down
9 changes: 0 additions & 9 deletions easypost/services/batch_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@ def retrieve(self, id: str) -> Batch:
"""Retrieve a Batch."""
return self._retrieve_resource(self._model_class, id)

def create_and_buy(self, **params) -> Batch:
"""Create and buy a Batch in a single call."""
url = f"{self._class_url(self._model_class)}/create_and_buy"
wrapped_params = {self._snakecase_name(self._model_class): params}

response = Requestor(self._client).request(method=RequestMethod.POST, url=url, params=wrapped_params)

return convert_to_easypost_object(response=response)

def buy(self, id: str, **params) -> Batch:
"""Buy a Batch."""
url = f"{self._instance_url(self._model_class, id)}/buy"
Expand Down
88 changes: 0 additions & 88 deletions tests/cassettes/test_batch_create_and_buy.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions tests/test_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,6 @@ def test_batch_all(page_size, test_client):
assert all(isinstance(batch, Batch) for batch in batches_array)


@pytest.mark.vcr()
def test_batch_create_and_buy(one_call_buy_shipment, test_client):
batch = test_client.batch.create_and_buy(
shipments=[
one_call_buy_shipment,
one_call_buy_shipment,
],
)

assert isinstance(batch, Batch)
assert str.startswith(batch.id, "batch_")
assert batch.num_shipments == 2


@pytest.mark.vcr()
def test_batch_buy(one_call_buy_shipment, test_client, synchronous_sleep_seconds):
function_name = inspect.stack()[0][3]
Expand Down

0 comments on commit df53807

Please sign in to comment.