Skip to content

Add /estimates/ecommerce API support - #70

Merged
holtbp merged 1 commit into
mainfrom
bh-ecommerce-api
Aug 11, 2022
Merged

Add /estimates/ecommerce API support#70
holtbp merged 1 commit into
mainfrom
bh-ecommerce-api

Conversation

@holtbp

@holtbp holtbp commented Aug 10, 2022

Copy link
Copy Markdown
Contributor

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
Comment thread README.md
# 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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🙈

@holtbp

holtbp commented Aug 11, 2022

Copy link
Copy Markdown
Contributor Author
>>> 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

2 participants