Skip to content

[1.3.0] Add support for Flight/Vehicle/Shipping estimates #11

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 5 commits into from
Feb 9, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.3.0] - 2021-02-08

### Added

- Adds support for creating Shipping/Flight/Vehicle estimates.
- Sets the librayr version to 1.3.5 to track the [Patch Ruby SDK](https://github.com/patch-technology/patch-ruby) and [Patch Node SDK](https://github.com/patch-technology/patch-node).

## [1.0.1] - 2021-01-22

### Added
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SHELL = /bin/bash

build:
pip install -r requirements.txt \
pip install -r requirements.txt && \
python setup.py install

lint:
Expand All @@ -12,4 +12,4 @@ test:
pip install -r requirements.txt && \
python -m unittest discover test/

.PHONY: build test lint publish
.PHONY: build lint test
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ For a complete API reference, check out [Patch's API Reference.](https://docs.us

Add the library to your `requirements.txt` file:
```txt
patch_api >= 1.0.1
patch_api >= 1.3.0
```

Then run:
Expand Down Expand Up @@ -105,14 +105,30 @@ import patch_api
patch = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY'))

# Create an estimate

mass_g = 1_000_000 # Pass in the mass in grams (i.e. 1 metric tonne)
patch.estimates.create_estimate(mass_g=mass_g)

## You can also specify a project-id field (optional) to be used instead of the preferred one
project_id = 'pro_test_1234' # Pass in the project's ID
patch.estimates.create_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_estimate(distance_m=distance_m)

# Create a shipping estimate
distance_m = 1_000_000 # Pass in the distance traveled in meters
transportation_method = "rail"
package_mass_g = 5000
patch.estimates.create_estimate(distance_m=distance_m, transportation_method=transportation_method, package_mass_g=package_mass_g)

# Create a vehicle estimate
distance_m = 1_000_000 # Pass in the distance traveled in meters
make = "Toyota"
model = "Corolla"
year = 1995
patch.estimates.create_estimate(distance_m=distance_m, make=make, model=model, year=year)

# Retrieve an estimate
estimate_id = 'est_test_1234'
patch.estimates.retrieve_estimate(id=estimate_id)
Expand Down
2 changes: 1 addition & 1 deletion patch_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from __future__ import absolute_import

__version__ = "1.0.0"
__version__ = "1.3.0"

# import ApiClient
from patch_api.api_client import ApiClient
Expand Down
Loading