Skip to content

Commit

Permalink
Merge pull request #334 from EasyPost/deprecate_create_list
Browse files Browse the repository at this point in the history
chore: deprecate the create_list function
  • Loading branch information
Justintime50 authored Jun 14, 2024
2 parents e67b779 + c1ba1b0 commit 748b984
Show file tree
Hide file tree
Showing 8 changed files with 1,726 additions and 1,015 deletions.
11 changes: 10 additions & 1 deletion easypost/services/tracker_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
List,
Optional,
)
from warnings import warn

from easypost.constant import _FILTERS_KEY
from easypost.models import Tracker
Expand Down Expand Up @@ -61,7 +62,15 @@ def get_next_page(
return self.all(**params)

def create_list(self, trackers: List[Dict[str, Any]]) -> None:
"""Create a list of Trackers."""
"""Create a list of Trackers.
NOTE: This function is deprecated, use the create function instead.
"""
warn(
"This function is deprecated, use the create function instead.",
DeprecationWarning,
stacklevel=2,
)
url = f"{self._class_url(self._model_class)}/create_list"
wrapped_params = {"trackers": trackers}

Expand Down
2 changes: 1 addition & 1 deletion examples
Submodule examples updated 467 files
718 changes: 456 additions & 262 deletions tests/cassettes/test_order_buy.yaml

Large diffs are not rendered by default.

354 changes: 220 additions & 134 deletions tests/cassettes/test_order_create.yaml

Large diffs are not rendered by default.

649 changes: 409 additions & 240 deletions tests/cassettes/test_order_get_rates.yaml

Large diffs are not rendered by default.

352 changes: 219 additions & 133 deletions tests/cassettes/test_order_lowest_rate.yaml

Large diffs are not rendered by default.

649 changes: 408 additions & 241 deletions tests/cassettes/test_order_retrieve.yaml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions tests/test_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ def test_order_lowest_rate(basic_order, test_client):

# Test lowest rate with no filters
lowest_rate = order.lowest_rate()
assert lowest_rate.service == "First"
assert lowest_rate.rate == "6.07"
assert lowest_rate.service == "GroundAdvantage"
assert lowest_rate.rate == "11.33"
assert lowest_rate.carrier == "USPS"

# Test lowest rate with service filter (this rate is higher than the lowest but should filter)
lowest_rate_service = order.lowest_rate(services=["Priority"])
assert lowest_rate_service.service == "Priority"
assert lowest_rate_service.rate == "7.15"
assert lowest_rate_service.rate == "13.79"
assert lowest_rate_service.carrier == "USPS"

# Test lowest rate with carrier filter (should error due to bad carrier)
Expand Down

0 comments on commit 748b984

Please sign in to comment.