Skip to content

Commit 4b06c67

Browse files
authoredFeb 9, 2021
[1.3.0] Add support for Flight/Vehicle/Shipping estimates (#11)
1 parent 3fbd09a commit 4b06c67

15 files changed

+709
-21
lines changed
 

Diff for: ‎CHANGELOG.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.3.0] - 2021-02-08
9+
10+
### Added
11+
12+
- Adds support for creating Shipping/Flight/Vehicle estimates.
13+
- Sets the library version to 1.3.0 to track the [Patch Ruby SDK](https://github.com/patch-technology/patch-ruby) and [Patch Node SDK](https://github.com/patch-technology/patch-node).
14+
815
## [1.0.1] - 2021-01-22
916

1017
### Added
1118

1219
- Pre-release of v1 Library
1320
- Adds support for Orders, Estimates, Projects and Preferences
14-

Diff for: ‎Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
SHELL = /bin/bash
22

33
build:
4-
pip install -r requirements.txt \
4+
pip install -r requirements.txt && \
55
python setup.py install
66

77
lint:
@@ -12,4 +12,4 @@ test:
1212
pip install -r requirements.txt && \
1313
python -m unittest discover test/
1414

15-
.PHONY: build test lint publish
15+
.PHONY: build lint test

Diff for: ‎README.md

+18-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ For a complete API reference, check out [Patch's API Reference.](https://docs.us
1212

1313
Add the library to your `requirements.txt` file:
1414
```txt
15-
patch_api >= 1.0.1
15+
patch_api >= 1.3.0
1616
```
1717

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

107107
# Create an estimate
108-
109108
mass_g = 1_000_000 # Pass in the mass in grams (i.e. 1 metric tonne)
110109
patch.estimates.create_estimate(mass_g=mass_g)
111110

112111
## You can also specify a project-id field (optional) to be used instead of the preferred one
113112
project_id = 'pro_test_1234' # Pass in the project's ID
114113
patch.estimates.create_estimate(mass_g=mass_g, project_id=project_id)
115114

115+
# Create a flight estimate
116+
distance_m = 1_000_000 # Pass in the distance traveled in meters
117+
patch.estimates.create_estimate(distance_m=distance_m)
118+
119+
# Create a shipping estimate
120+
distance_m = 1_000_000 # Pass in the distance traveled in meters
121+
transportation_method = "rail"
122+
package_mass_g = 5000
123+
patch.estimates.create_estimate(distance_m=distance_m, transportation_method=transportation_method, package_mass_g=package_mass_g)
124+
125+
# Create a vehicle estimate
126+
distance_m = 1_000_000 # Pass in the distance traveled in meters
127+
make = "Toyota"
128+
model = "Corolla"
129+
year = 1995
130+
patch.estimates.create_estimate(distance_m=distance_m, make=make, model=model, year=year)
131+
116132
# Retrieve an estimate
117133
estimate_id = 'est_test_1234'
118134
patch.estimates.retrieve_estimate(id=estimate_id)

Diff for: ‎patch_api/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from __future__ import absolute_import
1717

18-
__version__ = "1.0.0"
18+
__version__ = "1.3.0"
1919

2020
# import ApiClient
2121
from patch_api.api_client import ApiClient

0 commit comments

Comments
 (0)
Please sign in to comment.