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

remove create_and_buy from batch #310

Merged
merged 1 commit into from
Nov 29, 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
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