From 4643125e69260e2b34a148610349f1c8d78f732c Mon Sep 17 00:00:00 2001 From: Paul Cothenet Date: Tue, 19 Aug 2025 15:12:32 -0700 Subject: [PATCH 1/2] Remove create_flight_estimate --- CHANGELOG.md | 6 + patch_api/__init__.py | 4 +- patch_api/api/__init__.py | 2 + patch_api/api/estimates_api.py | 198 ----------- patch_api/api_client.py | 2 +- patch_api/configuration.py | 2 +- patch_api/models/__init__.py | 2 +- .../create_ecommerce_estimate_request.py | 294 ---------------- .../models/create_flight_estimate_request.py | 326 ------------------ patch_api/models/estimate.py | 4 +- setup.py | 2 +- 11 files changed, 17 insertions(+), 825 deletions(-) delete mode 100644 patch_api/models/create_ecommerce_estimate_request.py delete mode 100644 patch_api/models/create_flight_estimate_request.py diff --git a/CHANGELOG.md b/CHANGELOG.md index ad9cf91..4fdbfac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.5.0] - 2025-08-19 + +### Removed + +- Removes `Patch::Estimate.create_flight_estimate` method + ## [2.4.0] - 2025-05-16 ### Removed diff --git a/patch_api/__init__.py b/patch_api/__init__.py index 17fe4d9..da06725 100644 --- a/patch_api/__init__.py +++ b/patch_api/__init__.py @@ -1,5 +1,7 @@ # coding: utf-8 +# flake8: noqa + """ Patch API V2 @@ -13,7 +15,7 @@ from __future__ import absolute_import -__version__ = "2.4.0" +__version__ = "2.5.0" # import ApiClient from patch_api.api_client import ApiClient diff --git a/patch_api/api/__init__.py b/patch_api/api/__init__.py index f25d081..3505903 100644 --- a/patch_api/api/__init__.py +++ b/patch_api/api/__init__.py @@ -1,5 +1,7 @@ from __future__ import absolute_import +# flake8: noqa + # import apis into api package from patch_api.api.estimates_api import EstimatesApi from patch_api.api.order_line_items_api import OrderLineItemsApi diff --git a/patch_api/api/estimates_api.py b/patch_api/api/estimates_api.py index 5a129b1..bc9c637 100644 --- a/patch_api/api/estimates_api.py +++ b/patch_api/api/estimates_api.py @@ -485,204 +485,6 @@ def create_bitcoin_estimate_with_http_info( collection_formats=collection_formats, ) - def create_flight_estimate( - self, create_flight_estimate_request={}, **kwargs - ): # noqa: E501 - """Create a flight estimate given the distance traveled in meters # noqa: E501 - - Creates a flight 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_flight_estimate(create_flight_estimate_request, async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param CreateFlightEstimateRequest create_flight_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_flight_estimate_with_http_info( - create_flight_estimate_request, **kwargs - ) # noqa: E501 - - def create_flight_estimate_with_http_info( - self, create_flight_estimate_request, **kwargs - ): # noqa: E501 - """Create a flight estimate given the distance traveled in meters # noqa: E501 - - Creates a flight 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_flight_estimate_with_http_info(create_flight_estimate_request, async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param CreateFlightEstimateRequest create_flight_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_flight_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_flight_estimate" % key - ) - local_var_params[key] = val - del local_var_params["kwargs"] - # verify the required parameter 'create_flight_estimate_request' is set - if ( - "create_flight_estimate_request" not in local_var_params - or local_var_params["create_flight_estimate_request"] is None - ): - raise ApiValueError( - "Missing the required parameter `create_flight_estimate_request` when calling `create_flight_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_flight_estimate_request" in local_var_params: - body_params = local_var_params["create_flight_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/flight", - "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_mass_estimate( self, create_mass_estimate_request={}, **kwargs ): # noqa: E501 diff --git a/patch_api/api_client.py b/patch_api/api_client.py index d1bfdaf..eef9771 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.4.0" + self.user_agent = "patch-python/2.5.0" # Set default Patch-Version self.patch_version = 2 diff --git a/patch_api/configuration.py b/patch_api/configuration.py index 64fefdd..bc3ff12 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.4.0".format(env=sys.platform, pyversion=sys.version) + "SDK Package Version: 2.5.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 79f4d84..2a36706 100644 --- a/patch_api/models/__init__.py +++ b/patch_api/models/__init__.py @@ -1,5 +1,6 @@ # coding: utf-8 +# flake8: noqa """ Patch API V2 @@ -20,7 +21,6 @@ from patch_api.models.create_bitcoin_estimate_request import ( CreateBitcoinEstimateRequest, ) -from patch_api.models.create_flight_estimate_request import CreateFlightEstimateRequest from patch_api.models.create_mass_estimate_request import CreateMassEstimateRequest from patch_api.models.create_order_line_item_request import CreateOrderLineItemRequest from patch_api.models.create_order_request import CreateOrderRequest diff --git a/patch_api/models/create_ecommerce_estimate_request.py b/patch_api/models/create_ecommerce_estimate_request.py deleted file mode 100644 index e59d297..0000000 --- a/patch_api/models/create_ecommerce_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 CreateEcommerceEstimateRequest(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 - """CreateEcommerceEstimateRequest - 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 CreateEcommerceEstimateRequest. # noqa: E501 - - - :return: The distance_m of this CreateEcommerceEstimateRequest. # noqa: E501 - :rtype: int - """ - return self._distance_m - - @distance_m.setter - def distance_m(self, distance_m): - """Sets the distance_m of this CreateEcommerceEstimateRequest. - - - :param distance_m: The distance_m of this CreateEcommerceEstimateRequest. # 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 CreateEcommerceEstimateRequest. # noqa: E501 - - - :return: The package_mass_g of this CreateEcommerceEstimateRequest. # 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 CreateEcommerceEstimateRequest. - - - :param package_mass_g: The package_mass_g of this CreateEcommerceEstimateRequest. # 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 CreateEcommerceEstimateRequest. # noqa: E501 - - - :return: The transportation_method of this CreateEcommerceEstimateRequest. # noqa: E501 - :rtype: str - """ - return self._transportation_method - - @transportation_method.setter - def transportation_method(self, transportation_method): - """Sets the transportation_method of this CreateEcommerceEstimateRequest. - - - :param transportation_method: The transportation_method of this CreateEcommerceEstimateRequest. # 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 CreateEcommerceEstimateRequest. # noqa: E501 - - - :return: The project_id of this CreateEcommerceEstimateRequest. # noqa: E501 - :rtype: str - """ - return self._project_id - - @project_id.setter - def project_id(self, project_id): - """Sets the project_id of this CreateEcommerceEstimateRequest. - - - :param project_id: The project_id of this CreateEcommerceEstimateRequest. # noqa: E501 - :type: str - """ - - self._project_id = project_id - - @property - def create_order(self): - """Gets the create_order of this CreateEcommerceEstimateRequest. # noqa: E501 - - - :return: The create_order of this CreateEcommerceEstimateRequest. # noqa: E501 - :rtype: bool - """ - return self._create_order - - @create_order.setter - def create_order(self, create_order): - """Sets the create_order of this CreateEcommerceEstimateRequest. - - - :param create_order: The create_order of this CreateEcommerceEstimateRequest. # 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, CreateEcommerceEstimateRequest): - 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, CreateEcommerceEstimateRequest): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/create_flight_estimate_request.py b/patch_api/models/create_flight_estimate_request.py deleted file mode 100644 index e01bedf..0000000 --- a/patch_api/models/create_flight_estimate_request.py +++ /dev/null @@ -1,326 +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 CreateFlightEstimateRequest(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", - "origin_airport": "str", - "destination_airport": "str", - "aircraft_code": "str", - "cabin_class": "str", - "passenger_count": "int", - "project_id": "str", - "create_order": "bool", - } - - attribute_map = { - "distance_m": "distance_m", - "origin_airport": "origin_airport", - "destination_airport": "destination_airport", - "aircraft_code": "aircraft_code", - "cabin_class": "cabin_class", - "passenger_count": "passenger_count", - "project_id": "project_id", - "create_order": "create_order", - } - - def __init__( - self, - distance_m=None, - origin_airport=None, - destination_airport=None, - aircraft_code=None, - cabin_class=None, - passenger_count=None, - project_id=None, - create_order=False, - local_vars_configuration=None, - ): # noqa: E501 - """CreateFlightEstimateRequest - 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._origin_airport = None - self._destination_airport = None - self._aircraft_code = None - self._cabin_class = None - self._passenger_count = None - self._project_id = None - self._create_order = None - self.discriminator = None - - self.distance_m = distance_m - self.origin_airport = origin_airport - self.destination_airport = destination_airport - self.aircraft_code = aircraft_code - self.cabin_class = cabin_class - self.passenger_count = passenger_count - self.project_id = project_id - self.create_order = create_order - - @property - def distance_m(self): - """Gets the distance_m of this CreateFlightEstimateRequest. # noqa: E501 - - - :return: The distance_m of this CreateFlightEstimateRequest. # noqa: E501 - :rtype: int - """ - return self._distance_m - - @distance_m.setter - def distance_m(self, distance_m): - """Sets the distance_m of this CreateFlightEstimateRequest. - - - :param distance_m: The distance_m of this CreateFlightEstimateRequest. # noqa: E501 - :type: int - """ - 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 origin_airport(self): - """Gets the origin_airport of this CreateFlightEstimateRequest. # noqa: E501 - - - :return: The origin_airport of this CreateFlightEstimateRequest. # noqa: E501 - :rtype: str - """ - return self._origin_airport - - @origin_airport.setter - def origin_airport(self, origin_airport): - """Sets the origin_airport of this CreateFlightEstimateRequest. - - - :param origin_airport: The origin_airport of this CreateFlightEstimateRequest. # noqa: E501 - :type: str - """ - - self._origin_airport = origin_airport - - @property - def destination_airport(self): - """Gets the destination_airport of this CreateFlightEstimateRequest. # noqa: E501 - - - :return: The destination_airport of this CreateFlightEstimateRequest. # noqa: E501 - :rtype: str - """ - return self._destination_airport - - @destination_airport.setter - def destination_airport(self, destination_airport): - """Sets the destination_airport of this CreateFlightEstimateRequest. - - - :param destination_airport: The destination_airport of this CreateFlightEstimateRequest. # noqa: E501 - :type: str - """ - - self._destination_airport = destination_airport - - @property - def aircraft_code(self): - """Gets the aircraft_code of this CreateFlightEstimateRequest. # noqa: E501 - - - :return: The aircraft_code of this CreateFlightEstimateRequest. # noqa: E501 - :rtype: str - """ - return self._aircraft_code - - @aircraft_code.setter - def aircraft_code(self, aircraft_code): - """Sets the aircraft_code of this CreateFlightEstimateRequest. - - - :param aircraft_code: The aircraft_code of this CreateFlightEstimateRequest. # noqa: E501 - :type: str - """ - - self._aircraft_code = aircraft_code - - @property - def cabin_class(self): - """Gets the cabin_class of this CreateFlightEstimateRequest. # noqa: E501 - - - :return: The cabin_class of this CreateFlightEstimateRequest. # noqa: E501 - :rtype: str - """ - return self._cabin_class - - @cabin_class.setter - def cabin_class(self, cabin_class): - """Sets the cabin_class of this CreateFlightEstimateRequest. - - - :param cabin_class: The cabin_class of this CreateFlightEstimateRequest. # noqa: E501 - :type: str - """ - - self._cabin_class = cabin_class - - @property - def passenger_count(self): - """Gets the passenger_count of this CreateFlightEstimateRequest. # noqa: E501 - - - :return: The passenger_count of this CreateFlightEstimateRequest. # noqa: E501 - :rtype: int - """ - return self._passenger_count - - @passenger_count.setter - def passenger_count(self, passenger_count): - """Sets the passenger_count of this CreateFlightEstimateRequest. - - - :param passenger_count: The passenger_count of this CreateFlightEstimateRequest. # noqa: E501 - :type: int - """ - - self._passenger_count = passenger_count - - @property - def project_id(self): - """Gets the project_id of this CreateFlightEstimateRequest. # noqa: E501 - - - :return: The project_id of this CreateFlightEstimateRequest. # noqa: E501 - :rtype: str - """ - return self._project_id - - @project_id.setter - def project_id(self, project_id): - """Sets the project_id of this CreateFlightEstimateRequest. - - - :param project_id: The project_id of this CreateFlightEstimateRequest. # noqa: E501 - :type: str - """ - - self._project_id = project_id - - @property - def create_order(self): - """Gets the create_order of this CreateFlightEstimateRequest. # noqa: E501 - - - :return: The create_order of this CreateFlightEstimateRequest. # noqa: E501 - :rtype: bool - """ - return self._create_order - - @create_order.setter - def create_order(self, create_order): - """Sets the create_order of this CreateFlightEstimateRequest. - - - :param create_order: The create_order of this CreateFlightEstimateRequest. # 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, CreateFlightEstimateRequest): - 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, CreateFlightEstimateRequest): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/estimate.py b/patch_api/models/estimate.py index 7f7f301..cf57cd6 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, and crypto. # noqa: E501 + The type of estimate. Available types are mass, 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, and crypto. # noqa: E501 + The type of estimate. Available types are mass, shipping, and crypto. # noqa: E501 :param type: The type of this Estimate. # noqa: E501 :type: str diff --git a/setup.py b/setup.py index 1850ce0..4cd30b4 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "patch-api" -VERSION = "2.4.0" +VERSION = "2.5.0" # To install the library, run the following # # python setup.py install From c6d51c5ad82fceece652ae6d12fef688918b4199 Mon Sep 17 00:00:00 2001 From: Paul Cothenet Date: Tue, 19 Aug 2025 15:14:42 -0700 Subject: [PATCH 2/2] Remove the tests --- README.md | 21 --------------------- test/test_estimates_api.py | 29 ----------------------------- 2 files changed, 50 deletions(-) diff --git a/README.md b/README.md index 1a1c24d..1219827 100644 --- a/README.md +++ b/README.md @@ -135,27 +135,6 @@ patch.estimates.create_mass_estimate(mass_g=mass_g) project_id = 'pro_test_1234' # Pass in the project's ID patch.estimates.create_mass_estimate(mass_g=mass_g, project_id=project_id) -# Create a flight estimate -distance_m = 1_000_000 # Pass in the distance traveled in meters -patch.estimates.create_flight_estimate(distance_m=distance_m) - -# Create an ecommerce estimate -distance_m = 1_000_000 # Pass in the distance traveled in meters -transportation_method = "rail" -package_mass_g = 5000 -patch.estimates.create_ecommerce_estimate( - distance_m=distance_m, - transportation_method=transportation_method, - package_mass_g=package_mass_g -) - -# Create a vehicle estimate -distance_m = 1_000_000 # Pass in the distance traveled in meters -make = "Toyota" -model = "Corolla" -year = 1995 -patch.estimates.create_vehicle_estimate(distance_m=distance_m, make=make, model=model, year=year) - # Create a bitcoin estimate transaction_value_btc_sats = 1000 # [Optional] Pass in the transaction value in satoshis patch.estimates.create_bitcoin_estimate(transaction_value_btc_sats=transaction_value_btc_sats) diff --git a/test/test_estimates_api.py b/test/test_estimates_api.py index b38cac3..b447110 100644 --- a/test/test_estimates_api.py +++ b/test/test_estimates_api.py @@ -45,35 +45,6 @@ def test_create_and_retrieve_mass_estimate(self): retrieved_estimate = self.api.retrieve_estimate(id=estimate.data.id) self.assertTrue(retrieved_estimate) - def test_create_and_retrieve_flight_estimate(self): - """Test case for create_flight_estimate - - Create an estimate based on the distance in meters flown by an airplane # noqa: E501 - """ - distance_m = 1000000 - estimate = self.api.create_flight_estimate( - distance_m=distance_m, create_order=True - ) - self.assertEqual(estimate.data.type, "flight") - self.assertGreater(estimate.data.order.amount, 50000) - 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_flight_estimate_with_airports(self): - """Test case for create_flight_estimate - - Create an estimate based on the distance in meters flown by an airplane # noqa: E501 - """ - estimate_short = self.api.create_flight_estimate( - origin_airport="SFO", destination_airport="LAX" - ) - estimate_long = self.api.create_flight_estimate( - origin_airport="SFO", destination_airport="JFK" - ) - self.assertGreater(estimate_long.data.mass_g, estimate_short.data.mass_g) - def test_create_bitcoin_estimate_no_params(self): """Test case for create_bitcoin_estimate