Skip to content

Commit d578a73

Browse files
authored
Remove withCarbonOffset param (#309)
1 parent 582439f commit d578a73

46 files changed

Lines changed: 5061 additions & 5851 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## Next major release
4+
5+
- 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+
37
## v8.2.1 (2023-10-30)
48

59
- Fixes a bug where `get_next_page` functions threw an error, preventing users from retrieving the final page of results

easypost/services/shipment_service.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ def __init__(self, client):
2424
self._client = client
2525
self._model_class = Shipment.__name__
2626

27-
def create(self, with_carbon_offset: Optional[bool] = False, **params) -> Shipment:
27+
def create(self, **params) -> Shipment:
2828
"""Create a Shipment."""
2929
url = self._class_url(self._model_class)
3030
wrapped_params = {
3131
self._snakecase_name(self._model_class): params,
32-
"carbon_offset": with_carbon_offset,
3332
}
3433

3534
response = Requestor(self._client).request(method=RequestMethod.POST, url=url, params=wrapped_params)
@@ -73,12 +72,11 @@ def get_next_page(
7372

7473
return self.all(**params)
7574

76-
def regenerate_rates(self, id: str, with_carbon_offset: Optional[bool] = False) -> Shipment:
75+
def regenerate_rates(self, id: str) -> Shipment:
7776
"""Regenerate Rates for a Shipment."""
7877
url = f"{self._instance_url(self._model_class, id)}/rerate"
79-
wrapped_params = {"carbon_offset": with_carbon_offset}
8078

81-
response = Requestor(self._client).request(method=RequestMethod.POST, url=url, params=wrapped_params)
79+
response = Requestor(self._client).request(method=RequestMethod.POST, url=url)
8280

8381
return convert_to_easypost_object(response=response)
8482

@@ -93,13 +91,11 @@ def get_smart_rates(self, id: str) -> List[Rate]:
9391
def buy(
9492
self,
9593
id: str,
96-
with_carbon_offset: Optional[bool] = False,
9794
end_shipper_id: Optional[str] = None,
9895
**params,
9996
) -> Shipment:
10097
"""Buy a Shipment."""
10198
url = f"{self._instance_url(self._model_class, id)}/buy"
102-
params["carbon_offset"] = with_carbon_offset
10399
if end_shipper_id:
104100
params["end_shipper_id"] = end_shipper_id
105101

tests/cassettes/test_batch_add_remove_shipment.yaml

Lines changed: 107 additions & 108 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/cassettes/test_error.yaml

Lines changed: 10 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/cassettes/test_insurance_all.yaml

Lines changed: 34 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)