Skip to content

Add /estimates/ecommerce API support #70

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

Merged
merged 1 commit into from
Aug 11, 2022
Merged

Add /estimates/ecommerce API support #70

merged 1 commit into from
Aug 11, 2022

Conversation

holtbp
Copy link
Contributor

@holtbp holtbp commented Aug 10, 2022

What

  • Adds patch.estimates.create_ecommerce_estimate method

Why

New endpoint for our ecommerce customers!

SDK Release Checklist

  • Have you added an integration test for the changes?
  • Have you built the library locally and made queries against it successfully?
  • Did you update the changelog?
  • Did you bump the package version?
  • If endpoints were removed, did you manually remove the corresponding files? (this should be rare)
  • For breaking changes, did you plan for the release of the new SDK versions and deploy the API to production?

@holtbp holtbp requested a review from a team August 10, 2022 20:51
@holtbp holtbp marked this pull request as ready for review August 10, 2022 20:51
@@ -137,20 +137,24 @@ patch.estimates.create_mass_estimate(mass_g=mass_g, project_id=project_id)

# Create a flight estimate
distance_m = 1_000_000 # Pass in the distance traveled in meters
patch.estimates.create_mass_estimate(distance_m=distance_m)
patch.estimates.create_flight_estimate(distance_m=distance_m)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈

@holtbp
Copy link
Contributor Author

holtbp commented Aug 11, 2022

>>> import os
>>> import patch_api
>>> patch = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY'))
>>> distance_m = 1_000_000 # Pass in the distance traveled in meters
>>> transportation_method = "rail"
>>> package_mass_g = 5000
>>> estimate = patch.estimates.create_ecommerce_estimate(
...   distance_m=distance_m,
...   transportation_method=transportation_method,
...   package_mass_g=package_mass_g
... )
>>> print(estimate)
{'data': {'id': 'est_test_d43572a2c2e992dcbce24cb666c82a42',
          'mass_g': 69,
          'order': None,
          'production': False,
          'type': 'ecommerce'},
 'error': None,
 'success': True}

@holtbp holtbp merged commit 727cd79 into main Aug 11, 2022
@holtbp holtbp deleted the bh-ecommerce-api branch August 11, 2022 00:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants