Skip to content

Commit

Permalink
Merge pull request #318 from EasyPost/fix_regenerate_rates_type
Browse files Browse the repository at this point in the history
fix regenerate rates type
  • Loading branch information
Justintime50 authored Dec 20, 2023
2 parents 7484869 + ed631c8 commit d387ff6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## v9.0.1 (2023-12-20)

- Corrects the return type of `regenerate_rates`

## v9.0.0 (2023-12-06)

See our [Upgrade Guide](UPGRADE_GUIDE.md#upgrading-from-8x-to-90) for more details.
Expand Down
2 changes: 1 addition & 1 deletion easypost/services/shipment_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def get_next_page(

return self.all(**params)

def regenerate_rates(self, id: str) -> Shipment:
def regenerate_rates(self, id: str) -> Dict[str, List[Rate]]:
"""Regenerate Rates for a Shipment."""
url = f"{self._instance_url(self._model_class, id)}/rerate"

Expand Down
8 changes: 5 additions & 3 deletions easypost/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Dict,
List,
Optional,
Union,
)

from easypost.constant import (
Expand All @@ -24,14 +25,15 @@
InvalidParameterError,
SignatureVerificationError,
)
from easypost.models.rate import Rate


def get_lowest_object_rate(
easypost_object: EasyPostObject,
easypost_object: Union[EasyPostObject, Dict[str, Any]],
carriers: Optional[List[str]] = None,
services: Optional[List[str]] = None,
rates_key: str = "rates",
):
) -> Rate:
"""Gets the lowest rate of an EasyPost object such as a Shipment, Order, or Pickup."""
carriers = carriers or []
services = services or []
Expand All @@ -53,7 +55,7 @@ def get_lowest_object_rate(
return lowest_rate


def get_lowest_smart_rate(smart_rates, delivery_days: int, delivery_accuracy: str):
def get_lowest_smart_rate(smart_rates: List[Rate], delivery_days: int, delivery_accuracy: str) -> Rate:
"""Get the lowest SmartRate from a list of SmartRates."""
valid_delivery_accuracy_values = {
"percentile_50",
Expand Down

0 comments on commit d387ff6

Please sign in to comment.