Skip to content

Remove unused api endpoints #77

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 2 commits into from
Jan 10, 2025
Merged
Changes from all 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
6 changes: 3 additions & 3 deletions .github/workflows/health_check.yml
Original file line number Diff line number Diff line change
@@ -9,13 +9,13 @@ jobs:
name: Run tests
strategy:
matrix:
python: ['3.6']
python: ['3.12']
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

24 changes: 12 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: name-tests-test
- repo: https://github.com/pycqa/flake8
rev: '4.0.1'
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: name-tests-test
- repo: https://github.com/pycqa/flake8
rev: "4.0.1"
hooks:
- id: flake8
args: ['--config=.flake8']
- repo: https://github.com/psf/black
rev: 22.6.0
- id: flake8
args: ["--config=.flake8"]
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
- id: black
2 changes: 1 addition & 1 deletion patch_api/__init__.py
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@

from __future__ import absolute_import

__version__ = "2.1.1"
__version__ = "2.3.0"

# import ApiClient
from patch_api.api_client import ApiClient
594 changes: 0 additions & 594 deletions patch_api/api/estimates_api.py

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions patch_api/api_client.py
Original file line number Diff line number Diff line change
@@ -92,7 +92,7 @@ def __init__(
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = "patch-python/2.1.1"
self.user_agent = "patch-python/2.3.0"
# Set default Patch-Version
self.patch_version = 2

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

def set_default_header(self, header_name, header_value):
self.default_headers[header_name] = header_value

def __call_api(
self,
resource_path,
@@ -163,6 +160,7 @@ def __call_api(
_request_timeout=None,
_host=None,
):

config = self.configuration

# header parameters
2 changes: 1 addition & 1 deletion patch_api/configuration.py
Original file line number Diff line number Diff line change
@@ -341,7 +341,7 @@ def to_debug_report(self):
"OS: {env}\n"
"Python Version: {pyversion}\n"
"Version of the API: 2\n"
"SDK Package Version: 2.1.1".format(env=sys.platform, pyversion=sys.version)
"SDK Package Version: 2.3.0".format(env=sys.platform, pyversion=sys.version)
)

def get_host_settings(self):
9 changes: 0 additions & 9 deletions patch_api/models/__init__.py
Original file line number Diff line number Diff line change
@@ -24,9 +24,6 @@
from patch_api.models.create_ecommerce_estimate_request import (
CreateEcommerceEstimateRequest,
)
from patch_api.models.create_ethereum_estimate_request import (
CreateEthereumEstimateRequest,
)
from patch_api.models.create_flight_estimate_request import CreateFlightEstimateRequest
from patch_api.models.create_hotel_estimate_request import CreateHotelEstimateRequest
from patch_api.models.create_mass_estimate_request import CreateMassEstimateRequest
@@ -41,13 +38,7 @@
from patch_api.models.create_sea_shipping_estimate_request import (
CreateSeaShippingEstimateRequest,
)
from patch_api.models.create_shipping_estimate_request import (
CreateShippingEstimateRequest,
)
from patch_api.models.create_success_response import CreateSuccessResponse
from patch_api.models.create_vehicle_estimate_request import (
CreateVehicleEstimateRequest,
)
from patch_api.models.delete_order_response import DeleteOrderResponse
from patch_api.models.disclaimer import Disclaimer
from patch_api.models.error_response import ErrorResponse
258 changes: 0 additions & 258 deletions patch_api/models/create_ethereum_estimate_request.py

This file was deleted.

14 changes: 7 additions & 7 deletions patch_api/models/create_order_line_item_request.py
Original file line number Diff line number Diff line change
@@ -134,10 +134,10 @@ def vintage_year(self, vintage_year):
if (
self.local_vars_configuration.client_side_validation
and vintage_year is not None
and vintage_year > 2100
and vintage_year > 2225
): # noqa: E501
raise ValueError(
"Invalid value for `vintage_year`, must be a value less than or equal to `2100`"
"Invalid value for `vintage_year`, must be a value less than or equal to `2225`"
) # noqa: E501
if (
self.local_vars_configuration.client_side_validation
@@ -171,10 +171,10 @@ def vintage_start_year(self, vintage_start_year):
if (
self.local_vars_configuration.client_side_validation
and vintage_start_year is not None
and vintage_start_year > 2100
and vintage_start_year > 2225
): # noqa: E501
raise ValueError(
"Invalid value for `vintage_start_year`, must be a value less than or equal to `2100`"
"Invalid value for `vintage_start_year`, must be a value less than or equal to `2225`"
) # noqa: E501
if (
self.local_vars_configuration.client_side_validation
@@ -208,10 +208,10 @@ def vintage_end_year(self, vintage_end_year):
if (
self.local_vars_configuration.client_side_validation
and vintage_end_year is not None
and vintage_end_year > 2100
and vintage_end_year > 2225
): # noqa: E501
raise ValueError(
"Invalid value for `vintage_end_year`, must be a value less than or equal to `2100`"
"Invalid value for `vintage_end_year`, must be a value less than or equal to `2225`"
) # noqa: E501
if (
self.local_vars_configuration.client_side_validation
@@ -329,7 +329,7 @@ def unit(self, unit):
:param unit: The unit of this CreateOrderLineItemRequest. # noqa: E501
:type: str
"""
allowed_values = [None, "g", "Wh"] # noqa: E501
allowed_values = [None, "g"] # noqa: E501
if (
self.local_vars_configuration.client_side_validation
and unit not in allowed_values
14 changes: 7 additions & 7 deletions patch_api/models/create_order_request.py
Original file line number Diff line number Diff line change
@@ -201,10 +201,10 @@ def vintage_year(self, vintage_year):
if (
self.local_vars_configuration.client_side_validation
and vintage_year is not None
and vintage_year > 2100
and vintage_year > 2225
): # noqa: E501
raise ValueError(
"Invalid value for `vintage_year`, must be a value less than or equal to `2100`"
"Invalid value for `vintage_year`, must be a value less than or equal to `2225`"
) # noqa: E501
if (
self.local_vars_configuration.client_side_validation
@@ -238,10 +238,10 @@ def vintage_start_year(self, vintage_start_year):
if (
self.local_vars_configuration.client_side_validation
and vintage_start_year is not None
and vintage_start_year > 2100
and vintage_start_year > 2225
): # noqa: E501
raise ValueError(
"Invalid value for `vintage_start_year`, must be a value less than or equal to `2100`"
"Invalid value for `vintage_start_year`, must be a value less than or equal to `2225`"
) # noqa: E501
if (
self.local_vars_configuration.client_side_validation
@@ -275,10 +275,10 @@ def vintage_end_year(self, vintage_end_year):
if (
self.local_vars_configuration.client_side_validation
and vintage_end_year is not None
and vintage_end_year > 2100
and vintage_end_year > 2225
): # noqa: E501
raise ValueError(
"Invalid value for `vintage_end_year`, must be a value less than or equal to `2100`"
"Invalid value for `vintage_end_year`, must be a value less than or equal to `2225`"
) # noqa: E501
if (
self.local_vars_configuration.client_side_validation
@@ -396,7 +396,7 @@ def unit(self, unit):
:param unit: The unit of this CreateOrderRequest. # noqa: E501
:type: str
"""
allowed_values = [None, "g", "Wh"] # noqa: E501
allowed_values = [None, "g"] # noqa: E501
if (
self.local_vars_configuration.client_side_validation
and unit not in allowed_values
294 changes: 0 additions & 294 deletions patch_api/models/create_shipping_estimate_request.py

This file was deleted.

288 changes: 0 additions & 288 deletions patch_api/models/create_vehicle_estimate_request.py

This file was deleted.

4 changes: 2 additions & 2 deletions patch_api/models/estimate.py
Original file line number Diff line number Diff line change
@@ -137,7 +137,7 @@ def production(self, production):
def type(self):
"""Gets the type of this Estimate. # noqa: E501
The type of estimate. Available types are mass, flight, shipping, vehicle, and crypto. # noqa: E501
The type of estimate. Available types are mass, flight, shipping, and crypto. # noqa: E501
:return: The type of this Estimate. # noqa: E501
:rtype: str
@@ -148,7 +148,7 @@ def type(self):
def type(self, type):
"""Sets the type of this Estimate.
The type of estimate. Available types are mass, flight, shipping, vehicle, and crypto. # noqa: E501
The type of estimate. Available types are mass, flight, shipping, and crypto. # noqa: E501
:param type: The type of this Estimate. # noqa: E501
:type: str
4 changes: 2 additions & 2 deletions patch_api/models/project.py
Original file line number Diff line number Diff line change
@@ -601,7 +601,7 @@ def technology_type(self, technology_type):
def highlights(self):
"""Gets the highlights of this Project. # noqa: E501
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
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
:return: The highlights of this Project. # noqa: E501
:rtype: list[Highlight]
@@ -612,7 +612,7 @@ def highlights(self):
def highlights(self, highlights):
"""Sets the highlights of this Project.
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
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
:param highlights: The highlights of this Project. # noqa: E501
:type: list[Highlight]
14 changes: 7 additions & 7 deletions patch_api/models/update_order_line_item_request.py
Original file line number Diff line number Diff line change
@@ -107,10 +107,10 @@ def vintage_year(self, vintage_year):
if (
self.local_vars_configuration.client_side_validation
and vintage_year is not None
and vintage_year > 2100
and vintage_year > 2225
): # noqa: E501
raise ValueError(
"Invalid value for `vintage_year`, must be a value less than or equal to `2100`"
"Invalid value for `vintage_year`, must be a value less than or equal to `2225`"
) # noqa: E501
if (
self.local_vars_configuration.client_side_validation
@@ -144,10 +144,10 @@ def vintage_start_year(self, vintage_start_year):
if (
self.local_vars_configuration.client_side_validation
and vintage_start_year is not None
and vintage_start_year > 2100
and vintage_start_year > 2225
): # noqa: E501
raise ValueError(
"Invalid value for `vintage_start_year`, must be a value less than or equal to `2100`"
"Invalid value for `vintage_start_year`, must be a value less than or equal to `2225`"
) # noqa: E501
if (
self.local_vars_configuration.client_side_validation
@@ -181,10 +181,10 @@ def vintage_end_year(self, vintage_end_year):
if (
self.local_vars_configuration.client_side_validation
and vintage_end_year is not None
and vintage_end_year > 2100
and vintage_end_year > 2225
): # noqa: E501
raise ValueError(
"Invalid value for `vintage_end_year`, must be a value less than or equal to `2100`"
"Invalid value for `vintage_end_year`, must be a value less than or equal to `2225`"
) # noqa: E501
if (
self.local_vars_configuration.client_side_validation
@@ -302,7 +302,7 @@ def unit(self, unit):
:param unit: The unit of this UpdateOrderLineItemRequest. # noqa: E501
:type: str
"""
allowed_values = [None, "g", "Wh"] # noqa: E501
allowed_values = [None, "g"] # noqa: E501
if (
self.local_vars_configuration.client_side_validation
and unit not in allowed_values
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
from setuptools import setup, find_packages # noqa: H301

NAME = "patch-api"
VERSION = "2.1.1"
VERSION = "2.3.0"
# To install the library, run the following
#
# python setup.py install
82 changes: 0 additions & 82 deletions test/test_estimates_api.py
Original file line number Diff line number Diff line change
@@ -74,62 +74,6 @@ def test_create_and_retrieve_flight_estimate_with_airports(self):
)
self.assertGreater(estimate_long.data.mass_g, estimate_short.data.mass_g)

def test_create_and_retrieve_shipping_estimate(self):
"""Test case for create_shipping_estimate
Create an estimate based on the shipping distance, transportation method, and package mass # noqa: E501
"""
distance_m = 10000000
package_mass_g = 1000
transportation_method = "sea"
estimate = self.api.create_shipping_estimate(
distance_m=distance_m,
package_mass_g=package_mass_g,
transportation_method=transportation_method,
create_order=False,
)
self.assertEqual(estimate.data.order, None)
self.assertEqual(estimate.data.type, "ecommerce")
self.assertGreater(estimate.data.mass_g, 200)

retrieved_estimate = self.api.retrieve_estimate(id=estimate.data.id)
self.assertTrue(retrieved_estimate)

def test_create_and_retrieve_vehicle_estimate(self):
"""Test case for create_vehicle_estimate
Create an estimate based on the vehicle distance, transportation method, and package mass # noqa: E501
"""
distance_m = 1000000
make = "Toyota"
model = "Corolla"
year = 1995
estimate = self.api.create_vehicle_estimate(
distance_m=distance_m, model=model, make=make, year=year
)
self.assertEqual(estimate.data.type, "vehicle")
self.assertGreater(estimate.data.mass_g, 50000)

retrieved_estimate = self.api.retrieve_estimate(id=estimate.data.id)
self.assertTrue(retrieved_estimate)

def test_create_and_retrieve_vehicle_estimate_best_match(self):
"""Test case for create_vehicle_estimate
Create an estimate based on the vehicle with partial information # noqa: E501
"""
distance_m = 1000000
make = "Toyota"
model = "Corolla"
estimate = self.api.create_vehicle_estimate(
distance_m=distance_m, model=model, make=make
)
self.assertEqual(estimate.data.type, "vehicle")
self.assertGreater(estimate.data.mass_g, 50000)

retrieved_estimate = self.api.retrieve_estimate(id=estimate.data.id)
self.assertTrue(retrieved_estimate)

def test_create_bitcoin_estimate_no_params(self):
"""Test case for create_bitcoin_estimate
@@ -157,32 +101,6 @@ def test_create_bitcoin_estimate_transaction_value(self):
estimate.data.mass_g, 200
) # not setting an exact value since this is changing daily

def test_create_bitcoin_estimate_transaction_value(self):
"""Test case for create_bitcoin_estimate
Create an estimate based on an average daily balance # noqa: E501
"""
estimate1 = self.api.create_bitcoin_estimate(
average_daily_balance_btc_sats=100000
)
estimate2 = self.api.create_bitcoin_estimate(
average_daily_balance_btc_sats=1000000
)
self.assertEqual(estimate1.data.type, "bitcoin")
self.assertGreater(estimate2.data.mass_g, estimate1.data.mass_g)

def test_create_ethereum_estimate_transaction_value(self):
"""Test case for create_ethereum_estimate
Create an estimate based on a transaction amount # noqa: E501
"""

estimate = self.api.create_ethereum_estimate(gas_used=1000)
self.assertEqual(estimate.data.type, "ethereum")
self.assertGreater(
estimate.data.mass_g, 1
) # not setting an exact value since this is changing daily

def test_create_hotel_estimate(self):
"""Test case for create_hotel_estimate