Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5201b0a

Browse files
authoredJan 10, 2025··
Remove unused api endpoints (#77)
* Remove unused api endpoints * Lint
1 parent e4c9472 commit 5201b0a

16 files changed

+42
-1569
lines changed
 

‎.pre-commit-config.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
repos:
2-
- repo: https://github.com/pre-commit/pre-commit-hooks
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
33
rev: v4.0.1
44
hooks:
5-
- id: check-yaml
6-
- id: end-of-file-fixer
7-
- id: trailing-whitespace
8-
- id: name-tests-test
9-
- repo: https://github.com/pycqa/flake8
10-
rev: '4.0.1'
5+
- id: check-yaml
6+
- id: end-of-file-fixer
7+
- id: trailing-whitespace
8+
- id: name-tests-test
9+
- repo: https://github.com/pycqa/flake8
10+
rev: "4.0.1"
1111
hooks:
12-
- id: flake8
13-
args: ['--config=.flake8']
14-
- repo: https://github.com/psf/black
15-
rev: 22.6.0
12+
- id: flake8
13+
args: ["--config=.flake8"]
14+
- repo: https://github.com/psf/black
15+
rev: 24.10.0
1616
hooks:
17-
- id: black
17+
- id: black

‎patch_api/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from __future__ import absolute_import
1717

18-
__version__ = "2.1.1"
18+
__version__ = "2.3.0"
1919

2020
# import ApiClient
2121
from patch_api.api_client import ApiClient

‎patch_api/api/estimates_api.py

Lines changed: 0 additions & 594 deletions
Large diffs are not rendered by default.

‎patch_api/api_client.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def __init__(
9292
self.default_headers[header_name] = header_value
9393
self.cookie = cookie
9494
# Set default User-Agent.
95-
self.user_agent = "patch-python/2.1.1"
95+
self.user_agent = "patch-python/2.3.0"
9696
# Set default Patch-Version
9797
self.patch_version = 2
9898

@@ -142,9 +142,6 @@ def patch_version(self):
142142
def patch_version(self, value):
143143
self.default_headers["Patch-Version"] = value
144144

145-
def set_default_header(self, header_name, header_value):
146-
self.default_headers[header_name] = header_value
147-
148145
def __call_api(
149146
self,
150147
resource_path,
@@ -163,6 +160,7 @@ def __call_api(
163160
_request_timeout=None,
164161
_host=None,
165162
):
163+
166164
config = self.configuration
167165

168166
# header parameters

‎patch_api/configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def to_debug_report(self):
341341
"OS: {env}\n"
342342
"Python Version: {pyversion}\n"
343343
"Version of the API: 2\n"
344-
"SDK Package Version: 2.1.1".format(env=sys.platform, pyversion=sys.version)
344+
"SDK Package Version: 2.3.0".format(env=sys.platform, pyversion=sys.version)
345345
)
346346

347347
def get_host_settings(self):

‎patch_api/models/__init__.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@
2424
from patch_api.models.create_ecommerce_estimate_request import (
2525
CreateEcommerceEstimateRequest,
2626
)
27-
from patch_api.models.create_ethereum_estimate_request import (
28-
CreateEthereumEstimateRequest,
29-
)
3027
from patch_api.models.create_flight_estimate_request import CreateFlightEstimateRequest
3128
from patch_api.models.create_hotel_estimate_request import CreateHotelEstimateRequest
3229
from patch_api.models.create_mass_estimate_request import CreateMassEstimateRequest
@@ -41,13 +38,7 @@
4138
from patch_api.models.create_sea_shipping_estimate_request import (
4239
CreateSeaShippingEstimateRequest,
4340
)
44-
from patch_api.models.create_shipping_estimate_request import (
45-
CreateShippingEstimateRequest,
46-
)
4741
from patch_api.models.create_success_response import CreateSuccessResponse
48-
from patch_api.models.create_vehicle_estimate_request import (
49-
CreateVehicleEstimateRequest,
50-
)
5142
from patch_api.models.delete_order_response import DeleteOrderResponse
5243
from patch_api.models.disclaimer import Disclaimer
5344
from patch_api.models.error_response import ErrorResponse

‎patch_api/models/create_ethereum_estimate_request.py

Lines changed: 0 additions & 258 deletions
This file was deleted.

‎patch_api/models/create_order_line_item_request.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ def vintage_year(self, vintage_year):
134134
if (
135135
self.local_vars_configuration.client_side_validation
136136
and vintage_year is not None
137-
and vintage_year > 2100
137+
and vintage_year > 2225
138138
): # noqa: E501
139139
raise ValueError(
140-
"Invalid value for `vintage_year`, must be a value less than or equal to `2100`"
140+
"Invalid value for `vintage_year`, must be a value less than or equal to `2225`"
141141
) # noqa: E501
142142
if (
143143
self.local_vars_configuration.client_side_validation
@@ -171,10 +171,10 @@ def vintage_start_year(self, vintage_start_year):
171171
if (
172172
self.local_vars_configuration.client_side_validation
173173
and vintage_start_year is not None
174-
and vintage_start_year > 2100
174+
and vintage_start_year > 2225
175175
): # noqa: E501
176176
raise ValueError(
177-
"Invalid value for `vintage_start_year`, must be a value less than or equal to `2100`"
177+
"Invalid value for `vintage_start_year`, must be a value less than or equal to `2225`"
178178
) # noqa: E501
179179
if (
180180
self.local_vars_configuration.client_side_validation
@@ -208,10 +208,10 @@ def vintage_end_year(self, vintage_end_year):
208208
if (
209209
self.local_vars_configuration.client_side_validation
210210
and vintage_end_year is not None
211-
and vintage_end_year > 2100
211+
and vintage_end_year > 2225
212212
): # noqa: E501
213213
raise ValueError(
214-
"Invalid value for `vintage_end_year`, must be a value less than or equal to `2100`"
214+
"Invalid value for `vintage_end_year`, must be a value less than or equal to `2225`"
215215
) # noqa: E501
216216
if (
217217
self.local_vars_configuration.client_side_validation
@@ -329,7 +329,7 @@ def unit(self, unit):
329329
:param unit: The unit of this CreateOrderLineItemRequest. # noqa: E501
330330
:type: str
331331
"""
332-
allowed_values = [None, "g", "Wh"] # noqa: E501
332+
allowed_values = [None, "g"] # noqa: E501
333333
if (
334334
self.local_vars_configuration.client_side_validation
335335
and unit not in allowed_values

‎patch_api/models/create_order_request.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,10 @@ def vintage_year(self, vintage_year):
201201
if (
202202
self.local_vars_configuration.client_side_validation
203203
and vintage_year is not None
204-
and vintage_year > 2100
204+
and vintage_year > 2225
205205
): # noqa: E501
206206
raise ValueError(
207-
"Invalid value for `vintage_year`, must be a value less than or equal to `2100`"
207+
"Invalid value for `vintage_year`, must be a value less than or equal to `2225`"
208208
) # noqa: E501
209209
if (
210210
self.local_vars_configuration.client_side_validation
@@ -238,10 +238,10 @@ def vintage_start_year(self, vintage_start_year):
238238
if (
239239
self.local_vars_configuration.client_side_validation
240240
and vintage_start_year is not None
241-
and vintage_start_year > 2100
241+
and vintage_start_year > 2225
242242
): # noqa: E501
243243
raise ValueError(
244-
"Invalid value for `vintage_start_year`, must be a value less than or equal to `2100`"
244+
"Invalid value for `vintage_start_year`, must be a value less than or equal to `2225`"
245245
) # noqa: E501
246246
if (
247247
self.local_vars_configuration.client_side_validation
@@ -275,10 +275,10 @@ def vintage_end_year(self, vintage_end_year):
275275
if (
276276
self.local_vars_configuration.client_side_validation
277277
and vintage_end_year is not None
278-
and vintage_end_year > 2100
278+
and vintage_end_year > 2225
279279
): # noqa: E501
280280
raise ValueError(
281-
"Invalid value for `vintage_end_year`, must be a value less than or equal to `2100`"
281+
"Invalid value for `vintage_end_year`, must be a value less than or equal to `2225`"
282282
) # noqa: E501
283283
if (
284284
self.local_vars_configuration.client_side_validation
@@ -396,7 +396,7 @@ def unit(self, unit):
396396
:param unit: The unit of this CreateOrderRequest. # noqa: E501
397397
:type: str
398398
"""
399-
allowed_values = [None, "g", "Wh"] # noqa: E501
399+
allowed_values = [None, "g"] # noqa: E501
400400
if (
401401
self.local_vars_configuration.client_side_validation
402402
and unit not in allowed_values

‎patch_api/models/create_shipping_estimate_request.py

Lines changed: 0 additions & 294 deletions
This file was deleted.

‎patch_api/models/create_vehicle_estimate_request.py

Lines changed: 0 additions & 288 deletions
This file was deleted.

‎patch_api/models/estimate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def production(self, production):
137137
def type(self):
138138
"""Gets the type of this Estimate. # noqa: E501
139139
140-
The type of estimate. Available types are mass, flight, shipping, vehicle, and crypto. # noqa: E501
140+
The type of estimate. Available types are mass, flight, shipping, and crypto. # noqa: E501
141141
142142
:return: The type of this Estimate. # noqa: E501
143143
:rtype: str
@@ -148,7 +148,7 @@ def type(self):
148148
def type(self, type):
149149
"""Sets the type of this Estimate.
150150
151-
The type of estimate. Available types are mass, flight, shipping, vehicle, and crypto. # noqa: E501
151+
The type of estimate. Available types are mass, flight, shipping, and crypto. # noqa: E501
152152
153153
:param type: The type of this Estimate. # noqa: E501
154154
:type: str

‎patch_api/models/project.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ def technology_type(self, technology_type):
601601
def highlights(self):
602602
"""Gets the highlights of this Project. # noqa: E501
603603
604-
An array of objects containing the highlight's slug, title, and a URL for the corresponding icon. A highlight's title is a short string that spotlights a characteristic about the project. # noqa: E501
604+
DEPRECATED. An array of objects containing the highlight's slug, title, and a URL for the corresponding icon. A highlight's title is a short string that spotlights a characteristic about the project. Highlights are deprecated and not populated for recent projects. # noqa: E501
605605
606606
:return: The highlights of this Project. # noqa: E501
607607
:rtype: list[Highlight]
@@ -612,7 +612,7 @@ def highlights(self):
612612
def highlights(self, highlights):
613613
"""Sets the highlights of this Project.
614614
615-
An array of objects containing the highlight's slug, title, and a URL for the corresponding icon. A highlight's title is a short string that spotlights a characteristic about the project. # noqa: E501
615+
DEPRECATED. An array of objects containing the highlight's slug, title, and a URL for the corresponding icon. A highlight's title is a short string that spotlights a characteristic about the project. Highlights are deprecated and not populated for recent projects. # noqa: E501
616616
617617
:param highlights: The highlights of this Project. # noqa: E501
618618
:type: list[Highlight]

‎patch_api/models/update_order_line_item_request.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ def vintage_year(self, vintage_year):
107107
if (
108108
self.local_vars_configuration.client_side_validation
109109
and vintage_year is not None
110-
and vintage_year > 2100
110+
and vintage_year > 2225
111111
): # noqa: E501
112112
raise ValueError(
113-
"Invalid value for `vintage_year`, must be a value less than or equal to `2100`"
113+
"Invalid value for `vintage_year`, must be a value less than or equal to `2225`"
114114
) # noqa: E501
115115
if (
116116
self.local_vars_configuration.client_side_validation
@@ -144,10 +144,10 @@ def vintage_start_year(self, vintage_start_year):
144144
if (
145145
self.local_vars_configuration.client_side_validation
146146
and vintage_start_year is not None
147-
and vintage_start_year > 2100
147+
and vintage_start_year > 2225
148148
): # noqa: E501
149149
raise ValueError(
150-
"Invalid value for `vintage_start_year`, must be a value less than or equal to `2100`"
150+
"Invalid value for `vintage_start_year`, must be a value less than or equal to `2225`"
151151
) # noqa: E501
152152
if (
153153
self.local_vars_configuration.client_side_validation
@@ -181,10 +181,10 @@ def vintage_end_year(self, vintage_end_year):
181181
if (
182182
self.local_vars_configuration.client_side_validation
183183
and vintage_end_year is not None
184-
and vintage_end_year > 2100
184+
and vintage_end_year > 2225
185185
): # noqa: E501
186186
raise ValueError(
187-
"Invalid value for `vintage_end_year`, must be a value less than or equal to `2100`"
187+
"Invalid value for `vintage_end_year`, must be a value less than or equal to `2225`"
188188
) # noqa: E501
189189
if (
190190
self.local_vars_configuration.client_side_validation
@@ -302,7 +302,7 @@ def unit(self, unit):
302302
:param unit: The unit of this UpdateOrderLineItemRequest. # noqa: E501
303303
:type: str
304304
"""
305-
allowed_values = [None, "g", "Wh"] # noqa: E501
305+
allowed_values = [None, "g"] # noqa: E501
306306
if (
307307
self.local_vars_configuration.client_side_validation
308308
and unit not in allowed_values

‎setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from setuptools import setup, find_packages # noqa: H301
1212

1313
NAME = "patch-api"
14-
VERSION = "2.1.1"
14+
VERSION = "2.3.0"
1515
# To install the library, run the following
1616
#
1717
# python setup.py install

‎test/test_estimates_api.py

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -74,62 +74,6 @@ def test_create_and_retrieve_flight_estimate_with_airports(self):
7474
)
7575
self.assertGreater(estimate_long.data.mass_g, estimate_short.data.mass_g)
7676

77-
def test_create_and_retrieve_shipping_estimate(self):
78-
"""Test case for create_shipping_estimate
79-
80-
Create an estimate based on the shipping distance, transportation method, and package mass # noqa: E501
81-
"""
82-
distance_m = 10000000
83-
package_mass_g = 1000
84-
transportation_method = "sea"
85-
estimate = self.api.create_shipping_estimate(
86-
distance_m=distance_m,
87-
package_mass_g=package_mass_g,
88-
transportation_method=transportation_method,
89-
create_order=False,
90-
)
91-
self.assertEqual(estimate.data.order, None)
92-
self.assertEqual(estimate.data.type, "ecommerce")
93-
self.assertGreater(estimate.data.mass_g, 200)
94-
95-
retrieved_estimate = self.api.retrieve_estimate(id=estimate.data.id)
96-
self.assertTrue(retrieved_estimate)
97-
98-
def test_create_and_retrieve_vehicle_estimate(self):
99-
"""Test case for create_vehicle_estimate
100-
101-
Create an estimate based on the vehicle distance, transportation method, and package mass # noqa: E501
102-
"""
103-
distance_m = 1000000
104-
make = "Toyota"
105-
model = "Corolla"
106-
year = 1995
107-
estimate = self.api.create_vehicle_estimate(
108-
distance_m=distance_m, model=model, make=make, year=year
109-
)
110-
self.assertEqual(estimate.data.type, "vehicle")
111-
self.assertGreater(estimate.data.mass_g, 50000)
112-
113-
retrieved_estimate = self.api.retrieve_estimate(id=estimate.data.id)
114-
self.assertTrue(retrieved_estimate)
115-
116-
def test_create_and_retrieve_vehicle_estimate_best_match(self):
117-
"""Test case for create_vehicle_estimate
118-
119-
Create an estimate based on the vehicle with partial information # noqa: E501
120-
"""
121-
distance_m = 1000000
122-
make = "Toyota"
123-
model = "Corolla"
124-
estimate = self.api.create_vehicle_estimate(
125-
distance_m=distance_m, model=model, make=make
126-
)
127-
self.assertEqual(estimate.data.type, "vehicle")
128-
self.assertGreater(estimate.data.mass_g, 50000)
129-
130-
retrieved_estimate = self.api.retrieve_estimate(id=estimate.data.id)
131-
self.assertTrue(retrieved_estimate)
132-
13377
def test_create_bitcoin_estimate_no_params(self):
13478
"""Test case for create_bitcoin_estimate
13579
@@ -157,32 +101,6 @@ def test_create_bitcoin_estimate_transaction_value(self):
157101
estimate.data.mass_g, 200
158102
) # not setting an exact value since this is changing daily
159103

160-
def test_create_bitcoin_estimate_transaction_value(self):
161-
"""Test case for create_bitcoin_estimate
162-
163-
Create an estimate based on an average daily balance # noqa: E501
164-
"""
165-
estimate1 = self.api.create_bitcoin_estimate(
166-
average_daily_balance_btc_sats=100000
167-
)
168-
estimate2 = self.api.create_bitcoin_estimate(
169-
average_daily_balance_btc_sats=1000000
170-
)
171-
self.assertEqual(estimate1.data.type, "bitcoin")
172-
self.assertGreater(estimate2.data.mass_g, estimate1.data.mass_g)
173-
174-
def test_create_ethereum_estimate_transaction_value(self):
175-
"""Test case for create_ethereum_estimate
176-
177-
Create an estimate based on a transaction amount # noqa: E501
178-
"""
179-
180-
estimate = self.api.create_ethereum_estimate(gas_used=1000)
181-
self.assertEqual(estimate.data.type, "ethereum")
182-
self.assertGreater(
183-
estimate.data.mass_g, 1
184-
) # not setting an exact value since this is changing daily
185-
186104
def test_create_hotel_estimate(self):
187105
"""Test case for create_hotel_estimate
188106

0 commit comments

Comments
 (0)
Please sign in to comment.