From 57fe31e11b514715488912f8ee0eaf2b5090e0e7 Mon Sep 17 00:00:00 2001 From: Paul Cothenet Date: Fri, 10 Jan 2025 15:31:01 -0800 Subject: [PATCH 1/2] Remove unused api endpoints --- .github/workflows/health_check.yml | 6 +- patch_api/__init__.py | 2 +- patch_api/api/estimates_api.py | 666 +----------------- patch_api/api_client.py | 6 +- patch_api/configuration.py | 2 +- patch_api/models/__init__.py | 9 - .../create_ethereum_estimate_request.py | 258 ------- .../models/create_order_line_item_request.py | 14 +- patch_api/models/create_order_request.py | 14 +- .../create_shipping_estimate_request.py | 294 -------- .../models/create_vehicle_estimate_request.py | 288 -------- patch_api/models/estimate.py | 4 +- patch_api/models/project.py | 4 +- .../models/update_order_line_item_request.py | 14 +- patch_api/rest.py | 6 +- setup.py | 2 +- test/test_estimates_api.py | 82 --- 17 files changed, 72 insertions(+), 1599 deletions(-) delete mode 100644 patch_api/models/create_ethereum_estimate_request.py delete mode 100644 patch_api/models/create_shipping_estimate_request.py delete mode 100644 patch_api/models/create_vehicle_estimate_request.py diff --git a/.github/workflows/health_check.yml b/.github/workflows/health_check.yml index 1499be3..ffdae2a 100644 --- a/.github/workflows/health_check.yml +++ b/.github/workflows/health_check.yml @@ -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 }} diff --git a/patch_api/__init__.py b/patch_api/__init__.py index 4426d4a..005dbef 100644 --- a/patch_api/__init__.py +++ b/patch_api/__init__.py @@ -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 diff --git a/patch_api/api/estimates_api.py b/patch_api/api/estimates_api.py index 287423e..5465e34 100644 --- a/patch_api/api/estimates_api.py +++ b/patch_api/api/estimates_api.py @@ -258,10 +258,10 @@ def create_air_shipping_estimate_with_http_info( ) # noqa: E501 # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] ) # noqa: E501 # Authentication setting @@ -456,10 +456,10 @@ def create_bitcoin_estimate_with_http_info( ) # noqa: E501 # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] ) # noqa: E501 # Authentication setting @@ -657,215 +657,17 @@ def create_ecommerce_estimate_with_http_info( ) # noqa: E501 # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) - ) # noqa: E501 - - # Authentication setting - auth_settings = ["bearer_auth"] # noqa: E501 - - return self.api_client.call_api( - "/v1/estimates/ecommerce", - "POST", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="EstimateResponse", # noqa: E501 - auth_settings=auth_settings, - async_req=local_var_params.get("async_req"), - _return_http_data_only=local_var_params.get( - "_return_http_data_only" - ), # noqa: E501 - _preload_content=local_var_params.get("_preload_content", True), - _request_timeout=local_var_params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def create_ethereum_estimate( - self, create_ethereum_estimate_request={}, **kwargs - ): # noqa: E501 - """Create an ethereum estimate # noqa: E501 - - Creates an ethereum estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_ethereum_estimate(create_ethereum_estimate_request, async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param CreateEthereumEstimateRequest create_ethereum_estimate_request: (required) - :param int patch_version: - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: EstimateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - return self.create_ethereum_estimate_with_http_info( - create_ethereum_estimate_request, **kwargs - ) # noqa: E501 - - def create_ethereum_estimate_with_http_info( - self, create_ethereum_estimate_request, **kwargs - ): # noqa: E501 - """Create an ethereum estimate # noqa: E501 - - Creates an ethereum estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_ethereum_estimate_with_http_info(create_ethereum_estimate_request, async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param CreateEthereumEstimateRequest create_ethereum_estimate_request: (required) - :param int patch_version: - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(EstimateResponse, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. - """ - - local_var_params = locals() - - all_params = ["create_ethereum_estimate_request", "patch_version"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - all_params.append("mass_g") - all_params.append("total_price_cents_usd") - all_params.append("project_id") - all_params.append("metadata") - all_params.append("distance_m") - all_params.append("transportation_method") - all_params.append("package_mass_g") - all_params.append("create_order") - all_params.append("make") - all_params.append("model") - all_params.append("year") - all_params.append("transaction_value_btc_sats") - all_params.append("transaction_value_eth_gwei") - all_params.append("gas_used") - all_params.append("transaction_value_btc_sats") - all_params.append("average_daily_balance_btc_sats") - all_params.append("average_daily_balance_eth_gwei") - all_params.append("timestamp") - all_params.append("origin_airport") - all_params.append("destination_airport") - all_params.append("aircraft_code") - all_params.append("cabin_class") - all_params.append("passenger_count") - all_params.append("state") - all_params.append("country_code") - all_params.append("city") - all_params.append("region") - all_params.append("star_rating") - all_params.append("number_of_nights") - all_params.append("number_of_rooms") - all_params.append("vintage_year") - all_params.append("total_price") - all_params.append("currency") - all_params.append("amount") - all_params.append("unit") - all_params.append("issued_to") - all_params.append("cargo_type") - all_params.append("container_size_code") - all_params.append("destination_country_code") - all_params.append("destination_locode") - all_params.append("destination_postal_code") - all_params.append("emissions_scope") - all_params.append("freight_mass_g") - all_params.append("freight_volume_cubic_m") - all_params.append("fuel_type") - all_params.append("number_of_containers") - all_params.append("origin_country_code") - all_params.append("origin_locode") - all_params.append("origin_postal_code") - all_params.append("truck_weight_t") - all_params.append("vessel_imo") - all_params.append("vintage_start_year") - all_params.append("vintage_end_year") - - for key, val in six.iteritems(local_var_params["kwargs"]): - if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_ethereum_estimate" % key - ) - local_var_params[key] = val - del local_var_params["kwargs"] - # verify the required parameter 'create_ethereum_estimate_request' is set - if ( - "create_ethereum_estimate_request" not in local_var_params - or local_var_params["create_ethereum_estimate_request"] is None - ): - raise ApiValueError( - "Missing the required parameter `create_ethereum_estimate_request` when calling `create_ethereum_estimate`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - # do not add duplicate keys to query_params list - existing_keys = [] - for param in query_params: - existing_keys.append(param[0]) - - for key in kwargs: - if key not in existing_keys: - query_params.append([key, kwargs.get(key)]) - - header_params = {} - if "patch_version" in local_var_params: - header_params["Patch-Version"] = local_var_params[ - "patch_version" - ] # noqa: E501 - - form_params = [] - local_var_files = {} - - body_params = None - if "create_ethereum_estimate_request" in local_var_params: - body_params = local_var_params["create_ethereum_estimate_request"] - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 ["application/json"] ) # noqa: E501 - # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) - ) # noqa: E501 - # Authentication setting auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - "/v1/estimates/crypto/eth", + "/v1/estimates/ecommerce", "POST", path_params, query_params, @@ -1053,10 +855,10 @@ def create_flight_estimate_with_http_info( ) # noqa: E501 # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] ) # noqa: E501 # Authentication setting @@ -1251,10 +1053,10 @@ def create_hotel_estimate_with_http_info( ) # noqa: E501 # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] ) # noqa: E501 # Authentication setting @@ -1449,10 +1251,10 @@ def create_mass_estimate_with_http_info( ) # noqa: E501 # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] ) # noqa: E501 # Authentication setting @@ -1650,10 +1452,10 @@ def create_rail_shipping_estimate_with_http_info( ) # noqa: E501 # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] ) # noqa: E501 # Authentication setting @@ -1851,10 +1653,10 @@ def create_road_shipping_estimate_with_http_info( ) # noqa: E501 # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] ) # noqa: E501 # Authentication setting @@ -2052,10 +1854,10 @@ def create_sea_shipping_estimate_with_http_info( ) # noqa: E501 # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] ) # noqa: E501 # Authentication setting @@ -2081,402 +1883,6 @@ def create_sea_shipping_estimate_with_http_info( collection_formats=collection_formats, ) - def create_shipping_estimate( - self, create_shipping_estimate_request={}, **kwargs - ): # noqa: E501 - """Create a shipping estimate given the distance traveled in meters, package weight, and transportation method. # noqa: E501 - - Creates a shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_shipping_estimate(create_shipping_estimate_request, async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param CreateShippingEstimateRequest create_shipping_estimate_request: (required) - :param int patch_version: - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: EstimateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - return self.create_shipping_estimate_with_http_info( - create_shipping_estimate_request, **kwargs - ) # noqa: E501 - - def create_shipping_estimate_with_http_info( - self, create_shipping_estimate_request, **kwargs - ): # noqa: E501 - """Create a shipping estimate given the distance traveled in meters, package weight, and transportation method. # noqa: E501 - - Creates a shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_shipping_estimate_with_http_info(create_shipping_estimate_request, async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param CreateShippingEstimateRequest create_shipping_estimate_request: (required) - :param int patch_version: - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(EstimateResponse, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. - """ - - local_var_params = locals() - - all_params = ["create_shipping_estimate_request", "patch_version"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - all_params.append("mass_g") - all_params.append("total_price_cents_usd") - all_params.append("project_id") - all_params.append("metadata") - all_params.append("distance_m") - all_params.append("transportation_method") - all_params.append("package_mass_g") - all_params.append("create_order") - all_params.append("make") - all_params.append("model") - all_params.append("year") - all_params.append("transaction_value_btc_sats") - all_params.append("transaction_value_eth_gwei") - all_params.append("gas_used") - all_params.append("transaction_value_btc_sats") - all_params.append("average_daily_balance_btc_sats") - all_params.append("average_daily_balance_eth_gwei") - all_params.append("timestamp") - all_params.append("origin_airport") - all_params.append("destination_airport") - all_params.append("aircraft_code") - all_params.append("cabin_class") - all_params.append("passenger_count") - all_params.append("state") - all_params.append("country_code") - all_params.append("city") - all_params.append("region") - all_params.append("star_rating") - all_params.append("number_of_nights") - all_params.append("number_of_rooms") - all_params.append("vintage_year") - all_params.append("total_price") - all_params.append("currency") - all_params.append("amount") - all_params.append("unit") - all_params.append("issued_to") - all_params.append("cargo_type") - all_params.append("container_size_code") - all_params.append("destination_country_code") - all_params.append("destination_locode") - all_params.append("destination_postal_code") - all_params.append("emissions_scope") - all_params.append("freight_mass_g") - all_params.append("freight_volume_cubic_m") - all_params.append("fuel_type") - all_params.append("number_of_containers") - all_params.append("origin_country_code") - all_params.append("origin_locode") - all_params.append("origin_postal_code") - all_params.append("truck_weight_t") - all_params.append("vessel_imo") - all_params.append("vintage_start_year") - all_params.append("vintage_end_year") - - for key, val in six.iteritems(local_var_params["kwargs"]): - if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_shipping_estimate" % key - ) - local_var_params[key] = val - del local_var_params["kwargs"] - # verify the required parameter 'create_shipping_estimate_request' is set - if ( - "create_shipping_estimate_request" not in local_var_params - or local_var_params["create_shipping_estimate_request"] is None - ): - raise ApiValueError( - "Missing the required parameter `create_shipping_estimate_request` when calling `create_shipping_estimate`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - # do not add duplicate keys to query_params list - existing_keys = [] - for param in query_params: - existing_keys.append(param[0]) - - for key in kwargs: - if key not in existing_keys: - query_params.append([key, kwargs.get(key)]) - - header_params = {} - if "patch_version" in local_var_params: - header_params["Patch-Version"] = local_var_params[ - "patch_version" - ] # noqa: E501 - - form_params = [] - local_var_files = {} - - body_params = None - if "create_shipping_estimate_request" in local_var_params: - body_params = local_var_params["create_shipping_estimate_request"] - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) - ) # noqa: E501 - - # Authentication setting - auth_settings = ["bearer_auth"] # noqa: E501 - - return self.api_client.call_api( - "/v1/estimates/shipping", - "POST", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="EstimateResponse", # noqa: E501 - auth_settings=auth_settings, - async_req=local_var_params.get("async_req"), - _return_http_data_only=local_var_params.get( - "_return_http_data_only" - ), # noqa: E501 - _preload_content=local_var_params.get("_preload_content", True), - _request_timeout=local_var_params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def create_vehicle_estimate( - self, create_vehicle_estimate_request={}, **kwargs - ): # noqa: E501 - """Create a vehicle estimate given the distance traveled in meters and the type of vehicle # noqa: E501 - - Creates an estimate and calculates the amount of CO2 to be compensated depending on the distance and the vehicle. An order in the `draft` state may be created based on the parameters, linked to the estimate. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_vehicle_estimate(create_vehicle_estimate_request, async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param CreateVehicleEstimateRequest create_vehicle_estimate_request: (required) - :param int patch_version: - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: EstimateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - return self.create_vehicle_estimate_with_http_info( - create_vehicle_estimate_request, **kwargs - ) # noqa: E501 - - def create_vehicle_estimate_with_http_info( - self, create_vehicle_estimate_request, **kwargs - ): # noqa: E501 - """Create a vehicle estimate given the distance traveled in meters and the type of vehicle # noqa: E501 - - Creates an estimate and calculates the amount of CO2 to be compensated depending on the distance and the vehicle. An order in the `draft` state may be created based on the parameters, linked to the estimate. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_vehicle_estimate_with_http_info(create_vehicle_estimate_request, async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param CreateVehicleEstimateRequest create_vehicle_estimate_request: (required) - :param int patch_version: - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(EstimateResponse, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. - """ - - local_var_params = locals() - - all_params = ["create_vehicle_estimate_request", "patch_version"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - all_params.append("mass_g") - all_params.append("total_price_cents_usd") - all_params.append("project_id") - all_params.append("metadata") - all_params.append("distance_m") - all_params.append("transportation_method") - all_params.append("package_mass_g") - all_params.append("create_order") - all_params.append("make") - all_params.append("model") - all_params.append("year") - all_params.append("transaction_value_btc_sats") - all_params.append("transaction_value_eth_gwei") - all_params.append("gas_used") - all_params.append("transaction_value_btc_sats") - all_params.append("average_daily_balance_btc_sats") - all_params.append("average_daily_balance_eth_gwei") - all_params.append("timestamp") - all_params.append("origin_airport") - all_params.append("destination_airport") - all_params.append("aircraft_code") - all_params.append("cabin_class") - all_params.append("passenger_count") - all_params.append("state") - all_params.append("country_code") - all_params.append("city") - all_params.append("region") - all_params.append("star_rating") - all_params.append("number_of_nights") - all_params.append("number_of_rooms") - all_params.append("vintage_year") - all_params.append("total_price") - all_params.append("currency") - all_params.append("amount") - all_params.append("unit") - all_params.append("issued_to") - all_params.append("cargo_type") - all_params.append("container_size_code") - all_params.append("destination_country_code") - all_params.append("destination_locode") - all_params.append("destination_postal_code") - all_params.append("emissions_scope") - all_params.append("freight_mass_g") - all_params.append("freight_volume_cubic_m") - all_params.append("fuel_type") - all_params.append("number_of_containers") - all_params.append("origin_country_code") - all_params.append("origin_locode") - all_params.append("origin_postal_code") - all_params.append("truck_weight_t") - all_params.append("vessel_imo") - all_params.append("vintage_start_year") - all_params.append("vintage_end_year") - - for key, val in six.iteritems(local_var_params["kwargs"]): - if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_vehicle_estimate" % key - ) - local_var_params[key] = val - del local_var_params["kwargs"] - # verify the required parameter 'create_vehicle_estimate_request' is set - if ( - "create_vehicle_estimate_request" not in local_var_params - or local_var_params["create_vehicle_estimate_request"] is None - ): - raise ApiValueError( - "Missing the required parameter `create_vehicle_estimate_request` when calling `create_vehicle_estimate`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - # do not add duplicate keys to query_params list - existing_keys = [] - for param in query_params: - existing_keys.append(param[0]) - - for key in kwargs: - if key not in existing_keys: - query_params.append([key, kwargs.get(key)]) - - header_params = {} - if "patch_version" in local_var_params: - header_params["Patch-Version"] = local_var_params[ - "patch_version" - ] # noqa: E501 - - form_params = [] - local_var_files = {} - - body_params = None - if "create_vehicle_estimate_request" in local_var_params: - body_params = local_var_params["create_vehicle_estimate_request"] - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) - ) # noqa: E501 - - # Authentication setting - auth_settings = ["bearer_auth"] # noqa: E501 - - return self.api_client.call_api( - "/v1/estimates/vehicle", - "POST", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="EstimateResponse", # noqa: E501 - auth_settings=auth_settings, - async_req=local_var_params.get("async_req"), - _return_http_data_only=local_var_params.get( - "_return_http_data_only" - ), # noqa: E501 - _preload_content=local_var_params.get("_preload_content", True), - _request_timeout=local_var_params.get("_request_timeout"), - collection_formats=collection_formats, - ) - def retrieve_estimate(self, id={}, **kwargs): # noqa: E501 """Retrieves an estimate # noqa: E501 diff --git a/patch_api/api_client.py b/patch_api/api_client.py index d1584a0..50a1412 100644 --- a/patch_api/api_client.py +++ b/patch_api/api_client.py @@ -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 diff --git a/patch_api/configuration.py b/patch_api/configuration.py index e61902b..48e1a11 100644 --- a/patch_api/configuration.py +++ b/patch_api/configuration.py @@ -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): diff --git a/patch_api/models/__init__.py b/patch_api/models/__init__.py index f5cdad7..5fe200a 100644 --- a/patch_api/models/__init__.py +++ b/patch_api/models/__init__.py @@ -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 diff --git a/patch_api/models/create_ethereum_estimate_request.py b/patch_api/models/create_ethereum_estimate_request.py deleted file mode 100644 index 0f71f5a..0000000 --- a/patch_api/models/create_ethereum_estimate_request.py +++ /dev/null @@ -1,258 +0,0 @@ -# coding: utf-8 - -""" - Patch API V2 - - The core API used to integrate with Patch's service # noqa: E501 - - The version of the OpenAPI document: 2 - Contact: engineering@usepatch.com - Generated by: https://openapi-generator.tech -""" - - -import pprint -import re # noqa: F401 - -import six - -from patch_api.configuration import Configuration - - -class CreateEthereumEstimateRequest(object): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - """ - Attributes: - openapi_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - openapi_types = { - "timestamp": "str", - "gas_used": "int", - "transaction_value_eth_gwei": "int", - "average_daily_balance_eth_gwei": "int", - "project_id": "str", - "create_order": "bool", - } - - attribute_map = { - "timestamp": "timestamp", - "gas_used": "gas_used", - "transaction_value_eth_gwei": "transaction_value_eth_gwei", - "average_daily_balance_eth_gwei": "average_daily_balance_eth_gwei", - "project_id": "project_id", - "create_order": "create_order", - } - - def __init__( - self, - timestamp=None, - gas_used=None, - transaction_value_eth_gwei=None, - average_daily_balance_eth_gwei=None, - project_id=None, - create_order=False, - local_vars_configuration=None, - ): # noqa: E501 - """CreateEthereumEstimateRequest - a model defined in OpenAPI""" # noqa: E501 - if local_vars_configuration is None: - local_vars_configuration = Configuration() - self.local_vars_configuration = local_vars_configuration - - self._timestamp = None - self._gas_used = None - self._transaction_value_eth_gwei = None - self._average_daily_balance_eth_gwei = None - self._project_id = None - self._create_order = None - self.discriminator = None - - self.timestamp = timestamp - self.gas_used = gas_used - self.transaction_value_eth_gwei = transaction_value_eth_gwei - self.average_daily_balance_eth_gwei = average_daily_balance_eth_gwei - self.project_id = project_id - self.create_order = create_order - - @property - def timestamp(self): - """Gets the timestamp of this CreateEthereumEstimateRequest. # noqa: E501 - - - :return: The timestamp of this CreateEthereumEstimateRequest. # noqa: E501 - :rtype: str - """ - return self._timestamp - - @timestamp.setter - def timestamp(self, timestamp): - """Sets the timestamp of this CreateEthereumEstimateRequest. - - - :param timestamp: The timestamp of this CreateEthereumEstimateRequest. # noqa: E501 - :type: str - """ - - self._timestamp = timestamp - - @property - def gas_used(self): - """Gets the gas_used of this CreateEthereumEstimateRequest. # noqa: E501 - - - :return: The gas_used of this CreateEthereumEstimateRequest. # noqa: E501 - :rtype: int - """ - return self._gas_used - - @gas_used.setter - def gas_used(self, gas_used): - """Sets the gas_used of this CreateEthereumEstimateRequest. - - - :param gas_used: The gas_used of this CreateEthereumEstimateRequest. # noqa: E501 - :type: int - """ - - self._gas_used = gas_used - - @property - def transaction_value_eth_gwei(self): - """Gets the transaction_value_eth_gwei of this CreateEthereumEstimateRequest. # noqa: E501 - - - :return: The transaction_value_eth_gwei of this CreateEthereumEstimateRequest. # noqa: E501 - :rtype: int - """ - return self._transaction_value_eth_gwei - - @transaction_value_eth_gwei.setter - def transaction_value_eth_gwei(self, transaction_value_eth_gwei): - """Sets the transaction_value_eth_gwei of this CreateEthereumEstimateRequest. - - - :param transaction_value_eth_gwei: The transaction_value_eth_gwei of this CreateEthereumEstimateRequest. # noqa: E501 - :type: int - """ - - self._transaction_value_eth_gwei = transaction_value_eth_gwei - - @property - def average_daily_balance_eth_gwei(self): - """Gets the average_daily_balance_eth_gwei of this CreateEthereumEstimateRequest. # noqa: E501 - - - :return: The average_daily_balance_eth_gwei of this CreateEthereumEstimateRequest. # noqa: E501 - :rtype: int - """ - return self._average_daily_balance_eth_gwei - - @average_daily_balance_eth_gwei.setter - def average_daily_balance_eth_gwei(self, average_daily_balance_eth_gwei): - """Sets the average_daily_balance_eth_gwei of this CreateEthereumEstimateRequest. - - - :param average_daily_balance_eth_gwei: The average_daily_balance_eth_gwei of this CreateEthereumEstimateRequest. # noqa: E501 - :type: int - """ - - self._average_daily_balance_eth_gwei = average_daily_balance_eth_gwei - - @property - def project_id(self): - """Gets the project_id of this CreateEthereumEstimateRequest. # noqa: E501 - - - :return: The project_id of this CreateEthereumEstimateRequest. # noqa: E501 - :rtype: str - """ - return self._project_id - - @project_id.setter - def project_id(self, project_id): - """Sets the project_id of this CreateEthereumEstimateRequest. - - - :param project_id: The project_id of this CreateEthereumEstimateRequest. # noqa: E501 - :type: str - """ - - self._project_id = project_id - - @property - def create_order(self): - """Gets the create_order of this CreateEthereumEstimateRequest. # noqa: E501 - - - :return: The create_order of this CreateEthereumEstimateRequest. # noqa: E501 - :rtype: bool - """ - return self._create_order - - @create_order.setter - def create_order(self, create_order): - """Sets the create_order of this CreateEthereumEstimateRequest. - - - :param create_order: The create_order of this CreateEthereumEstimateRequest. # noqa: E501 - :type: bool - """ - - self._create_order = create_order - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.openapi_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: ( - (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item - ), - value.items(), - ) - ) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CreateEthereumEstimateRequest): - return False - - return self.to_dict() == other.to_dict() - - def __ne__(self, other): - """Returns true if both objects are not equal""" - if not isinstance(other, CreateEthereumEstimateRequest): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/create_order_line_item_request.py b/patch_api/models/create_order_line_item_request.py index 745b6cc..f2094de 100644 --- a/patch_api/models/create_order_line_item_request.py +++ b/patch_api/models/create_order_line_item_request.py @@ -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 diff --git a/patch_api/models/create_order_request.py b/patch_api/models/create_order_request.py index bf27ddf..24d71b8 100644 --- a/patch_api/models/create_order_request.py +++ b/patch_api/models/create_order_request.py @@ -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 diff --git a/patch_api/models/create_shipping_estimate_request.py b/patch_api/models/create_shipping_estimate_request.py deleted file mode 100644 index a5e5c28..0000000 --- a/patch_api/models/create_shipping_estimate_request.py +++ /dev/null @@ -1,294 +0,0 @@ -# coding: utf-8 - -""" - Patch API V2 - - The core API used to integrate with Patch's service # noqa: E501 - - The version of the OpenAPI document: 2 - Contact: engineering@usepatch.com - Generated by: https://openapi-generator.tech -""" - - -import pprint -import re # noqa: F401 - -import six - -from patch_api.configuration import Configuration - - -class CreateShippingEstimateRequest(object): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - """ - Attributes: - openapi_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - openapi_types = { - "distance_m": "int", - "package_mass_g": "int", - "transportation_method": "str", - "project_id": "str", - "create_order": "bool", - } - - attribute_map = { - "distance_m": "distance_m", - "package_mass_g": "package_mass_g", - "transportation_method": "transportation_method", - "project_id": "project_id", - "create_order": "create_order", - } - - def __init__( - self, - distance_m=None, - package_mass_g=None, - transportation_method=None, - project_id=None, - create_order=False, - local_vars_configuration=None, - ): # noqa: E501 - """CreateShippingEstimateRequest - a model defined in OpenAPI""" # noqa: E501 - if local_vars_configuration is None: - local_vars_configuration = Configuration() - self.local_vars_configuration = local_vars_configuration - - self._distance_m = None - self._package_mass_g = None - self._transportation_method = None - self._project_id = None - self._create_order = None - self.discriminator = None - - self.distance_m = distance_m - self.package_mass_g = package_mass_g - self.transportation_method = transportation_method - self.project_id = project_id - self.create_order = create_order - - @property - def distance_m(self): - """Gets the distance_m of this CreateShippingEstimateRequest. # noqa: E501 - - - :return: The distance_m of this CreateShippingEstimateRequest. # noqa: E501 - :rtype: int - """ - return self._distance_m - - @distance_m.setter - def distance_m(self, distance_m): - """Sets the distance_m of this CreateShippingEstimateRequest. - - - :param distance_m: The distance_m of this CreateShippingEstimateRequest. # noqa: E501 - :type: int - """ - if ( - self.local_vars_configuration.client_side_validation and distance_m is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `distance_m`, must not be `None`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and distance_m is not None - and distance_m > 400000000 - ): # noqa: E501 - raise ValueError( - "Invalid value for `distance_m`, must be a value less than or equal to `400000000`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and distance_m is not None - and distance_m < 0 - ): # noqa: E501 - raise ValueError( - "Invalid value for `distance_m`, must be a value greater than or equal to `0`" - ) # noqa: E501 - - self._distance_m = distance_m - - @property - def package_mass_g(self): - """Gets the package_mass_g of this CreateShippingEstimateRequest. # noqa: E501 - - - :return: The package_mass_g of this CreateShippingEstimateRequest. # noqa: E501 - :rtype: int - """ - return self._package_mass_g - - @package_mass_g.setter - def package_mass_g(self, package_mass_g): - """Sets the package_mass_g of this CreateShippingEstimateRequest. - - - :param package_mass_g: The package_mass_g of this CreateShippingEstimateRequest. # noqa: E501 - :type: int - """ - if ( - self.local_vars_configuration.client_side_validation - and package_mass_g is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `package_mass_g`, must not be `None`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and package_mass_g is not None - and package_mass_g > 2000000000 - ): # noqa: E501 - raise ValueError( - "Invalid value for `package_mass_g`, must be a value less than or equal to `2000000000`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and package_mass_g is not None - and package_mass_g < 0 - ): # noqa: E501 - raise ValueError( - "Invalid value for `package_mass_g`, must be a value greater than or equal to `0`" - ) # noqa: E501 - - self._package_mass_g = package_mass_g - - @property - def transportation_method(self): - """Gets the transportation_method of this CreateShippingEstimateRequest. # noqa: E501 - - - :return: The transportation_method of this CreateShippingEstimateRequest. # noqa: E501 - :rtype: str - """ - return self._transportation_method - - @transportation_method.setter - def transportation_method(self, transportation_method): - """Sets the transportation_method of this CreateShippingEstimateRequest. - - - :param transportation_method: The transportation_method of this CreateShippingEstimateRequest. # noqa: E501 - :type: str - """ - if ( - self.local_vars_configuration.client_side_validation - and transportation_method is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `transportation_method`, must not be `None`" - ) # noqa: E501 - allowed_values = ["air", "rail", "road", "sea"] # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and transportation_method not in allowed_values - ): # noqa: E501 - raise ValueError( - "Invalid value for `transportation_method` ({0}), must be one of {1}".format( # noqa: E501 - transportation_method, allowed_values - ) - ) - - self._transportation_method = transportation_method - - @property - def project_id(self): - """Gets the project_id of this CreateShippingEstimateRequest. # noqa: E501 - - - :return: The project_id of this CreateShippingEstimateRequest. # noqa: E501 - :rtype: str - """ - return self._project_id - - @project_id.setter - def project_id(self, project_id): - """Sets the project_id of this CreateShippingEstimateRequest. - - - :param project_id: The project_id of this CreateShippingEstimateRequest. # noqa: E501 - :type: str - """ - - self._project_id = project_id - - @property - def create_order(self): - """Gets the create_order of this CreateShippingEstimateRequest. # noqa: E501 - - - :return: The create_order of this CreateShippingEstimateRequest. # noqa: E501 - :rtype: bool - """ - return self._create_order - - @create_order.setter - def create_order(self, create_order): - """Sets the create_order of this CreateShippingEstimateRequest. - - - :param create_order: The create_order of this CreateShippingEstimateRequest. # noqa: E501 - :type: bool - """ - - self._create_order = create_order - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.openapi_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: ( - (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item - ), - value.items(), - ) - ) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CreateShippingEstimateRequest): - return False - - return self.to_dict() == other.to_dict() - - def __ne__(self, other): - """Returns true if both objects are not equal""" - if not isinstance(other, CreateShippingEstimateRequest): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/create_vehicle_estimate_request.py b/patch_api/models/create_vehicle_estimate_request.py deleted file mode 100644 index 51ebf78..0000000 --- a/patch_api/models/create_vehicle_estimate_request.py +++ /dev/null @@ -1,288 +0,0 @@ -# coding: utf-8 - -""" - Patch API V2 - - The core API used to integrate with Patch's service # noqa: E501 - - The version of the OpenAPI document: 2 - Contact: engineering@usepatch.com - Generated by: https://openapi-generator.tech -""" - - -import pprint -import re # noqa: F401 - -import six - -from patch_api.configuration import Configuration - - -class CreateVehicleEstimateRequest(object): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - """ - Attributes: - openapi_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - openapi_types = { - "distance_m": "int", - "make": "str", - "model": "str", - "year": "int", - "project_id": "str", - "create_order": "bool", - } - - attribute_map = { - "distance_m": "distance_m", - "make": "make", - "model": "model", - "year": "year", - "project_id": "project_id", - "create_order": "create_order", - } - - def __init__( - self, - distance_m=None, - make=None, - model=None, - year=None, - project_id=None, - create_order=False, - local_vars_configuration=None, - ): # noqa: E501 - """CreateVehicleEstimateRequest - a model defined in OpenAPI""" # noqa: E501 - if local_vars_configuration is None: - local_vars_configuration = Configuration() - self.local_vars_configuration = local_vars_configuration - - self._distance_m = None - self._make = None - self._model = None - self._year = None - self._project_id = None - self._create_order = None - self.discriminator = None - - self.distance_m = distance_m - self.make = make - self.model = model - self.year = year - self.project_id = project_id - self.create_order = create_order - - @property - def distance_m(self): - """Gets the distance_m of this CreateVehicleEstimateRequest. # noqa: E501 - - - :return: The distance_m of this CreateVehicleEstimateRequest. # noqa: E501 - :rtype: int - """ - return self._distance_m - - @distance_m.setter - def distance_m(self, distance_m): - """Sets the distance_m of this CreateVehicleEstimateRequest. - - - :param distance_m: The distance_m of this CreateVehicleEstimateRequest. # noqa: E501 - :type: int - """ - if ( - self.local_vars_configuration.client_side_validation and distance_m is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `distance_m`, must not be `None`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and distance_m is not None - and distance_m > 400000000 - ): # noqa: E501 - raise ValueError( - "Invalid value for `distance_m`, must be a value less than or equal to `400000000`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and distance_m is not None - and distance_m < 0 - ): # noqa: E501 - raise ValueError( - "Invalid value for `distance_m`, must be a value greater than or equal to `0`" - ) # noqa: E501 - - self._distance_m = distance_m - - @property - def make(self): - """Gets the make of this CreateVehicleEstimateRequest. # noqa: E501 - - - :return: The make of this CreateVehicleEstimateRequest. # noqa: E501 - :rtype: str - """ - return self._make - - @make.setter - def make(self, make): - """Sets the make of this CreateVehicleEstimateRequest. - - - :param make: The make of this CreateVehicleEstimateRequest. # noqa: E501 - :type: str - """ - - self._make = make - - @property - def model(self): - """Gets the model of this CreateVehicleEstimateRequest. # noqa: E501 - - - :return: The model of this CreateVehicleEstimateRequest. # noqa: E501 - :rtype: str - """ - return self._model - - @model.setter - def model(self, model): - """Sets the model of this CreateVehicleEstimateRequest. - - - :param model: The model of this CreateVehicleEstimateRequest. # noqa: E501 - :type: str - """ - - self._model = model - - @property - def year(self): - """Gets the year of this CreateVehicleEstimateRequest. # noqa: E501 - - - :return: The year of this CreateVehicleEstimateRequest. # noqa: E501 - :rtype: int - """ - return self._year - - @year.setter - def year(self, year): - """Sets the year of this CreateVehicleEstimateRequest. - - - :param year: The year of this CreateVehicleEstimateRequest. # noqa: E501 - :type: int - """ - if ( - self.local_vars_configuration.client_side_validation - and year is not None - and year < 1900 - ): # noqa: E501 - raise ValueError( - "Invalid value for `year`, must be a value greater than or equal to `1900`" - ) # noqa: E501 - - self._year = year - - @property - def project_id(self): - """Gets the project_id of this CreateVehicleEstimateRequest. # noqa: E501 - - - :return: The project_id of this CreateVehicleEstimateRequest. # noqa: E501 - :rtype: str - """ - return self._project_id - - @project_id.setter - def project_id(self, project_id): - """Sets the project_id of this CreateVehicleEstimateRequest. - - - :param project_id: The project_id of this CreateVehicleEstimateRequest. # noqa: E501 - :type: str - """ - - self._project_id = project_id - - @property - def create_order(self): - """Gets the create_order of this CreateVehicleEstimateRequest. # noqa: E501 - - - :return: The create_order of this CreateVehicleEstimateRequest. # noqa: E501 - :rtype: bool - """ - return self._create_order - - @create_order.setter - def create_order(self, create_order): - """Sets the create_order of this CreateVehicleEstimateRequest. - - - :param create_order: The create_order of this CreateVehicleEstimateRequest. # noqa: E501 - :type: bool - """ - - self._create_order = create_order - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.openapi_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: ( - (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item - ), - value.items(), - ) - ) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CreateVehicleEstimateRequest): - return False - - return self.to_dict() == other.to_dict() - - def __ne__(self, other): - """Returns true if both objects are not equal""" - if not isinstance(other, CreateVehicleEstimateRequest): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/estimate.py b/patch_api/models/estimate.py index 11d1e13..7f7f301 100644 --- a/patch_api/models/estimate.py +++ b/patch_api/models/estimate.py @@ -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 diff --git a/patch_api/models/project.py b/patch_api/models/project.py index 375ea2b..37b12ff 100644 --- a/patch_api/models/project.py +++ b/patch_api/models/project.py @@ -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] diff --git a/patch_api/models/update_order_line_item_request.py b/patch_api/models/update_order_line_item_request.py index 4dda79c..f7cb6d3 100644 --- a/patch_api/models/update_order_line_item_request.py +++ b/patch_api/models/update_order_line_item_request.py @@ -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 diff --git a/patch_api/rest.py b/patch_api/rest.py index 96ef7bf..de2f357 100644 --- a/patch_api/rest.py +++ b/patch_api/rest.py @@ -74,9 +74,9 @@ def __init__(self, api_key, configuration, pools_size=4, maxsize=None): addition_pool_args = {} if configuration.assert_hostname is not None: - addition_pool_args["assert_hostname"] = ( - configuration.assert_hostname - ) # noqa: E501 + addition_pool_args[ + "assert_hostname" + ] = configuration.assert_hostname # noqa: E501 if configuration.retries is not None: addition_pool_args["retries"] = configuration.retries diff --git a/setup.py b/setup.py index 69552f7..062c744 100644 --- a/setup.py +++ b/setup.py @@ -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 diff --git a/test/test_estimates_api.py b/test/test_estimates_api.py index 7e13424..4dfec00 100644 --- a/test/test_estimates_api.py +++ b/test/test_estimates_api.py @@ -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 From fb3ba7b708e26f45b5d5b6b24d0d118b6a61d377 Mon Sep 17 00:00:00 2001 From: Paul Cothenet Date: Fri, 10 Jan 2025 15:35:34 -0800 Subject: [PATCH 2/2] Lint --- .pre-commit-config.yaml | 24 ++++++------ patch_api/api/estimates_api.py | 72 +++++++++++++++++----------------- patch_api/rest.py | 6 +-- 3 files changed, 51 insertions(+), 51 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7d41641..31622f1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/patch_api/api/estimates_api.py b/patch_api/api/estimates_api.py index 5465e34..2fa3321 100644 --- a/patch_api/api/estimates_api.py +++ b/patch_api/api/estimates_api.py @@ -258,10 +258,10 @@ def create_air_shipping_estimate_with_http_info( ) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting @@ -456,10 +456,10 @@ def create_bitcoin_estimate_with_http_info( ) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting @@ -657,10 +657,10 @@ def create_ecommerce_estimate_with_http_info( ) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting @@ -855,10 +855,10 @@ def create_flight_estimate_with_http_info( ) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting @@ -1053,10 +1053,10 @@ def create_hotel_estimate_with_http_info( ) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting @@ -1251,10 +1251,10 @@ def create_mass_estimate_with_http_info( ) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting @@ -1452,10 +1452,10 @@ def create_rail_shipping_estimate_with_http_info( ) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting @@ -1653,10 +1653,10 @@ def create_road_shipping_estimate_with_http_info( ) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting @@ -1854,10 +1854,10 @@ def create_sea_shipping_estimate_with_http_info( ) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting diff --git a/patch_api/rest.py b/patch_api/rest.py index de2f357..96ef7bf 100644 --- a/patch_api/rest.py +++ b/patch_api/rest.py @@ -74,9 +74,9 @@ def __init__(self, api_key, configuration, pools_size=4, maxsize=None): addition_pool_args = {} if configuration.assert_hostname is not None: - addition_pool_args[ - "assert_hostname" - ] = configuration.assert_hostname # noqa: E501 + addition_pool_args["assert_hostname"] = ( + configuration.assert_hostname + ) # noqa: E501 if configuration.retries is not None: addition_pool_args["retries"] = configuration.retries