From 53b06e3dfb45f8ca25a38abbe8ab4c9e17ed6348 Mon Sep 17 00:00:00 2001 From: Brett Holt Date: Fri, 22 Jul 2022 14:43:24 -0700 Subject: [PATCH 1/6] Add patch.estimates methods for GLEC-certified shipping estimates --- CHANGELOG.md | 9 + patch_api/__init__.py | 2 +- patch_api/api/estimates_api.py | 663 +++++++++++++++++- patch_api/api_client.py | 2 +- patch_api/configuration.py | 2 +- patch_api/models/__init__.py | 12 + .../create_air_shipping_estimate_request.py | 387 ++++++++++ patch_api/models/create_order_request.py | 2 +- .../create_rail_shipping_estimate_request.py | 465 ++++++++++++ .../create_road_shipping_estimate_request.py | 615 ++++++++++++++++ .../create_sea_shipping_estimate_request.py | 560 +++++++++++++++ patch_api/models/order.py | 1 + patch_api/models/project.py | 4 +- requirements.txt | 2 +- setup.py | 2 +- test/test_estimates_api.py | 244 +++++++ 16 files changed, 2937 insertions(+), 35 deletions(-) create mode 100644 patch_api/models/create_air_shipping_estimate_request.py create mode 100644 patch_api/models/create_rail_shipping_estimate_request.py create mode 100644 patch_api/models/create_road_shipping_estimate_request.py create mode 100644 patch_api/models/create_sea_shipping_estimate_request.py diff --git a/CHANGELOG.md b/CHANGELOG.md index ced6e74..143e6aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ 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). +## [1.24.0] - 2022-07-22 + +### Added + +- Adds `Patch::Estimate.create_air_shipping_estimate` method +- Adds `Patch::Estimate.create_rail_shipping_estimate` method +- Adds `Patch::Estimate.create_road_shipping_estimate` method +- Adds `Patch::Estimate.create_sea_shipping_estimate` method + ## [1.23.0] - 2022-06-03 ### Added diff --git a/patch_api/__init__.py b/patch_api/__init__.py index ba0ee57..cf3216b 100644 --- a/patch_api/__init__.py +++ b/patch_api/__init__.py @@ -15,7 +15,7 @@ from __future__ import absolute_import -__version__ = "1.23.0" +__version__ = "1.24.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 f442ad4..069c4ef 100644 --- a/patch_api/api/estimates_api.py +++ b/patch_api/api/estimates_api.py @@ -29,46 +29,195 @@ class EstimatesApi(object): """ ALLOWED_QUERY_PARAMS = [ - "mass_g", - "total_price_cents_usd", - "project_id", - "page", - "distance_m", - "transportation_method", - "package_mass_g", - "create_order", - "model", - "make", - "year", - "transaction_value_btc_sats", - "transaction_value_eth_gwei", - "gas_used", + "aircraft_code", + "amount", "average_daily_balance_btc_sats", "average_daily_balance_eth_gwei", - "timestamp", - "origin_aiport", - "destination_aiport", - "aircraft_code", "cabin_class", - "passenger_count", - "state", - "country_code", "city", - "region", - "star_rating", + "country_code", + "create_order", + "currency", + "destination_aiport", + "distance_m", + "emissions_scope", + "freight_mass_g", + "gas_used", + "issued_to", + "make", + "mass_g", + "model", "number_of_nights", "number_of_rooms", - "vintage_year", + "origin_aiport", + "package_mass_g", + "page", + "passenger_count", + "project_id", + "region", + "star_rating", + "state", + "timestamp", "total_price", - "currency", - "amount", + "total_price_cents_usd", + "transaction_value_btc_sats", + "transaction_value_eth_gwei", + "transportation_method", "unit", - "issued_to", + "vintage_year", + "year", ] def __init__(self, api_client=None): self.api_client = api_client + def create_air_shipping_estimate( + self, create_air_shipping_estimate_request={}, **kwargs + ): # noqa: E501 + """Creates a GLEC air shipping estimate given freight mass and logistics # noqa: E501 + + Creates a GLEC air shipping 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_air_shipping_estimate(create_air_shipping_estimate_request, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param CreateAirShippingEstimateRequest create_air_shipping_estimate_request: (required) + :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_air_shipping_estimate_with_http_info( + create_air_shipping_estimate_request, **kwargs + ) # noqa: E501 + + def create_air_shipping_estimate_with_http_info( + self, create_air_shipping_estimate_request, **kwargs + ): # noqa: E501 + """Creates a GLEC air shipping estimate given freight mass and logistics # noqa: E501 + + Creates a GLEC air shipping 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_air_shipping_estimate_with_http_info(create_air_shipping_estimate_request, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param CreateAirShippingEstimateRequest create_air_shipping_estimate_request: (required) + :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_air_shipping_estimate_request"] # noqa: E501 + all_params.append("_preload_content") + all_params.append("_request_timeout") + all_params.append("_return_http_data_only") + all_params.append("aircraft_iata") + all_params.append("aircraft_type") + all_params.append("create_order") + all_params.append("destination_iata") + all_params.append("distance_m") + all_params.append("emissions_scope") + all_params.append("freight_mass_g") + all_params.append("origin_iata") + all_params.append("project_id") + + 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_air_shipping_estimate" % key + ) + local_var_params[key] = val + del local_var_params["kwargs"] + # verify the required parameter 'create_air_shipping_estimate_request' is set + if ( + "create_air_shipping_estimate_request" not in local_var_params + or local_var_params["create_air_shipping_estimate_request"] is None + ): + raise ApiValueError( + "Missing the required parameter `create_air_shipping_estimate_request` when calling `create_air_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 = {} + + form_params = [] + local_var_files = {} + + body_params = None + if "create_air_shipping_estimate_request" in local_var_params: + body_params = local_var_params["create_air_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/air", + "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_bitcoin_estimate( self, create_bitcoin_estimate_request={}, **kwargs ): # noqa: E501 @@ -944,6 +1093,466 @@ def create_mass_estimate_with_http_info( collection_formats=collection_formats, ) + def create_rail_shipping_estimate( + self, create_rail_shipping_estimate_request={}, **kwargs + ): # noqa: E501 + """Creates a GLEC rail shipping estimate given freight mass and logistics # noqa: E501 + + Creates a GLEC rail shipping 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_rail_shipping_estimate(create_rail_shipping_estimate_request, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param CreateRailShippingEstimateRequest create_rail_shipping_estimate_request: (required) + :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_rail_shipping_estimate_with_http_info( + create_rail_shipping_estimate_request, **kwargs + ) # noqa: E501 + + def create_rail_shipping_estimate_with_http_info( + self, create_rail_shipping_estimate_request, **kwargs + ): # noqa: E501 + """Creates a GLEC rail shipping estimate given freight mass and logistics # noqa: E501 + + Creates a GLEC rail shipping 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_rail_shipping_estimate_with_http_info(create_rail_shipping_estimate_request, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param CreateRailShippingEstimateRequest create_rail_shipping_estimate_request: (required) + :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_rail_shipping_estimate_request"] # 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("create_order") + all_params.append("destination_country_code") + all_params.append("destination_locode") + all_params.append("destination_postal_code") + all_params.append("distance_m") + all_params.append("emissions_scope") + all_params.append("freight_mass_g") + all_params.append("fuel_type") + all_params.append("origin_country_code") + all_params.append("origin_locode") + all_params.append("origin_postal_code") + all_params.append("project_id") + + 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_rail_shipping_estimate" % key + ) + local_var_params[key] = val + del local_var_params["kwargs"] + # verify the required parameter 'create_rail_shipping_estimate_request' is set + if ( + "create_rail_shipping_estimate_request" not in local_var_params + or local_var_params["create_rail_shipping_estimate_request"] is None + ): + raise ApiValueError( + "Missing the required parameter `create_rail_shipping_estimate_request` when calling `create_rail_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 = {} + + form_params = [] + local_var_files = {} + + body_params = None + if "create_rail_shipping_estimate_request" in local_var_params: + body_params = local_var_params["create_rail_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/rail", + "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_road_shipping_estimate( + self, create_road_shipping_estimate_request={}, **kwargs + ): # noqa: E501 + """Creates a GLEC road shipping estimate given freight mass and logistics # noqa: E501 + + Creates a GLEC road shipping 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_road_shipping_estimate(create_road_shipping_estimate_request, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param CreateRoadShippingEstimateRequest create_road_shipping_estimate_request: (required) + :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_road_shipping_estimate_with_http_info( + create_road_shipping_estimate_request, **kwargs + ) # noqa: E501 + + def create_road_shipping_estimate_with_http_info( + self, create_road_shipping_estimate_request, **kwargs + ): # noqa: E501 + """Creates a GLEC road shipping estimate given freight mass and logistics # noqa: E501 + + Creates a GLEC road shipping 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_road_shipping_estimate_with_http_info(create_road_shipping_estimate_request, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param CreateRoadShippingEstimateRequest create_road_shipping_estimate_request: (required) + :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_road_shipping_estimate_request"] # 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("cargo_type") + all_params.append("container_size_code") + all_params.append("create_order") + all_params.append("destination_country_code") + all_params.append("destination_locode") + all_params.append("destination_postal_code") + all_params.append("distance_m") + all_params.append("emissions_scope") + all_params.append("freight_mass_g") + 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("project_id") + all_params.append("truck_weight_t") + + 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_road_shipping_estimate" % key + ) + local_var_params[key] = val + del local_var_params["kwargs"] + # verify the required parameter 'create_road_shipping_estimate_request' is set + if ( + "create_road_shipping_estimate_request" not in local_var_params + or local_var_params["create_road_shipping_estimate_request"] is None + ): + raise ApiValueError( + "Missing the required parameter `create_road_shipping_estimate_request` when calling `create_road_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 = {} + + form_params = [] + local_var_files = {} + + body_params = None + if "create_road_shipping_estimate_request" in local_var_params: + body_params = local_var_params["create_road_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/road", + "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_sea_shipping_estimate( + self, create_sea_shipping_estimate_request={}, **kwargs + ): # noqa: E501 + """Creates a GLEC sea shipping estimate given freight mass and logistics # noqa: E501 + + Creates a GLEC sea shipping 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_sea_shipping_estimate(create_sea_shipping_estimate_request, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param CreateSeaShippingEstimateRequest create_sea_shipping_estimate_request: (required) + :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_sea_shipping_estimate_with_http_info( + create_sea_shipping_estimate_request, **kwargs + ) # noqa: E501 + + def create_sea_shipping_estimate_with_http_info( + self, create_sea_shipping_estimate_request, **kwargs + ): # noqa: E501 + """Creates a GLEC sea shipping estimate given freight mass and logistics # noqa: E501 + + Creates a GLEC sea shipping 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_sea_shipping_estimate_with_http_info(create_sea_shipping_estimate_request, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param CreateSeaShippingEstimateRequest create_sea_shipping_estimate_request: (required) + :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_sea_shipping_estimate_request"] # 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("container_size_code") + all_params.append("create_order") + all_params.append("destination_country_code") + all_params.append("destination_locode") + all_params.append("destination_postal_code") + all_params.append("distance_m") + all_params.append("emissions_scope") + all_params.append("freight_mass_g") + all_params.append("freight_volume_cubic_m") + 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("project_id") + all_params.append("vessel_imo") + + 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_sea_shipping_estimate" % key + ) + local_var_params[key] = val + del local_var_params["kwargs"] + # verify the required parameter 'create_sea_shipping_estimate_request' is set + if ( + "create_sea_shipping_estimate_request" not in local_var_params + or local_var_params["create_sea_shipping_estimate_request"] is None + ): + raise ApiValueError( + "Missing the required parameter `create_sea_shipping_estimate_request` when calling `create_sea_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 = {} + + form_params = [] + local_var_files = {} + + body_params = None + if "create_sea_shipping_estimate_request" in local_var_params: + body_params = local_var_params["create_sea_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/sea", + "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_shipping_estimate( self, create_shipping_estimate_request={}, **kwargs ): # noqa: E501 diff --git a/patch_api/api_client.py b/patch_api/api_client.py index 2ab12c7..ef814f5 100644 --- a/patch_api/api_client.py +++ b/patch_api/api_client.py @@ -91,7 +91,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = "patch-python/1.23.0" + self.user_agent = "patch-python/1.24.0" def __del__(self): if self._pool: diff --git a/patch_api/configuration.py b/patch_api/configuration.py index 721ae6b..4fe00de 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: v1\n" - "SDK Package Version: 1.23.0".format( + "SDK Package Version: 1.24.0".format( env=sys.platform, pyversion=sys.version ) ) diff --git a/patch_api/models/__init__.py b/patch_api/models/__init__.py index 2e5ade6..6b2134f 100644 --- a/patch_api/models/__init__.py +++ b/patch_api/models/__init__.py @@ -16,6 +16,9 @@ # import models into model package from patch_api.models.allocation import Allocation +from patch_api.models.create_air_shipping_estimate_request import ( + CreateAirShippingEstimateRequest, +) from patch_api.models.create_bitcoin_estimate_request import ( CreateBitcoinEstimateRequest, ) @@ -26,6 +29,15 @@ from patch_api.models.create_hotel_estimate_request import CreateHotelEstimateRequest from patch_api.models.create_mass_estimate_request import CreateMassEstimateRequest from patch_api.models.create_order_request import CreateOrderRequest +from patch_api.models.create_rail_shipping_estimate_request import ( + CreateRailShippingEstimateRequest, +) +from patch_api.models.create_road_shipping_estimate_request import ( + CreateRoadShippingEstimateRequest, +) +from patch_api.models.create_sea_shipping_estimate_request import ( + CreateSeaShippingEstimateRequest, +) from patch_api.models.create_shipping_estimate_request import ( CreateShippingEstimateRequest, ) diff --git a/patch_api/models/create_air_shipping_estimate_request.py b/patch_api/models/create_air_shipping_estimate_request.py new file mode 100644 index 0000000..c34aef7 --- /dev/null +++ b/patch_api/models/create_air_shipping_estimate_request.py @@ -0,0 +1,387 @@ +# coding: utf-8 + +""" + Patch API V1 + + The core API used to integrate with Patch's service # noqa: E501 + + The version of the OpenAPI document: v1 + 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 CreateAirShippingEstimateRequest(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 = { + "destination_iata": "str", + "origin_iata": "str", + "aircraft_iata": "str", + "aircraft_type": "str", + "freight_mass_g": "int", + "distance_m": "int", + "emissions_scope": "str", + "project_id": "str", + "create_order": "bool", + } + + attribute_map = { + "destination_iata": "destination_iata", + "origin_iata": "origin_iata", + "aircraft_iata": "aircraft_iata", + "aircraft_type": "aircraft_type", + "freight_mass_g": "freight_mass_g", + "distance_m": "distance_m", + "emissions_scope": "emissions_scope", + "project_id": "project_id", + "create_order": "create_order", + } + + def __init__( + self, + destination_iata=None, + origin_iata=None, + aircraft_iata=None, + aircraft_type="UNKNOWN", + freight_mass_g=None, + distance_m=None, + emissions_scope="wtw", + project_id=None, + create_order=False, + local_vars_configuration=None, + ): # noqa: E501 + """CreateAirShippingEstimateRequest - 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._destination_iata = None + self._origin_iata = None + self._aircraft_iata = None + self._aircraft_type = None + self._freight_mass_g = None + self._distance_m = None + self._emissions_scope = None + self._project_id = None + self._create_order = None + self.discriminator = None + + self.destination_iata = destination_iata + self.origin_iata = origin_iata + self.aircraft_iata = aircraft_iata + self.aircraft_type = aircraft_type + if freight_mass_g is not None: + self.freight_mass_g = freight_mass_g + self.distance_m = distance_m + self.emissions_scope = emissions_scope + self.project_id = project_id + self.create_order = create_order + + @property + def destination_iata(self): + """Gets the destination_iata of this CreateAirShippingEstimateRequest. # noqa: E501 + + + :return: The destination_iata of this CreateAirShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._destination_iata + + @destination_iata.setter + def destination_iata(self, destination_iata): + """Sets the destination_iata of this CreateAirShippingEstimateRequest. + + + :param destination_iata: The destination_iata of this CreateAirShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._destination_iata = destination_iata + + @property + def origin_iata(self): + """Gets the origin_iata of this CreateAirShippingEstimateRequest. # noqa: E501 + + + :return: The origin_iata of this CreateAirShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._origin_iata + + @origin_iata.setter + def origin_iata(self, origin_iata): + """Sets the origin_iata of this CreateAirShippingEstimateRequest. + + + :param origin_iata: The origin_iata of this CreateAirShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._origin_iata = origin_iata + + @property + def aircraft_iata(self): + """Gets the aircraft_iata of this CreateAirShippingEstimateRequest. # noqa: E501 + + + :return: The aircraft_iata of this CreateAirShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._aircraft_iata + + @aircraft_iata.setter + def aircraft_iata(self, aircraft_iata): + """Sets the aircraft_iata of this CreateAirShippingEstimateRequest. + + + :param aircraft_iata: The aircraft_iata of this CreateAirShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._aircraft_iata = aircraft_iata + + @property + def aircraft_type(self): + """Gets the aircraft_type of this CreateAirShippingEstimateRequest. # noqa: E501 + + + :return: The aircraft_type of this CreateAirShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._aircraft_type + + @aircraft_type.setter + def aircraft_type(self, aircraft_type): + """Sets the aircraft_type of this CreateAirShippingEstimateRequest. + + + :param aircraft_type: The aircraft_type of this CreateAirShippingEstimateRequest. # noqa: E501 + :type: str + """ + allowed_values = [None, "PASSENGER", "CARGO", "UNKNOWN"] # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and aircraft_type not in allowed_values + ): # noqa: E501 + raise ValueError( + "Invalid value for `aircraft_type` ({0}), must be one of {1}".format( # noqa: E501 + aircraft_type, allowed_values + ) + ) + + self._aircraft_type = aircraft_type + + @property + def freight_mass_g(self): + """Gets the freight_mass_g of this CreateAirShippingEstimateRequest. # noqa: E501 + + + :return: The freight_mass_g of this CreateAirShippingEstimateRequest. # noqa: E501 + :rtype: int + """ + return self._freight_mass_g + + @freight_mass_g.setter + def freight_mass_g(self, freight_mass_g): + """Sets the freight_mass_g of this CreateAirShippingEstimateRequest. + + + :param freight_mass_g: The freight_mass_g of this CreateAirShippingEstimateRequest. # noqa: E501 + :type: int + """ + if ( + self.local_vars_configuration.client_side_validation + and freight_mass_g is not None + and freight_mass_g > 2000000000 + ): # noqa: E501 + raise ValueError( + "Invalid value for `freight_mass_g`, must be a value less than or equal to `2000000000`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and freight_mass_g is not None + and freight_mass_g < 0 + ): # noqa: E501 + raise ValueError( + "Invalid value for `freight_mass_g`, must be a value greater than or equal to `0`" + ) # noqa: E501 + + self._freight_mass_g = freight_mass_g + + @property + def distance_m(self): + """Gets the distance_m of this CreateAirShippingEstimateRequest. # noqa: E501 + + + :return: The distance_m of this CreateAirShippingEstimateRequest. # noqa: E501 + :rtype: int + """ + return self._distance_m + + @distance_m.setter + def distance_m(self, distance_m): + """Sets the distance_m of this CreateAirShippingEstimateRequest. + + + :param distance_m: The distance_m of this CreateAirShippingEstimateRequest. # 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 emissions_scope(self): + """Gets the emissions_scope of this CreateAirShippingEstimateRequest. # noqa: E501 + + + :return: The emissions_scope of this CreateAirShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._emissions_scope + + @emissions_scope.setter + def emissions_scope(self, emissions_scope): + """Sets the emissions_scope of this CreateAirShippingEstimateRequest. + + + :param emissions_scope: The emissions_scope of this CreateAirShippingEstimateRequest. # noqa: E501 + :type: str + """ + allowed_values = [None, "wtt", "ttw", "wtw"] # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and emissions_scope not in allowed_values + ): # noqa: E501 + raise ValueError( + "Invalid value for `emissions_scope` ({0}), must be one of {1}".format( # noqa: E501 + emissions_scope, allowed_values + ) + ) + + self._emissions_scope = emissions_scope + + @property + def project_id(self): + """Gets the project_id of this CreateAirShippingEstimateRequest. # noqa: E501 + + + :return: The project_id of this CreateAirShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._project_id + + @project_id.setter + def project_id(self, project_id): + """Sets the project_id of this CreateAirShippingEstimateRequest. + + + :param project_id: The project_id of this CreateAirShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._project_id = project_id + + @property + def create_order(self): + """Gets the create_order of this CreateAirShippingEstimateRequest. # noqa: E501 + + + :return: The create_order of this CreateAirShippingEstimateRequest. # noqa: E501 + :rtype: bool + """ + return self._create_order + + @create_order.setter + def create_order(self, create_order): + """Sets the create_order of this CreateAirShippingEstimateRequest. + + + :param create_order: The create_order of this CreateAirShippingEstimateRequest. # 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, CreateAirShippingEstimateRequest): + 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, CreateAirShippingEstimateRequest): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/create_order_request.py b/patch_api/models/create_order_request.py index 8e8b68b..6048b74 100644 --- a/patch_api/models/create_order_request.py +++ b/patch_api/models/create_order_request.py @@ -232,7 +232,7 @@ def state(self, state): :param state: The state of this CreateOrderRequest. # noqa: E501 :type: str """ - allowed_values = [None, "draft", "placed"] # noqa: E501 + allowed_values = [None, "draft", "reserved", "placed"] # noqa: E501 if ( self.local_vars_configuration.client_side_validation and state not in allowed_values diff --git a/patch_api/models/create_rail_shipping_estimate_request.py b/patch_api/models/create_rail_shipping_estimate_request.py new file mode 100644 index 0000000..9a135b2 --- /dev/null +++ b/patch_api/models/create_rail_shipping_estimate_request.py @@ -0,0 +1,465 @@ +# coding: utf-8 + +""" + Patch API V1 + + The core API used to integrate with Patch's service # noqa: E501 + + The version of the OpenAPI document: v1 + 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 CreateRailShippingEstimateRequest(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 = { + "destination_country_code": "str", + "destination_locode": "str", + "destination_postal_code": "str", + "origin_country_code": "str", + "origin_locode": "str", + "origin_postal_code": "str", + "fuel_type": "str", + "freight_mass_g": "int", + "distance_m": "int", + "emissions_scope": "str", + "project_id": "str", + "create_order": "bool", + } + + attribute_map = { + "destination_country_code": "destination_country_code", + "destination_locode": "destination_locode", + "destination_postal_code": "destination_postal_code", + "origin_country_code": "origin_country_code", + "origin_locode": "origin_locode", + "origin_postal_code": "origin_postal_code", + "fuel_type": "fuel_type", + "freight_mass_g": "freight_mass_g", + "distance_m": "distance_m", + "emissions_scope": "emissions_scope", + "project_id": "project_id", + "create_order": "create_order", + } + + def __init__( + self, + destination_country_code=None, + destination_locode=None, + destination_postal_code=None, + origin_country_code=None, + origin_locode=None, + origin_postal_code=None, + fuel_type="DEFAULT", + freight_mass_g=None, + distance_m=None, + emissions_scope="wtw", + project_id=None, + create_order=False, + local_vars_configuration=None, + ): # noqa: E501 + """CreateRailShippingEstimateRequest - 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._destination_country_code = None + self._destination_locode = None + self._destination_postal_code = None + self._origin_country_code = None + self._origin_locode = None + self._origin_postal_code = None + self._fuel_type = None + self._freight_mass_g = None + self._distance_m = None + self._emissions_scope = None + self._project_id = None + self._create_order = None + self.discriminator = None + + self.destination_country_code = destination_country_code + self.destination_locode = destination_locode + self.destination_postal_code = destination_postal_code + self.origin_country_code = origin_country_code + self.origin_locode = origin_locode + self.origin_postal_code = origin_postal_code + self.fuel_type = fuel_type + if freight_mass_g is not None: + self.freight_mass_g = freight_mass_g + self.distance_m = distance_m + self.emissions_scope = emissions_scope + self.project_id = project_id + self.create_order = create_order + + @property + def destination_country_code(self): + """Gets the destination_country_code of this CreateRailShippingEstimateRequest. # noqa: E501 + + + :return: The destination_country_code of this CreateRailShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._destination_country_code + + @destination_country_code.setter + def destination_country_code(self, destination_country_code): + """Sets the destination_country_code of this CreateRailShippingEstimateRequest. + + + :param destination_country_code: The destination_country_code of this CreateRailShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._destination_country_code = destination_country_code + + @property + def destination_locode(self): + """Gets the destination_locode of this CreateRailShippingEstimateRequest. # noqa: E501 + + + :return: The destination_locode of this CreateRailShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._destination_locode + + @destination_locode.setter + def destination_locode(self, destination_locode): + """Sets the destination_locode of this CreateRailShippingEstimateRequest. + + + :param destination_locode: The destination_locode of this CreateRailShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._destination_locode = destination_locode + + @property + def destination_postal_code(self): + """Gets the destination_postal_code of this CreateRailShippingEstimateRequest. # noqa: E501 + + + :return: The destination_postal_code of this CreateRailShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._destination_postal_code + + @destination_postal_code.setter + def destination_postal_code(self, destination_postal_code): + """Sets the destination_postal_code of this CreateRailShippingEstimateRequest. + + + :param destination_postal_code: The destination_postal_code of this CreateRailShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._destination_postal_code = destination_postal_code + + @property + def origin_country_code(self): + """Gets the origin_country_code of this CreateRailShippingEstimateRequest. # noqa: E501 + + + :return: The origin_country_code of this CreateRailShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._origin_country_code + + @origin_country_code.setter + def origin_country_code(self, origin_country_code): + """Sets the origin_country_code of this CreateRailShippingEstimateRequest. + + + :param origin_country_code: The origin_country_code of this CreateRailShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._origin_country_code = origin_country_code + + @property + def origin_locode(self): + """Gets the origin_locode of this CreateRailShippingEstimateRequest. # noqa: E501 + + + :return: The origin_locode of this CreateRailShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._origin_locode + + @origin_locode.setter + def origin_locode(self, origin_locode): + """Sets the origin_locode of this CreateRailShippingEstimateRequest. + + + :param origin_locode: The origin_locode of this CreateRailShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._origin_locode = origin_locode + + @property + def origin_postal_code(self): + """Gets the origin_postal_code of this CreateRailShippingEstimateRequest. # noqa: E501 + + + :return: The origin_postal_code of this CreateRailShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._origin_postal_code + + @origin_postal_code.setter + def origin_postal_code(self, origin_postal_code): + """Sets the origin_postal_code of this CreateRailShippingEstimateRequest. + + + :param origin_postal_code: The origin_postal_code of this CreateRailShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._origin_postal_code = origin_postal_code + + @property + def fuel_type(self): + """Gets the fuel_type of this CreateRailShippingEstimateRequest. # noqa: E501 + + + :return: The fuel_type of this CreateRailShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._fuel_type + + @fuel_type.setter + def fuel_type(self, fuel_type): + """Sets the fuel_type of this CreateRailShippingEstimateRequest. + + + :param fuel_type: The fuel_type of this CreateRailShippingEstimateRequest. # noqa: E501 + :type: str + """ + allowed_values = [None, "DEFAULT", "DIESEL", "ELEC"] # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and fuel_type not in allowed_values + ): # noqa: E501 + raise ValueError( + "Invalid value for `fuel_type` ({0}), must be one of {1}".format( # noqa: E501 + fuel_type, allowed_values + ) + ) + + self._fuel_type = fuel_type + + @property + def freight_mass_g(self): + """Gets the freight_mass_g of this CreateRailShippingEstimateRequest. # noqa: E501 + + + :return: The freight_mass_g of this CreateRailShippingEstimateRequest. # noqa: E501 + :rtype: int + """ + return self._freight_mass_g + + @freight_mass_g.setter + def freight_mass_g(self, freight_mass_g): + """Sets the freight_mass_g of this CreateRailShippingEstimateRequest. + + + :param freight_mass_g: The freight_mass_g of this CreateRailShippingEstimateRequest. # noqa: E501 + :type: int + """ + if ( + self.local_vars_configuration.client_side_validation + and freight_mass_g is not None + and freight_mass_g > 2000000000 + ): # noqa: E501 + raise ValueError( + "Invalid value for `freight_mass_g`, must be a value less than or equal to `2000000000`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and freight_mass_g is not None + and freight_mass_g < 0 + ): # noqa: E501 + raise ValueError( + "Invalid value for `freight_mass_g`, must be a value greater than or equal to `0`" + ) # noqa: E501 + + self._freight_mass_g = freight_mass_g + + @property + def distance_m(self): + """Gets the distance_m of this CreateRailShippingEstimateRequest. # noqa: E501 + + + :return: The distance_m of this CreateRailShippingEstimateRequest. # noqa: E501 + :rtype: int + """ + return self._distance_m + + @distance_m.setter + def distance_m(self, distance_m): + """Sets the distance_m of this CreateRailShippingEstimateRequest. + + + :param distance_m: The distance_m of this CreateRailShippingEstimateRequest. # 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 emissions_scope(self): + """Gets the emissions_scope of this CreateRailShippingEstimateRequest. # noqa: E501 + + + :return: The emissions_scope of this CreateRailShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._emissions_scope + + @emissions_scope.setter + def emissions_scope(self, emissions_scope): + """Sets the emissions_scope of this CreateRailShippingEstimateRequest. + + + :param emissions_scope: The emissions_scope of this CreateRailShippingEstimateRequest. # noqa: E501 + :type: str + """ + allowed_values = [None, "wtt", "ttw", "wtw"] # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and emissions_scope not in allowed_values + ): # noqa: E501 + raise ValueError( + "Invalid value for `emissions_scope` ({0}), must be one of {1}".format( # noqa: E501 + emissions_scope, allowed_values + ) + ) + + self._emissions_scope = emissions_scope + + @property + def project_id(self): + """Gets the project_id of this CreateRailShippingEstimateRequest. # noqa: E501 + + + :return: The project_id of this CreateRailShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._project_id + + @project_id.setter + def project_id(self, project_id): + """Sets the project_id of this CreateRailShippingEstimateRequest. + + + :param project_id: The project_id of this CreateRailShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._project_id = project_id + + @property + def create_order(self): + """Gets the create_order of this CreateRailShippingEstimateRequest. # noqa: E501 + + + :return: The create_order of this CreateRailShippingEstimateRequest. # noqa: E501 + :rtype: bool + """ + return self._create_order + + @create_order.setter + def create_order(self, create_order): + """Sets the create_order of this CreateRailShippingEstimateRequest. + + + :param create_order: The create_order of this CreateRailShippingEstimateRequest. # 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, CreateRailShippingEstimateRequest): + 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, CreateRailShippingEstimateRequest): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/create_road_shipping_estimate_request.py b/patch_api/models/create_road_shipping_estimate_request.py new file mode 100644 index 0000000..fcf1564 --- /dev/null +++ b/patch_api/models/create_road_shipping_estimate_request.py @@ -0,0 +1,615 @@ +# coding: utf-8 + +""" + Patch API V1 + + The core API used to integrate with Patch's service # noqa: E501 + + The version of the OpenAPI document: v1 + 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 CreateRoadShippingEstimateRequest(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 = { + "destination_country_code": "str", + "destination_locode": "str", + "destination_postal_code": "str", + "origin_country_code": "str", + "origin_locode": "str", + "origin_postal_code": "str", + "cargo_type": "str", + "container_size_code": "str", + "distance_m": "int", + "emissions_scope": "str", + "freight_mass_g": "int", + "fuel_type": "str", + "number_of_containers": "int", + "truck_weight_t": "int", + "project_id": "str", + "create_order": "bool", + } + + attribute_map = { + "destination_country_code": "destination_country_code", + "destination_locode": "destination_locode", + "destination_postal_code": "destination_postal_code", + "origin_country_code": "origin_country_code", + "origin_locode": "origin_locode", + "origin_postal_code": "origin_postal_code", + "cargo_type": "cargo_type", + "container_size_code": "container_size_code", + "distance_m": "distance_m", + "emissions_scope": "emissions_scope", + "freight_mass_g": "freight_mass_g", + "fuel_type": "fuel_type", + "number_of_containers": "number_of_containers", + "truck_weight_t": "truck_weight_t", + "project_id": "project_id", + "create_order": "create_order", + } + + def __init__( + self, + destination_country_code=None, + destination_locode=None, + destination_postal_code=None, + origin_country_code=None, + origin_locode=None, + origin_postal_code=None, + cargo_type="AVERAGE_MIXED", + container_size_code=None, + distance_m=None, + emissions_scope="wtw", + freight_mass_g=None, + fuel_type="DIESEL", + number_of_containers=None, + truck_weight_t=None, + project_id=None, + create_order=False, + local_vars_configuration=None, + ): # noqa: E501 + """CreateRoadShippingEstimateRequest - 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._destination_country_code = None + self._destination_locode = None + self._destination_postal_code = None + self._origin_country_code = None + self._origin_locode = None + self._origin_postal_code = None + self._cargo_type = None + self._container_size_code = None + self._distance_m = None + self._emissions_scope = None + self._freight_mass_g = None + self._fuel_type = None + self._number_of_containers = None + self._truck_weight_t = None + self._project_id = None + self._create_order = None + self.discriminator = None + + self.destination_country_code = destination_country_code + self.destination_locode = destination_locode + self.destination_postal_code = destination_postal_code + self.origin_country_code = origin_country_code + self.origin_locode = origin_locode + self.origin_postal_code = origin_postal_code + if cargo_type is not None: + self.cargo_type = cargo_type + if container_size_code is not None: + self.container_size_code = container_size_code + self.distance_m = distance_m + self.emissions_scope = emissions_scope + if freight_mass_g is not None: + self.freight_mass_g = freight_mass_g + self.fuel_type = fuel_type + self.number_of_containers = number_of_containers + self.truck_weight_t = truck_weight_t + self.project_id = project_id + self.create_order = create_order + + @property + def destination_country_code(self): + """Gets the destination_country_code of this CreateRoadShippingEstimateRequest. # noqa: E501 + + + :return: The destination_country_code of this CreateRoadShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._destination_country_code + + @destination_country_code.setter + def destination_country_code(self, destination_country_code): + """Sets the destination_country_code of this CreateRoadShippingEstimateRequest. + + + :param destination_country_code: The destination_country_code of this CreateRoadShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._destination_country_code = destination_country_code + + @property + def destination_locode(self): + """Gets the destination_locode of this CreateRoadShippingEstimateRequest. # noqa: E501 + + + :return: The destination_locode of this CreateRoadShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._destination_locode + + @destination_locode.setter + def destination_locode(self, destination_locode): + """Sets the destination_locode of this CreateRoadShippingEstimateRequest. + + + :param destination_locode: The destination_locode of this CreateRoadShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._destination_locode = destination_locode + + @property + def destination_postal_code(self): + """Gets the destination_postal_code of this CreateRoadShippingEstimateRequest. # noqa: E501 + + + :return: The destination_postal_code of this CreateRoadShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._destination_postal_code + + @destination_postal_code.setter + def destination_postal_code(self, destination_postal_code): + """Sets the destination_postal_code of this CreateRoadShippingEstimateRequest. + + + :param destination_postal_code: The destination_postal_code of this CreateRoadShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._destination_postal_code = destination_postal_code + + @property + def origin_country_code(self): + """Gets the origin_country_code of this CreateRoadShippingEstimateRequest. # noqa: E501 + + + :return: The origin_country_code of this CreateRoadShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._origin_country_code + + @origin_country_code.setter + def origin_country_code(self, origin_country_code): + """Sets the origin_country_code of this CreateRoadShippingEstimateRequest. + + + :param origin_country_code: The origin_country_code of this CreateRoadShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._origin_country_code = origin_country_code + + @property + def origin_locode(self): + """Gets the origin_locode of this CreateRoadShippingEstimateRequest. # noqa: E501 + + + :return: The origin_locode of this CreateRoadShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._origin_locode + + @origin_locode.setter + def origin_locode(self, origin_locode): + """Sets the origin_locode of this CreateRoadShippingEstimateRequest. + + + :param origin_locode: The origin_locode of this CreateRoadShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._origin_locode = origin_locode + + @property + def origin_postal_code(self): + """Gets the origin_postal_code of this CreateRoadShippingEstimateRequest. # noqa: E501 + + + :return: The origin_postal_code of this CreateRoadShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._origin_postal_code + + @origin_postal_code.setter + def origin_postal_code(self, origin_postal_code): + """Sets the origin_postal_code of this CreateRoadShippingEstimateRequest. + + + :param origin_postal_code: The origin_postal_code of this CreateRoadShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._origin_postal_code = origin_postal_code + + @property + def cargo_type(self): + """Gets the cargo_type of this CreateRoadShippingEstimateRequest. # noqa: E501 + + + :return: The cargo_type of this CreateRoadShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._cargo_type + + @cargo_type.setter + def cargo_type(self, cargo_type): + """Sets the cargo_type of this CreateRoadShippingEstimateRequest. + + + :param cargo_type: The cargo_type of this CreateRoadShippingEstimateRequest. # noqa: E501 + :type: str + """ + allowed_values = ["AVERAGE_MIXED", "CONTAINER"] # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and cargo_type not in allowed_values + ): # noqa: E501 + raise ValueError( + "Invalid value for `cargo_type` ({0}), must be one of {1}".format( # noqa: E501 + cargo_type, allowed_values + ) + ) + + self._cargo_type = cargo_type + + @property + def container_size_code(self): + """Gets the container_size_code of this CreateRoadShippingEstimateRequest. # noqa: E501 + + + :return: The container_size_code of this CreateRoadShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._container_size_code + + @container_size_code.setter + def container_size_code(self, container_size_code): + """Sets the container_size_code of this CreateRoadShippingEstimateRequest. + + + :param container_size_code: The container_size_code of this CreateRoadShippingEstimateRequest. # noqa: E501 + :type: str + """ + allowed_values = ["20GP", "40GP", "22G1", "42G1", "40HC", "45G1"] # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and container_size_code not in allowed_values + ): # noqa: E501 + raise ValueError( + "Invalid value for `container_size_code` ({0}), must be one of {1}".format( # noqa: E501 + container_size_code, allowed_values + ) + ) + + self._container_size_code = container_size_code + + @property + def distance_m(self): + """Gets the distance_m of this CreateRoadShippingEstimateRequest. # noqa: E501 + + + :return: The distance_m of this CreateRoadShippingEstimateRequest. # noqa: E501 + :rtype: int + """ + return self._distance_m + + @distance_m.setter + def distance_m(self, distance_m): + """Sets the distance_m of this CreateRoadShippingEstimateRequest. + + + :param distance_m: The distance_m of this CreateRoadShippingEstimateRequest. # 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 emissions_scope(self): + """Gets the emissions_scope of this CreateRoadShippingEstimateRequest. # noqa: E501 + + + :return: The emissions_scope of this CreateRoadShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._emissions_scope + + @emissions_scope.setter + def emissions_scope(self, emissions_scope): + """Sets the emissions_scope of this CreateRoadShippingEstimateRequest. + + + :param emissions_scope: The emissions_scope of this CreateRoadShippingEstimateRequest. # noqa: E501 + :type: str + """ + allowed_values = [None, "wtt", "ttw", "wtw"] # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and emissions_scope not in allowed_values + ): # noqa: E501 + raise ValueError( + "Invalid value for `emissions_scope` ({0}), must be one of {1}".format( # noqa: E501 + emissions_scope, allowed_values + ) + ) + + self._emissions_scope = emissions_scope + + @property + def freight_mass_g(self): + """Gets the freight_mass_g of this CreateRoadShippingEstimateRequest. # noqa: E501 + + + :return: The freight_mass_g of this CreateRoadShippingEstimateRequest. # noqa: E501 + :rtype: int + """ + return self._freight_mass_g + + @freight_mass_g.setter + def freight_mass_g(self, freight_mass_g): + """Sets the freight_mass_g of this CreateRoadShippingEstimateRequest. + + + :param freight_mass_g: The freight_mass_g of this CreateRoadShippingEstimateRequest. # noqa: E501 + :type: int + """ + if ( + self.local_vars_configuration.client_side_validation + and freight_mass_g is not None + and freight_mass_g > 2000000000 + ): # noqa: E501 + raise ValueError( + "Invalid value for `freight_mass_g`, must be a value less than or equal to `2000000000`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and freight_mass_g is not None + and freight_mass_g < 0 + ): # noqa: E501 + raise ValueError( + "Invalid value for `freight_mass_g`, must be a value greater than or equal to `0`" + ) # noqa: E501 + + self._freight_mass_g = freight_mass_g + + @property + def fuel_type(self): + """Gets the fuel_type of this CreateRoadShippingEstimateRequest. # noqa: E501 + + + :return: The fuel_type of this CreateRoadShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._fuel_type + + @fuel_type.setter + def fuel_type(self, fuel_type): + """Sets the fuel_type of this CreateRoadShippingEstimateRequest. + + + :param fuel_type: The fuel_type of this CreateRoadShippingEstimateRequest. # noqa: E501 + :type: str + """ + allowed_values = [None, "CNG", "DIESEL", "LNG", "PETROL"] # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and fuel_type not in allowed_values + ): # noqa: E501 + raise ValueError( + "Invalid value for `fuel_type` ({0}), must be one of {1}".format( # noqa: E501 + fuel_type, allowed_values + ) + ) + + self._fuel_type = fuel_type + + @property + def number_of_containers(self): + """Gets the number_of_containers of this CreateRoadShippingEstimateRequest. # noqa: E501 + + + :return: The number_of_containers of this CreateRoadShippingEstimateRequest. # noqa: E501 + :rtype: int + """ + return self._number_of_containers + + @number_of_containers.setter + def number_of_containers(self, number_of_containers): + """Sets the number_of_containers of this CreateRoadShippingEstimateRequest. + + + :param number_of_containers: The number_of_containers of this CreateRoadShippingEstimateRequest. # noqa: E501 + :type: int + """ + if ( + self.local_vars_configuration.client_side_validation + and number_of_containers is not None + and number_of_containers < 0 + ): # noqa: E501 + raise ValueError( + "Invalid value for `number_of_containers`, must be a value greater than or equal to `0`" + ) # noqa: E501 + + self._number_of_containers = number_of_containers + + @property + def truck_weight_t(self): + """Gets the truck_weight_t of this CreateRoadShippingEstimateRequest. # noqa: E501 + + + :return: The truck_weight_t of this CreateRoadShippingEstimateRequest. # noqa: E501 + :rtype: int + """ + return self._truck_weight_t + + @truck_weight_t.setter + def truck_weight_t(self, truck_weight_t): + """Sets the truck_weight_t of this CreateRoadShippingEstimateRequest. + + + :param truck_weight_t: The truck_weight_t of this CreateRoadShippingEstimateRequest. # noqa: E501 + :type: int + """ + if ( + self.local_vars_configuration.client_side_validation + and truck_weight_t is not None + and truck_weight_t > 60 + ): # noqa: E501 + raise ValueError( + "Invalid value for `truck_weight_t`, must be a value less than or equal to `60`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and truck_weight_t is not None + and truck_weight_t < 0 + ): # noqa: E501 + raise ValueError( + "Invalid value for `truck_weight_t`, must be a value greater than or equal to `0`" + ) # noqa: E501 + + self._truck_weight_t = truck_weight_t + + @property + def project_id(self): + """Gets the project_id of this CreateRoadShippingEstimateRequest. # noqa: E501 + + + :return: The project_id of this CreateRoadShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._project_id + + @project_id.setter + def project_id(self, project_id): + """Sets the project_id of this CreateRoadShippingEstimateRequest. + + + :param project_id: The project_id of this CreateRoadShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._project_id = project_id + + @property + def create_order(self): + """Gets the create_order of this CreateRoadShippingEstimateRequest. # noqa: E501 + + + :return: The create_order of this CreateRoadShippingEstimateRequest. # noqa: E501 + :rtype: bool + """ + return self._create_order + + @create_order.setter + def create_order(self, create_order): + """Sets the create_order of this CreateRoadShippingEstimateRequest. + + + :param create_order: The create_order of this CreateRoadShippingEstimateRequest. # 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, CreateRoadShippingEstimateRequest): + 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, CreateRoadShippingEstimateRequest): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/create_sea_shipping_estimate_request.py b/patch_api/models/create_sea_shipping_estimate_request.py new file mode 100644 index 0000000..81acd6a --- /dev/null +++ b/patch_api/models/create_sea_shipping_estimate_request.py @@ -0,0 +1,560 @@ +# coding: utf-8 + +""" + Patch API V1 + + The core API used to integrate with Patch's service # noqa: E501 + + The version of the OpenAPI document: v1 + 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 CreateSeaShippingEstimateRequest(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 = { + "destination_country_code": "str", + "destination_locode": "str", + "destination_postal_code": "str", + "origin_country_code": "str", + "origin_locode": "str", + "origin_postal_code": "str", + "container_size_code": "str", + "distance_m": "int", + "emissions_scope": "str", + "freight_mass_g": "int", + "freight_volume_cubic_m": "int", + "number_of_containers": "int", + "vessel_imo": "int", + "project_id": "str", + "create_order": "bool", + } + + attribute_map = { + "destination_country_code": "destination_country_code", + "destination_locode": "destination_locode", + "destination_postal_code": "destination_postal_code", + "origin_country_code": "origin_country_code", + "origin_locode": "origin_locode", + "origin_postal_code": "origin_postal_code", + "container_size_code": "container_size_code", + "distance_m": "distance_m", + "emissions_scope": "emissions_scope", + "freight_mass_g": "freight_mass_g", + "freight_volume_cubic_m": "freight_volume_cubic_m", + "number_of_containers": "number_of_containers", + "vessel_imo": "vessel_imo", + "project_id": "project_id", + "create_order": "create_order", + } + + def __init__( + self, + destination_country_code=None, + destination_locode=None, + destination_postal_code=None, + origin_country_code=None, + origin_locode=None, + origin_postal_code=None, + container_size_code=None, + distance_m=None, + emissions_scope="wtw", + freight_mass_g=None, + freight_volume_cubic_m=None, + number_of_containers=None, + vessel_imo=None, + project_id=None, + create_order=False, + local_vars_configuration=None, + ): # noqa: E501 + """CreateSeaShippingEstimateRequest - 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._destination_country_code = None + self._destination_locode = None + self._destination_postal_code = None + self._origin_country_code = None + self._origin_locode = None + self._origin_postal_code = None + self._container_size_code = None + self._distance_m = None + self._emissions_scope = None + self._freight_mass_g = None + self._freight_volume_cubic_m = None + self._number_of_containers = None + self._vessel_imo = None + self._project_id = None + self._create_order = None + self.discriminator = None + + self.destination_country_code = destination_country_code + self.destination_locode = destination_locode + self.destination_postal_code = destination_postal_code + self.origin_country_code = origin_country_code + self.origin_locode = origin_locode + self.origin_postal_code = origin_postal_code + if container_size_code is not None: + self.container_size_code = container_size_code + self.distance_m = distance_m + self.emissions_scope = emissions_scope + if freight_mass_g is not None: + self.freight_mass_g = freight_mass_g + self.freight_volume_cubic_m = freight_volume_cubic_m + self.number_of_containers = number_of_containers + self.vessel_imo = vessel_imo + self.project_id = project_id + self.create_order = create_order + + @property + def destination_country_code(self): + """Gets the destination_country_code of this CreateSeaShippingEstimateRequest. # noqa: E501 + + + :return: The destination_country_code of this CreateSeaShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._destination_country_code + + @destination_country_code.setter + def destination_country_code(self, destination_country_code): + """Sets the destination_country_code of this CreateSeaShippingEstimateRequest. + + + :param destination_country_code: The destination_country_code of this CreateSeaShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._destination_country_code = destination_country_code + + @property + def destination_locode(self): + """Gets the destination_locode of this CreateSeaShippingEstimateRequest. # noqa: E501 + + + :return: The destination_locode of this CreateSeaShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._destination_locode + + @destination_locode.setter + def destination_locode(self, destination_locode): + """Sets the destination_locode of this CreateSeaShippingEstimateRequest. + + + :param destination_locode: The destination_locode of this CreateSeaShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._destination_locode = destination_locode + + @property + def destination_postal_code(self): + """Gets the destination_postal_code of this CreateSeaShippingEstimateRequest. # noqa: E501 + + + :return: The destination_postal_code of this CreateSeaShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._destination_postal_code + + @destination_postal_code.setter + def destination_postal_code(self, destination_postal_code): + """Sets the destination_postal_code of this CreateSeaShippingEstimateRequest. + + + :param destination_postal_code: The destination_postal_code of this CreateSeaShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._destination_postal_code = destination_postal_code + + @property + def origin_country_code(self): + """Gets the origin_country_code of this CreateSeaShippingEstimateRequest. # noqa: E501 + + + :return: The origin_country_code of this CreateSeaShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._origin_country_code + + @origin_country_code.setter + def origin_country_code(self, origin_country_code): + """Sets the origin_country_code of this CreateSeaShippingEstimateRequest. + + + :param origin_country_code: The origin_country_code of this CreateSeaShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._origin_country_code = origin_country_code + + @property + def origin_locode(self): + """Gets the origin_locode of this CreateSeaShippingEstimateRequest. # noqa: E501 + + + :return: The origin_locode of this CreateSeaShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._origin_locode + + @origin_locode.setter + def origin_locode(self, origin_locode): + """Sets the origin_locode of this CreateSeaShippingEstimateRequest. + + + :param origin_locode: The origin_locode of this CreateSeaShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._origin_locode = origin_locode + + @property + def origin_postal_code(self): + """Gets the origin_postal_code of this CreateSeaShippingEstimateRequest. # noqa: E501 + + + :return: The origin_postal_code of this CreateSeaShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._origin_postal_code + + @origin_postal_code.setter + def origin_postal_code(self, origin_postal_code): + """Sets the origin_postal_code of this CreateSeaShippingEstimateRequest. + + + :param origin_postal_code: The origin_postal_code of this CreateSeaShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._origin_postal_code = origin_postal_code + + @property + def container_size_code(self): + """Gets the container_size_code of this CreateSeaShippingEstimateRequest. # noqa: E501 + + + :return: The container_size_code of this CreateSeaShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._container_size_code + + @container_size_code.setter + def container_size_code(self, container_size_code): + """Sets the container_size_code of this CreateSeaShippingEstimateRequest. + + + :param container_size_code: The container_size_code of this CreateSeaShippingEstimateRequest. # noqa: E501 + :type: str + """ + allowed_values = ["20GP", "40GP", "22G1", "42G1", "40HC", "45G1"] # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and container_size_code not in allowed_values + ): # noqa: E501 + raise ValueError( + "Invalid value for `container_size_code` ({0}), must be one of {1}".format( # noqa: E501 + container_size_code, allowed_values + ) + ) + + self._container_size_code = container_size_code + + @property + def distance_m(self): + """Gets the distance_m of this CreateSeaShippingEstimateRequest. # noqa: E501 + + + :return: The distance_m of this CreateSeaShippingEstimateRequest. # noqa: E501 + :rtype: int + """ + return self._distance_m + + @distance_m.setter + def distance_m(self, distance_m): + """Sets the distance_m of this CreateSeaShippingEstimateRequest. + + + :param distance_m: The distance_m of this CreateSeaShippingEstimateRequest. # 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 emissions_scope(self): + """Gets the emissions_scope of this CreateSeaShippingEstimateRequest. # noqa: E501 + + + :return: The emissions_scope of this CreateSeaShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._emissions_scope + + @emissions_scope.setter + def emissions_scope(self, emissions_scope): + """Sets the emissions_scope of this CreateSeaShippingEstimateRequest. + + + :param emissions_scope: The emissions_scope of this CreateSeaShippingEstimateRequest. # noqa: E501 + :type: str + """ + allowed_values = [None, "wtt", "ttw", "wtw"] # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and emissions_scope not in allowed_values + ): # noqa: E501 + raise ValueError( + "Invalid value for `emissions_scope` ({0}), must be one of {1}".format( # noqa: E501 + emissions_scope, allowed_values + ) + ) + + self._emissions_scope = emissions_scope + + @property + def freight_mass_g(self): + """Gets the freight_mass_g of this CreateSeaShippingEstimateRequest. # noqa: E501 + + + :return: The freight_mass_g of this CreateSeaShippingEstimateRequest. # noqa: E501 + :rtype: int + """ + return self._freight_mass_g + + @freight_mass_g.setter + def freight_mass_g(self, freight_mass_g): + """Sets the freight_mass_g of this CreateSeaShippingEstimateRequest. + + + :param freight_mass_g: The freight_mass_g of this CreateSeaShippingEstimateRequest. # noqa: E501 + :type: int + """ + if ( + self.local_vars_configuration.client_side_validation + and freight_mass_g is not None + and freight_mass_g > 2000000000 + ): # noqa: E501 + raise ValueError( + "Invalid value for `freight_mass_g`, must be a value less than or equal to `2000000000`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and freight_mass_g is not None + and freight_mass_g < 0 + ): # noqa: E501 + raise ValueError( + "Invalid value for `freight_mass_g`, must be a value greater than or equal to `0`" + ) # noqa: E501 + + self._freight_mass_g = freight_mass_g + + @property + def freight_volume_cubic_m(self): + """Gets the freight_volume_cubic_m of this CreateSeaShippingEstimateRequest. # noqa: E501 + + + :return: The freight_volume_cubic_m of this CreateSeaShippingEstimateRequest. # noqa: E501 + :rtype: int + """ + return self._freight_volume_cubic_m + + @freight_volume_cubic_m.setter + def freight_volume_cubic_m(self, freight_volume_cubic_m): + """Sets the freight_volume_cubic_m of this CreateSeaShippingEstimateRequest. + + + :param freight_volume_cubic_m: The freight_volume_cubic_m of this CreateSeaShippingEstimateRequest. # noqa: E501 + :type: int + """ + if ( + self.local_vars_configuration.client_side_validation + and freight_volume_cubic_m is not None + and freight_volume_cubic_m < 0 + ): # noqa: E501 + raise ValueError( + "Invalid value for `freight_volume_cubic_m`, must be a value greater than or equal to `0`" + ) # noqa: E501 + + self._freight_volume_cubic_m = freight_volume_cubic_m + + @property + def number_of_containers(self): + """Gets the number_of_containers of this CreateSeaShippingEstimateRequest. # noqa: E501 + + + :return: The number_of_containers of this CreateSeaShippingEstimateRequest. # noqa: E501 + :rtype: int + """ + return self._number_of_containers + + @number_of_containers.setter + def number_of_containers(self, number_of_containers): + """Sets the number_of_containers of this CreateSeaShippingEstimateRequest. + + + :param number_of_containers: The number_of_containers of this CreateSeaShippingEstimateRequest. # noqa: E501 + :type: int + """ + if ( + self.local_vars_configuration.client_side_validation + and number_of_containers is not None + and number_of_containers < 0 + ): # noqa: E501 + raise ValueError( + "Invalid value for `number_of_containers`, must be a value greater than or equal to `0`" + ) # noqa: E501 + + self._number_of_containers = number_of_containers + + @property + def vessel_imo(self): + """Gets the vessel_imo of this CreateSeaShippingEstimateRequest. # noqa: E501 + + + :return: The vessel_imo of this CreateSeaShippingEstimateRequest. # noqa: E501 + :rtype: int + """ + return self._vessel_imo + + @vessel_imo.setter + def vessel_imo(self, vessel_imo): + """Sets the vessel_imo of this CreateSeaShippingEstimateRequest. + + + :param vessel_imo: The vessel_imo of this CreateSeaShippingEstimateRequest. # noqa: E501 + :type: int + """ + + self._vessel_imo = vessel_imo + + @property + def project_id(self): + """Gets the project_id of this CreateSeaShippingEstimateRequest. # noqa: E501 + + + :return: The project_id of this CreateSeaShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._project_id + + @project_id.setter + def project_id(self, project_id): + """Sets the project_id of this CreateSeaShippingEstimateRequest. + + + :param project_id: The project_id of this CreateSeaShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._project_id = project_id + + @property + def create_order(self): + """Gets the create_order of this CreateSeaShippingEstimateRequest. # noqa: E501 + + + :return: The create_order of this CreateSeaShippingEstimateRequest. # noqa: E501 + :rtype: bool + """ + return self._create_order + + @create_order.setter + def create_order(self, create_order): + """Sets the create_order of this CreateSeaShippingEstimateRequest. + + + :param create_order: The create_order of this CreateSeaShippingEstimateRequest. # 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, CreateSeaShippingEstimateRequest): + 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, CreateSeaShippingEstimateRequest): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/order.py b/patch_api/models/order.py index 2ff246c..b3acd1c 100644 --- a/patch_api/models/order.py +++ b/patch_api/models/order.py @@ -298,6 +298,7 @@ def state(self, state): ) # noqa: E501 allowed_values = [ "draft", + "reserved", "placed", "processing", "complete", diff --git a/patch_api/models/project.py b/patch_api/models/project.py index 0efe9d3..1096b06 100644 --- a/patch_api/models/project.py +++ b/patch_api/models/project.py @@ -301,7 +301,7 @@ def type(self, type): def mechanism(self): """Gets the mechanism of this Project. # noqa: E501 - The mechanism of the project. Either removal or avoidance. # noqa: E501 + The mechanism of the project. One of: removal, avoidance, avoidance_and_removal. # noqa: E501 :return: The mechanism of this Project. # noqa: E501 :rtype: str @@ -312,7 +312,7 @@ def mechanism(self): def mechanism(self, mechanism): """Sets the mechanism of this Project. - The mechanism of the project. Either removal or avoidance. # noqa: E501 + The mechanism of the project. One of: removal, avoidance, avoidance_and_removal. # noqa: E501 :param mechanism: The mechanism of this Project. # noqa: E501 :type: str diff --git a/requirements.txt b/requirements.txt index 8164e7f..186bea6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,4 @@ six >= 1.10 python_dateutil >= 2.5.3 setuptools >= 21.0.0 urllib3 >= 1.15.1 -pre-commit >= 2.19.0 +pre-commit >= 2.10.0 diff --git a/setup.py b/setup.py index 7717870..c013449 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "patch-api" -VERSION = "1.23.0" +VERSION = "1.24.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 b18a0a1..d14eb4e 100644 --- a/test/test_estimates_api.py +++ b/test/test_estimates_api.py @@ -195,6 +195,250 @@ def test_create_hotel_estimate(self): estimate.data.mass_g, 15_000 ) # not setting an exact value since this is changing daily + def test_create_air_shipping_estimate_distance_m(self): + """Test case for create_air_shipping_estimate + + Create an estimate based on distance_m # noqa: E501 + """ + estimate = self.api.create_air_shipping_estimate( + distance_m=292_630, + freight_mass_g=24_091 + ) + self.assertEqual(estimate.data.type, "shipping") + self.assertGreater( + estimate.data.mass_g, 5_000 + ) # not setting an exact value since the mock values returned are randomized + + def test_create_air_shipping_estimate_airport_iatas(self): + """Test case for create_air_shipping_estimate + + Create an estimate based on airport iata values # noqa: E501 + """ + estimate = self.api.create_air_shipping_estimate( + destination_iata="JFK", + freight_mass_g=19_158, + origin_iata="ATL" + ) + self.assertEqual(estimate.data.order, None) + self.assertEqual(estimate.data.type, "shipping") + self.assertGreater( + estimate.data.mass_g, 10_000 + ) # not setting an exact value since the mock values returned are randomized + + def test_create_air_shipping_estimate_create_order(self): + """Test case for create_air_shipping_estimate + + Create an estimate and an order # noqa: E501 + """ + estimate = self.api.create_air_shipping_estimate( + create_order=True, + destination_iata="JFK", + freight_mass_g=18_092, + origin_iata="ATL" + ) + self.assertGreater(estimate.data.order.amount, 2_000) + self.assertEqual(estimate.data.type, "shipping") + self.assertGreater( + estimate.data.mass_g, 10_000 + ) # not setting an exact value since the mock values returned are randomized\ + + def test_create_rail_shipping_estimate_distance_m(self): + """Test case for create_rail_shipping_estimate + + Create an estimate based on distance_m # noqa: E501 + """ + estimate = self.api.create_rail_shipping_estimate( + distance_m=1_231_994, + freight_mass_g=23_845 + ) + self.assertEqual(estimate.data.order, None) + self.assertEqual(estimate.data.type, "shipping") + self.assertGreater( + estimate.data.mass_g, 400 + ) # not setting an exact value since the mock values returned are randomized + + def test_create_rail_shipping_estimate_addresses(self): + """Test case for create_rail_shipping_estimate + + Create an estimate based on locode values # noqa: E501 + """ + estimate = self.api.create_rail_shipping_estimate( + destination_country_code="US", + destination_postal_code="90210", + freight_mass_g=18092, + origin_country_code="US", + origin_postal_code="97209" + ) + self.assertEqual(estimate.data.order, None) + self.assertEqual(estimate.data.type, "shipping") + self.assertGreater( + estimate.data.mass_g, 300 + ) # not setting an exact value since the mock values returned are randomized + + def test_create_rail_shipping_estimate_locodes(self): + """Test case for create_rail_shipping_estimate + + Create an estimate based on locode values # noqa: E501 + """ + estimate = self.api.create_rail_shipping_estimate( + destination_locode="USSD2", + freight_mass_g=18092, + origin_locode="USSEA" + ) + self.assertEqual(estimate.data.order, None) + self.assertEqual(estimate.data.type, "shipping") + self.assertGreater( + estimate.data.mass_g, 800 + ) # not setting an exact value since the mock values returned are randomized + + def test_create_rail_shipping_estimate_create_order(self): + """Test case for create_rail_shipping_estimate + + Create an estimate and an order # noqa: E501 + """ + estimate = self.api.create_rail_shipping_estimate( + create_order=True, + destination_locode="USSD2", + freight_mass_g=19_217, + origin_locode="USSEA" + ) + self.assertGreater(estimate.data.order.amount, 900) + self.assertEqual(estimate.data.type, "shipping") + self.assertGreater( + estimate.data.mass_g, 800 + ) # not setting an exact value since the mock values returned are randomized + + def test_create_road_shipping_estimate_distance_m(self): + """Test case for create_road_shipping_estimate + + Create an estimate based on distance_m # noqa: E501 + """ + estimate = self.api.create_road_shipping_estimate( + distance_m=1_300_167, + freight_mass_g=20_738 + ) + self.assertEqual(estimate.data.order, None) + self.assertEqual(estimate.data.type, "shipping") + self.assertGreater( + estimate.data.mass_g, 400 + ) # not setting an exact value since the mock values returned are randomized + + def test_create_road_shipping_estimate_addresses(self): + """Test case for create_road_shipping_estimate + + Create an estimate based on locode values # noqa: E501 + """ + estimate = self.api.create_road_shipping_estimate( + destination_country_code="US", + destination_postal_code="90210", + freight_mass_g=19_166, + origin_country_code="US", + origin_postal_code="97209" + ) + self.assertEqual(estimate.data.order, None) + self.assertEqual(estimate.data.type, "shipping") + self.assertGreater( + estimate.data.mass_g, 600 + ) # not setting an exact value since the mock values returned are randomized + + def test_create_road_shipping_estimate_locodes(self): + """Test case for create_road_shipping_estimate + + Create an estimate based on locode values # noqa: E501 + """ + estimate = self.api.create_road_shipping_estimate( + destination_locode="USSD2", + freight_mass_g=16_907, + origin_locode="USSEA" + ) + self.assertEqual(estimate.data.order, None) + self.assertEqual(estimate.data.type, "shipping") + self.assertGreater( + estimate.data.mass_g, 1_000 + ) # not setting an exact value since the mock values returned are randomized + + def test_create_road_shipping_estimate_create_order(self): + """Test case for create_road_shipping_estimate + + Create an estimate and an order # noqa: E501 + """ + estimate = self.api.create_road_shipping_estimate( + create_order=True, + destination_locode="USSD2", + freight_mass_g=21_933, + origin_locode="USSEA" + ) + self.assertGreater(estimate.data.order.amount, 1_000) + self.assertEqual(estimate.data.type, "shipping") + self.assertGreater( + estimate.data.mass_g, 800 + ) # not setting an exact value since the mock values returned are randomized + + def test_create_sea_shipping_estimate_distance_m(self): + """Test case for create_sea_shipping_estimate + + Create an estimate based on distance_m # noqa: E501 + """ + estimate = self.api.create_sea_shipping_estimate( + distance_m=1_109_118, + freight_mass_g=20_197 + ) + self.assertEqual(estimate.data.order, None) + self.assertEqual(estimate.data.type, "shipping") + self.assertGreater( + estimate.data.mass_g, 400 + ) # not setting an exact value since the mock values returned are randomized + + def test_create_sea_shipping_estimate_addresses(self): + """Test case for create_sea_shipping_estimate + + Create an estimate based on address values # noqa: E501 + """ + estimate = self.api.create_sea_shipping_estimate( + destination_country_code="US", + destination_postal_code="90210", + freight_mass_g=26_906, + origin_country_code="US", + origin_postal_code="97209" + ) + self.assertEqual(estimate.data.order, None) + self.assertEqual(estimate.data.type, "shipping") + self.assertGreater( + estimate.data.mass_g, 600 + ) # not setting an exact value since the mock values returned are randomized + + def test_create_sea_shipping_estimate_locodes(self): + """Test case for create_sea_shipping_estimate + + Create an estimate based on locode values # noqa: E501 + """ + estimate = self.api.create_sea_shipping_estimate( + destination_locode="USSD2", + freight_mass_g=17_311, + origin_locode="USSEA" + ) + self.assertEqual(estimate.data.order, None) + self.assertEqual(estimate.data.type, "shipping") + self.assertGreater( + estimate.data.mass_g, 1_000 + ) # not setting an exact value since the mock values returned are randomized + + def test_create_sea_shipping_estimate_create_order(self): + """Test case for create_sea_shipping_estimate + + Create an estimate and an order # noqa: E501 + """ + estimate = self.api.create_sea_shipping_estimate( + create_order=True, + destination_locode="USSD2", + freight_mass_g=22_210, + origin_locode="USSEA" + ) + self.assertGreater(estimate.data.order.amount, 1_000) + self.assertEqual(estimate.data.type, "shipping") + self.assertGreater( + estimate.data.mass_g, 800 + ) # not setting an exact value since the mock values returned are randomized if __name__ == "__main__": unittest.main() From 62da99dac5c06ab1fbe8e6a758cb30805ea41f9f Mon Sep 17 00:00:00 2001 From: Brett Holt Date: Fri, 22 Jul 2022 14:47:57 -0700 Subject: [PATCH 2/6] Fix lint --- test/test_estimates_api.py | 43 ++++++++++++++------------------------ 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/test/test_estimates_api.py b/test/test_estimates_api.py index d14eb4e..fb17693 100644 --- a/test/test_estimates_api.py +++ b/test/test_estimates_api.py @@ -201,8 +201,7 @@ def test_create_air_shipping_estimate_distance_m(self): Create an estimate based on distance_m # noqa: E501 """ estimate = self.api.create_air_shipping_estimate( - distance_m=292_630, - freight_mass_g=24_091 + distance_m=292_630, freight_mass_g=24_091 ) self.assertEqual(estimate.data.type, "shipping") self.assertGreater( @@ -215,9 +214,7 @@ def test_create_air_shipping_estimate_airport_iatas(self): Create an estimate based on airport iata values # noqa: E501 """ estimate = self.api.create_air_shipping_estimate( - destination_iata="JFK", - freight_mass_g=19_158, - origin_iata="ATL" + destination_iata="JFK", freight_mass_g=19_158, origin_iata="ATL" ) self.assertEqual(estimate.data.order, None) self.assertEqual(estimate.data.type, "shipping") @@ -234,7 +231,7 @@ def test_create_air_shipping_estimate_create_order(self): create_order=True, destination_iata="JFK", freight_mass_g=18_092, - origin_iata="ATL" + origin_iata="ATL", ) self.assertGreater(estimate.data.order.amount, 2_000) self.assertEqual(estimate.data.type, "shipping") @@ -248,8 +245,7 @@ def test_create_rail_shipping_estimate_distance_m(self): Create an estimate based on distance_m # noqa: E501 """ estimate = self.api.create_rail_shipping_estimate( - distance_m=1_231_994, - freight_mass_g=23_845 + distance_m=1_231_994, freight_mass_g=23_845 ) self.assertEqual(estimate.data.order, None) self.assertEqual(estimate.data.type, "shipping") @@ -267,7 +263,7 @@ def test_create_rail_shipping_estimate_addresses(self): destination_postal_code="90210", freight_mass_g=18092, origin_country_code="US", - origin_postal_code="97209" + origin_postal_code="97209", ) self.assertEqual(estimate.data.order, None) self.assertEqual(estimate.data.type, "shipping") @@ -281,9 +277,7 @@ def test_create_rail_shipping_estimate_locodes(self): Create an estimate based on locode values # noqa: E501 """ estimate = self.api.create_rail_shipping_estimate( - destination_locode="USSD2", - freight_mass_g=18092, - origin_locode="USSEA" + destination_locode="USSD2", freight_mass_g=18092, origin_locode="USSEA" ) self.assertEqual(estimate.data.order, None) self.assertEqual(estimate.data.type, "shipping") @@ -300,7 +294,7 @@ def test_create_rail_shipping_estimate_create_order(self): create_order=True, destination_locode="USSD2", freight_mass_g=19_217, - origin_locode="USSEA" + origin_locode="USSEA", ) self.assertGreater(estimate.data.order.amount, 900) self.assertEqual(estimate.data.type, "shipping") @@ -314,8 +308,7 @@ def test_create_road_shipping_estimate_distance_m(self): Create an estimate based on distance_m # noqa: E501 """ estimate = self.api.create_road_shipping_estimate( - distance_m=1_300_167, - freight_mass_g=20_738 + distance_m=1_300_167, freight_mass_g=20_738 ) self.assertEqual(estimate.data.order, None) self.assertEqual(estimate.data.type, "shipping") @@ -333,7 +326,7 @@ def test_create_road_shipping_estimate_addresses(self): destination_postal_code="90210", freight_mass_g=19_166, origin_country_code="US", - origin_postal_code="97209" + origin_postal_code="97209", ) self.assertEqual(estimate.data.order, None) self.assertEqual(estimate.data.type, "shipping") @@ -347,9 +340,7 @@ def test_create_road_shipping_estimate_locodes(self): Create an estimate based on locode values # noqa: E501 """ estimate = self.api.create_road_shipping_estimate( - destination_locode="USSD2", - freight_mass_g=16_907, - origin_locode="USSEA" + destination_locode="USSD2", freight_mass_g=16_907, origin_locode="USSEA" ) self.assertEqual(estimate.data.order, None) self.assertEqual(estimate.data.type, "shipping") @@ -366,7 +357,7 @@ def test_create_road_shipping_estimate_create_order(self): create_order=True, destination_locode="USSD2", freight_mass_g=21_933, - origin_locode="USSEA" + origin_locode="USSEA", ) self.assertGreater(estimate.data.order.amount, 1_000) self.assertEqual(estimate.data.type, "shipping") @@ -380,8 +371,7 @@ def test_create_sea_shipping_estimate_distance_m(self): Create an estimate based on distance_m # noqa: E501 """ estimate = self.api.create_sea_shipping_estimate( - distance_m=1_109_118, - freight_mass_g=20_197 + distance_m=1_109_118, freight_mass_g=20_197 ) self.assertEqual(estimate.data.order, None) self.assertEqual(estimate.data.type, "shipping") @@ -399,7 +389,7 @@ def test_create_sea_shipping_estimate_addresses(self): destination_postal_code="90210", freight_mass_g=26_906, origin_country_code="US", - origin_postal_code="97209" + origin_postal_code="97209", ) self.assertEqual(estimate.data.order, None) self.assertEqual(estimate.data.type, "shipping") @@ -413,9 +403,7 @@ def test_create_sea_shipping_estimate_locodes(self): Create an estimate based on locode values # noqa: E501 """ estimate = self.api.create_sea_shipping_estimate( - destination_locode="USSD2", - freight_mass_g=17_311, - origin_locode="USSEA" + destination_locode="USSD2", freight_mass_g=17_311, origin_locode="USSEA" ) self.assertEqual(estimate.data.order, None) self.assertEqual(estimate.data.type, "shipping") @@ -432,7 +420,7 @@ def test_create_sea_shipping_estimate_create_order(self): create_order=True, destination_locode="USSD2", freight_mass_g=22_210, - origin_locode="USSEA" + origin_locode="USSEA", ) self.assertGreater(estimate.data.order.amount, 1_000) self.assertEqual(estimate.data.type, "shipping") @@ -440,5 +428,6 @@ def test_create_sea_shipping_estimate_create_order(self): estimate.data.mass_g, 800 ) # not setting an exact value since the mock values returned are randomized + if __name__ == "__main__": unittest.main() From 123287a2823a108f4ecef1c75dd7f441453ff654 Mon Sep 17 00:00:00 2001 From: Brett Holt Date: Fri, 22 Jul 2022 14:51:45 -0700 Subject: [PATCH 3/6] Update changelog for python syntax --- CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 143e6aa..07cae85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,10 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- Adds `Patch::Estimate.create_air_shipping_estimate` method -- Adds `Patch::Estimate.create_rail_shipping_estimate` method -- Adds `Patch::Estimate.create_road_shipping_estimate` method -- Adds `Patch::Estimate.create_sea_shipping_estimate` method +- Adds `patch.estimates.create_air_shipping_estimate` method +- Adds `patch.estimates.create_rail_shipping_estimate` method +- Adds `patch.estimates.create_road_shipping_estimate` method +- Adds `patch.estimates.create_sea_shipping_estimate` method ## [1.23.0] - 2022-06-03 From c7b16b802f0f92f613e49f236da68b84083db79d Mon Sep 17 00:00:00 2001 From: Brett Holt Date: Tue, 26 Jul 2022 15:18:10 -0700 Subject: [PATCH 4/6] Lowercase constant values, update air param variable names --- patch_api/api/estimates_api.py | 6 +- .../create_air_shipping_estimate_request.py | 88 +++++++++---------- .../create_rail_shipping_estimate_request.py | 2 +- .../create_road_shipping_estimate_request.py | 8 +- test/test_estimates_api.py | 36 ++++---- 5 files changed, 70 insertions(+), 70 deletions(-) diff --git a/patch_api/api/estimates_api.py b/patch_api/api/estimates_api.py index 069c4ef..fcd1e36 100644 --- a/patch_api/api/estimates_api.py +++ b/patch_api/api/estimates_api.py @@ -133,14 +133,14 @@ def create_air_shipping_estimate_with_http_info( all_params.append("_preload_content") all_params.append("_request_timeout") all_params.append("_return_http_data_only") - all_params.append("aircraft_iata") + all_params.append("aircraft_code") all_params.append("aircraft_type") all_params.append("create_order") - all_params.append("destination_iata") + all_params.append("destination_airport") all_params.append("distance_m") all_params.append("emissions_scope") all_params.append("freight_mass_g") - all_params.append("origin_iata") + all_params.append("origin_airport") all_params.append("project_id") for key, val in six.iteritems(local_var_params["kwargs"]): diff --git a/patch_api/models/create_air_shipping_estimate_request.py b/patch_api/models/create_air_shipping_estimate_request.py index c34aef7..ed460dd 100644 --- a/patch_api/models/create_air_shipping_estimate_request.py +++ b/patch_api/models/create_air_shipping_estimate_request.py @@ -34,9 +34,9 @@ class CreateAirShippingEstimateRequest(object): and the value is json key in definition. """ openapi_types = { - "destination_iata": "str", - "origin_iata": "str", - "aircraft_iata": "str", + "destination_airport": "str", + "origin_airport": "str", + "aircraft_code": "str", "aircraft_type": "str", "freight_mass_g": "int", "distance_m": "int", @@ -46,9 +46,9 @@ class CreateAirShippingEstimateRequest(object): } attribute_map = { - "destination_iata": "destination_iata", - "origin_iata": "origin_iata", - "aircraft_iata": "aircraft_iata", + "destination_airport": "destination_airport", + "origin_airport": "origin_airport", + "aircraft_code": "aircraft_code", "aircraft_type": "aircraft_type", "freight_mass_g": "freight_mass_g", "distance_m": "distance_m", @@ -59,10 +59,10 @@ class CreateAirShippingEstimateRequest(object): def __init__( self, - destination_iata=None, - origin_iata=None, - aircraft_iata=None, - aircraft_type="UNKNOWN", + destination_airport=None, + origin_airport=None, + aircraft_code=None, + aircraft_type="unknown", freight_mass_g=None, distance_m=None, emissions_scope="wtw", @@ -75,9 +75,9 @@ def __init__( local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration - self._destination_iata = None - self._origin_iata = None - self._aircraft_iata = None + self._destination_airport = None + self._origin_airport = None + self._aircraft_code = None self._aircraft_type = None self._freight_mass_g = None self._distance_m = None @@ -86,9 +86,9 @@ def __init__( self._create_order = None self.discriminator = None - self.destination_iata = destination_iata - self.origin_iata = origin_iata - self.aircraft_iata = aircraft_iata + self.destination_airport = destination_airport + self.origin_airport = origin_airport + self.aircraft_code = aircraft_code self.aircraft_type = aircraft_type if freight_mass_g is not None: self.freight_mass_g = freight_mass_g @@ -98,67 +98,67 @@ def __init__( self.create_order = create_order @property - def destination_iata(self): - """Gets the destination_iata of this CreateAirShippingEstimateRequest. # noqa: E501 + def destination_airport(self): + """Gets the destination_airport of this CreateAirShippingEstimateRequest. # noqa: E501 - :return: The destination_iata of this CreateAirShippingEstimateRequest. # noqa: E501 + :return: The destination_airport of this CreateAirShippingEstimateRequest. # noqa: E501 :rtype: str """ - return self._destination_iata + return self._destination_airport - @destination_iata.setter - def destination_iata(self, destination_iata): - """Sets the destination_iata of this CreateAirShippingEstimateRequest. + @destination_airport.setter + def destination_airport(self, destination_airport): + """Sets the destination_airport of this CreateAirShippingEstimateRequest. - :param destination_iata: The destination_iata of this CreateAirShippingEstimateRequest. # noqa: E501 + :param destination_airport: The destination_airport of this CreateAirShippingEstimateRequest. # noqa: E501 :type: str """ - self._destination_iata = destination_iata + self._destination_airport = destination_airport @property - def origin_iata(self): - """Gets the origin_iata of this CreateAirShippingEstimateRequest. # noqa: E501 + def origin_airport(self): + """Gets the origin_airport of this CreateAirShippingEstimateRequest. # noqa: E501 - :return: The origin_iata of this CreateAirShippingEstimateRequest. # noqa: E501 + :return: The origin_airport of this CreateAirShippingEstimateRequest. # noqa: E501 :rtype: str """ - return self._origin_iata + return self._origin_airport - @origin_iata.setter - def origin_iata(self, origin_iata): - """Sets the origin_iata of this CreateAirShippingEstimateRequest. + @origin_airport.setter + def origin_airport(self, origin_airport): + """Sets the origin_airport of this CreateAirShippingEstimateRequest. - :param origin_iata: The origin_iata of this CreateAirShippingEstimateRequest. # noqa: E501 + :param origin_airport: The origin_airport of this CreateAirShippingEstimateRequest. # noqa: E501 :type: str """ - self._origin_iata = origin_iata + self._origin_airport = origin_airport @property - def aircraft_iata(self): - """Gets the aircraft_iata of this CreateAirShippingEstimateRequest. # noqa: E501 + def aircraft_code(self): + """Gets the aircraft_code of this CreateAirShippingEstimateRequest. # noqa: E501 - :return: The aircraft_iata of this CreateAirShippingEstimateRequest. # noqa: E501 + :return: The aircraft_code of this CreateAirShippingEstimateRequest. # noqa: E501 :rtype: str """ - return self._aircraft_iata + return self._aircraft_code - @aircraft_iata.setter - def aircraft_iata(self, aircraft_iata): - """Sets the aircraft_iata of this CreateAirShippingEstimateRequest. + @aircraft_code.setter + def aircraft_code(self, aircraft_code): + """Sets the aircraft_code of this CreateAirShippingEstimateRequest. - :param aircraft_iata: The aircraft_iata of this CreateAirShippingEstimateRequest. # noqa: E501 + :param aircraft_code: The aircraft_code of this CreateAirShippingEstimateRequest. # noqa: E501 :type: str """ - self._aircraft_iata = aircraft_iata + self._aircraft_code = aircraft_code @property def aircraft_type(self): @@ -178,7 +178,7 @@ def aircraft_type(self, aircraft_type): :param aircraft_type: The aircraft_type of this CreateAirShippingEstimateRequest. # noqa: E501 :type: str """ - allowed_values = [None, "PASSENGER", "CARGO", "UNKNOWN"] # noqa: E501 + allowed_values = [None, "passenger", "cargo", "unknown"] # noqa: E501 if ( self.local_vars_configuration.client_side_validation and aircraft_type not in allowed_values diff --git a/patch_api/models/create_rail_shipping_estimate_request.py b/patch_api/models/create_rail_shipping_estimate_request.py index 9a135b2..8bdd0f4 100644 --- a/patch_api/models/create_rail_shipping_estimate_request.py +++ b/patch_api/models/create_rail_shipping_estimate_request.py @@ -256,7 +256,7 @@ def fuel_type(self, fuel_type): :param fuel_type: The fuel_type of this CreateRailShippingEstimateRequest. # noqa: E501 :type: str """ - allowed_values = [None, "DEFAULT", "DIESEL", "ELEC"] # noqa: E501 + allowed_values = [None, "default", "diesel", "elec"] # noqa: E501 if ( self.local_vars_configuration.client_side_validation and fuel_type not in allowed_values diff --git a/patch_api/models/create_road_shipping_estimate_request.py b/patch_api/models/create_road_shipping_estimate_request.py index fcf1564..85f4082 100644 --- a/patch_api/models/create_road_shipping_estimate_request.py +++ b/patch_api/models/create_road_shipping_estimate_request.py @@ -79,12 +79,12 @@ def __init__( origin_country_code=None, origin_locode=None, origin_postal_code=None, - cargo_type="AVERAGE_MIXED", + cargo_type="average_mixed", container_size_code=None, distance_m=None, emissions_scope="wtw", freight_mass_g=None, - fuel_type="DIESEL", + fuel_type="diesel", number_of_containers=None, truck_weight_t=None, project_id=None, @@ -278,7 +278,7 @@ def cargo_type(self, cargo_type): :param cargo_type: The cargo_type of this CreateRoadShippingEstimateRequest. # noqa: E501 :type: str """ - allowed_values = ["AVERAGE_MIXED", "CONTAINER"] # noqa: E501 + allowed_values = ["average_mixed", "container"] # noqa: E501 if ( self.local_vars_configuration.client_side_validation and cargo_type not in allowed_values @@ -445,7 +445,7 @@ def fuel_type(self, fuel_type): :param fuel_type: The fuel_type of this CreateRoadShippingEstimateRequest. # noqa: E501 :type: str """ - allowed_values = [None, "CNG", "DIESEL", "LNG", "PETROL"] # noqa: E501 + allowed_values = [None, "cng", "diesel", "lng", "petrol"] # noqa: E501 if ( self.local_vars_configuration.client_side_validation and fuel_type not in allowed_values diff --git a/test/test_estimates_api.py b/test/test_estimates_api.py index fb17693..8dd898d 100644 --- a/test/test_estimates_api.py +++ b/test/test_estimates_api.py @@ -203,7 +203,7 @@ def test_create_air_shipping_estimate_distance_m(self): estimate = self.api.create_air_shipping_estimate( distance_m=292_630, freight_mass_g=24_091 ) - self.assertEqual(estimate.data.type, "shipping") + self.assertEqual(estimate.data.type, "shipping_air") self.assertGreater( estimate.data.mass_g, 5_000 ) # not setting an exact value since the mock values returned are randomized @@ -214,10 +214,10 @@ def test_create_air_shipping_estimate_airport_iatas(self): Create an estimate based on airport iata values # noqa: E501 """ estimate = self.api.create_air_shipping_estimate( - destination_iata="JFK", freight_mass_g=19_158, origin_iata="ATL" + destination_airport="JFK", freight_mass_g=19_158, origin_airport="ATL" ) self.assertEqual(estimate.data.order, None) - self.assertEqual(estimate.data.type, "shipping") + self.assertEqual(estimate.data.type, "shipping_air") self.assertGreater( estimate.data.mass_g, 10_000 ) # not setting an exact value since the mock values returned are randomized @@ -229,12 +229,12 @@ def test_create_air_shipping_estimate_create_order(self): """ estimate = self.api.create_air_shipping_estimate( create_order=True, - destination_iata="JFK", + destination_airport="JFK", freight_mass_g=18_092, - origin_iata="ATL", + origin_airport="ATL", ) self.assertGreater(estimate.data.order.amount, 2_000) - self.assertEqual(estimate.data.type, "shipping") + self.assertEqual(estimate.data.type, "shipping_air") self.assertGreater( estimate.data.mass_g, 10_000 ) # not setting an exact value since the mock values returned are randomized\ @@ -248,7 +248,7 @@ def test_create_rail_shipping_estimate_distance_m(self): distance_m=1_231_994, freight_mass_g=23_845 ) self.assertEqual(estimate.data.order, None) - self.assertEqual(estimate.data.type, "shipping") + self.assertEqual(estimate.data.type, "shipping_rail") self.assertGreater( estimate.data.mass_g, 400 ) # not setting an exact value since the mock values returned are randomized @@ -266,7 +266,7 @@ def test_create_rail_shipping_estimate_addresses(self): origin_postal_code="97209", ) self.assertEqual(estimate.data.order, None) - self.assertEqual(estimate.data.type, "shipping") + self.assertEqual(estimate.data.type, "shipping_rail") self.assertGreater( estimate.data.mass_g, 300 ) # not setting an exact value since the mock values returned are randomized @@ -280,7 +280,7 @@ def test_create_rail_shipping_estimate_locodes(self): destination_locode="USSD2", freight_mass_g=18092, origin_locode="USSEA" ) self.assertEqual(estimate.data.order, None) - self.assertEqual(estimate.data.type, "shipping") + self.assertEqual(estimate.data.type, "shipping_rail") self.assertGreater( estimate.data.mass_g, 800 ) # not setting an exact value since the mock values returned are randomized @@ -297,7 +297,7 @@ def test_create_rail_shipping_estimate_create_order(self): origin_locode="USSEA", ) self.assertGreater(estimate.data.order.amount, 900) - self.assertEqual(estimate.data.type, "shipping") + self.assertEqual(estimate.data.type, "shipping_rail") self.assertGreater( estimate.data.mass_g, 800 ) # not setting an exact value since the mock values returned are randomized @@ -311,7 +311,7 @@ def test_create_road_shipping_estimate_distance_m(self): distance_m=1_300_167, freight_mass_g=20_738 ) self.assertEqual(estimate.data.order, None) - self.assertEqual(estimate.data.type, "shipping") + self.assertEqual(estimate.data.type, "shipping_road") self.assertGreater( estimate.data.mass_g, 400 ) # not setting an exact value since the mock values returned are randomized @@ -329,7 +329,7 @@ def test_create_road_shipping_estimate_addresses(self): origin_postal_code="97209", ) self.assertEqual(estimate.data.order, None) - self.assertEqual(estimate.data.type, "shipping") + self.assertEqual(estimate.data.type, "shipping_road") self.assertGreater( estimate.data.mass_g, 600 ) # not setting an exact value since the mock values returned are randomized @@ -343,7 +343,7 @@ def test_create_road_shipping_estimate_locodes(self): destination_locode="USSD2", freight_mass_g=16_907, origin_locode="USSEA" ) self.assertEqual(estimate.data.order, None) - self.assertEqual(estimate.data.type, "shipping") + self.assertEqual(estimate.data.type, "shipping_road") self.assertGreater( estimate.data.mass_g, 1_000 ) # not setting an exact value since the mock values returned are randomized @@ -360,7 +360,7 @@ def test_create_road_shipping_estimate_create_order(self): origin_locode="USSEA", ) self.assertGreater(estimate.data.order.amount, 1_000) - self.assertEqual(estimate.data.type, "shipping") + self.assertEqual(estimate.data.type, "shipping_road") self.assertGreater( estimate.data.mass_g, 800 ) # not setting an exact value since the mock values returned are randomized @@ -374,7 +374,7 @@ def test_create_sea_shipping_estimate_distance_m(self): distance_m=1_109_118, freight_mass_g=20_197 ) self.assertEqual(estimate.data.order, None) - self.assertEqual(estimate.data.type, "shipping") + self.assertEqual(estimate.data.type, "shipping_sea") self.assertGreater( estimate.data.mass_g, 400 ) # not setting an exact value since the mock values returned are randomized @@ -392,7 +392,7 @@ def test_create_sea_shipping_estimate_addresses(self): origin_postal_code="97209", ) self.assertEqual(estimate.data.order, None) - self.assertEqual(estimate.data.type, "shipping") + self.assertEqual(estimate.data.type, "shipping_sea") self.assertGreater( estimate.data.mass_g, 600 ) # not setting an exact value since the mock values returned are randomized @@ -406,7 +406,7 @@ def test_create_sea_shipping_estimate_locodes(self): destination_locode="USSD2", freight_mass_g=17_311, origin_locode="USSEA" ) self.assertEqual(estimate.data.order, None) - self.assertEqual(estimate.data.type, "shipping") + self.assertEqual(estimate.data.type, "shipping_sea") self.assertGreater( estimate.data.mass_g, 1_000 ) # not setting an exact value since the mock values returned are randomized @@ -423,7 +423,7 @@ def test_create_sea_shipping_estimate_create_order(self): origin_locode="USSEA", ) self.assertGreater(estimate.data.order.amount, 1_000) - self.assertEqual(estimate.data.type, "shipping") + self.assertEqual(estimate.data.type, "shipping_sea") self.assertGreater( estimate.data.mass_g, 800 ) # not setting an exact value since the mock values returned are randomized From a4b5c4a3d4ebcfb1247c6f3d8a8f08327a74104b Mon Sep 17 00:00:00 2001 From: Brett Holt Date: Wed, 27 Jul 2022 15:06:04 -0700 Subject: [PATCH 5/6] Remove distance_m --- patch_api/api/estimates_api.py | 172 ++++++++++++++---- patch_api/api/orders_api.py | 4 +- patch_api/api/projects_api.py | 4 +- patch_api/api/technology_types_api.py | 4 +- .../create_air_shipping_estimate_request.py | 42 ----- .../create_rail_shipping_estimate_request.py | 44 +---- .../create_road_shipping_estimate_request.py | 42 ----- .../create_sea_shipping_estimate_request.py | 42 ----- test/test_estimates_api.py | 55 ------ 9 files changed, 147 insertions(+), 262 deletions(-) diff --git a/patch_api/api/estimates_api.py b/patch_api/api/estimates_api.py index fcd1e36..71b5353 100644 --- a/patch_api/api/estimates_api.py +++ b/patch_api/api/estimates_api.py @@ -38,18 +38,22 @@ class EstimatesApi(object): "country_code", "create_order", "currency", - "destination_aiport", + "destination_airport", + "destination_country_code", + "destination_locode", + "destination_postal_code", "distance_m", - "emissions_scope", "freight_mass_g", "gas_used", - "issued_to", - "make", + "issued_to" "make", "mass_g", "model", "number_of_nights", "number_of_rooms", - "origin_aiport", + "origin_airport", + "origin_country_code", + "origin_locode", + "origin_postal_code", "package_mass_g", "page", "passenger_count", @@ -130,18 +134,45 @@ def create_air_shipping_estimate_with_http_info( local_var_params = locals() all_params = ["create_air_shipping_estimate_request"] # 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("_return_http_data_only") - all_params.append("aircraft_code") - all_params.append("aircraft_type") + all_params.append("mass_g") + all_params.append("total_price_cents_usd") + all_params.append("project_id") + all_params.append("metadata") + all_params.append("transportation_method") + all_params.append("package_mass_g") all_params.append("create_order") - all_params.append("destination_airport") - all_params.append("distance_m") - all_params.append("emissions_scope") - all_params.append("freight_mass_g") + 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("project_id") + 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") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -1156,18 +1187,46 @@ def create_rail_shipping_estimate_with_http_info( 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("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("destination_country_code") all_params.append("destination_locode") all_params.append("destination_postal_code") - all_params.append("distance_m") - all_params.append("emissions_scope") all_params.append("freight_mass_g") - all_params.append("fuel_type") all_params.append("origin_country_code") all_params.append("origin_locode") all_params.append("origin_postal_code") - all_params.append("project_id") + 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") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -1307,22 +1366,46 @@ def create_road_shipping_estimate_with_http_info( all_params.append("_return_http_data_only") all_params.append("_preload_content") all_params.append("_request_timeout") - all_params.append("cargo_type") - all_params.append("container_size_code") + all_params.append("mass_g") + all_params.append("total_price_cents_usd") + all_params.append("project_id") + all_params.append("metadata") + 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("destination_country_code") all_params.append("destination_locode") all_params.append("destination_postal_code") - all_params.append("distance_m") - all_params.append("emissions_scope") all_params.append("freight_mass_g") - 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("project_id") - all_params.append("truck_weight_t") + 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") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -1462,21 +1545,46 @@ def create_sea_shipping_estimate_with_http_info( all_params.append("_return_http_data_only") all_params.append("_preload_content") all_params.append("_request_timeout") - all_params.append("container_size_code") + all_params.append("mass_g") + all_params.append("total_price_cents_usd") + all_params.append("project_id") + all_params.append("metadata") + 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("destination_country_code") all_params.append("destination_locode") all_params.append("destination_postal_code") - all_params.append("distance_m") - all_params.append("emissions_scope") all_params.append("freight_mass_g") - all_params.append("freight_volume_cubic_m") - 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("project_id") - all_params.append("vessel_imo") + 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") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: diff --git a/patch_api/api/orders_api.py b/patch_api/api/orders_api.py index 4e793ca..9d6b1cd 100644 --- a/patch_api/api/orders_api.py +++ b/patch_api/api/orders_api.py @@ -46,8 +46,8 @@ class OrdersApi(object): "average_daily_balance_btc_sats", "average_daily_balance_eth_gwei", "timestamp", - "origin_aiport", - "destination_aiport", + "origin_airport", + "destination_airport", "aircraft_code", "cabin_class", "passenger_count", diff --git a/patch_api/api/projects_api.py b/patch_api/api/projects_api.py index 7b740e7..a2db1bf 100644 --- a/patch_api/api/projects_api.py +++ b/patch_api/api/projects_api.py @@ -46,8 +46,8 @@ class ProjectsApi(object): "average_daily_balance_btc_sats", "average_daily_balance_eth_gwei", "timestamp", - "origin_aiport", - "destination_aiport", + "origin_airport", + "destination_airport", "aircraft_code", "cabin_class", "passenger_count", diff --git a/patch_api/api/technology_types_api.py b/patch_api/api/technology_types_api.py index a688e41..2a18de8 100644 --- a/patch_api/api/technology_types_api.py +++ b/patch_api/api/technology_types_api.py @@ -46,8 +46,8 @@ class TechnologyTypesApi(object): "average_daily_balance_btc_sats", "average_daily_balance_eth_gwei", "timestamp", - "origin_aiport", - "destination_aiport", + "origin_airport", + "destination_airport", "aircraft_code", "cabin_class", "passenger_count", diff --git a/patch_api/models/create_air_shipping_estimate_request.py b/patch_api/models/create_air_shipping_estimate_request.py index ed460dd..a791288 100644 --- a/patch_api/models/create_air_shipping_estimate_request.py +++ b/patch_api/models/create_air_shipping_estimate_request.py @@ -39,7 +39,6 @@ class CreateAirShippingEstimateRequest(object): "aircraft_code": "str", "aircraft_type": "str", "freight_mass_g": "int", - "distance_m": "int", "emissions_scope": "str", "project_id": "str", "create_order": "bool", @@ -51,7 +50,6 @@ class CreateAirShippingEstimateRequest(object): "aircraft_code": "aircraft_code", "aircraft_type": "aircraft_type", "freight_mass_g": "freight_mass_g", - "distance_m": "distance_m", "emissions_scope": "emissions_scope", "project_id": "project_id", "create_order": "create_order", @@ -64,7 +62,6 @@ def __init__( aircraft_code=None, aircraft_type="unknown", freight_mass_g=None, - distance_m=None, emissions_scope="wtw", project_id=None, create_order=False, @@ -80,7 +77,6 @@ def __init__( self._aircraft_code = None self._aircraft_type = None self._freight_mass_g = None - self._distance_m = None self._emissions_scope = None self._project_id = None self._create_order = None @@ -92,7 +88,6 @@ def __init__( self.aircraft_type = aircraft_type if freight_mass_g is not None: self.freight_mass_g = freight_mass_g - self.distance_m = distance_m self.emissions_scope = emissions_scope self.project_id = project_id self.create_order = create_order @@ -228,43 +223,6 @@ def freight_mass_g(self, freight_mass_g): self._freight_mass_g = freight_mass_g - @property - def distance_m(self): - """Gets the distance_m of this CreateAirShippingEstimateRequest. # noqa: E501 - - - :return: The distance_m of this CreateAirShippingEstimateRequest. # noqa: E501 - :rtype: int - """ - return self._distance_m - - @distance_m.setter - def distance_m(self, distance_m): - """Sets the distance_m of this CreateAirShippingEstimateRequest. - - - :param distance_m: The distance_m of this CreateAirShippingEstimateRequest. # 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 emissions_scope(self): """Gets the emissions_scope of this CreateAirShippingEstimateRequest. # noqa: E501 diff --git a/patch_api/models/create_rail_shipping_estimate_request.py b/patch_api/models/create_rail_shipping_estimate_request.py index 8bdd0f4..3966b4b 100644 --- a/patch_api/models/create_rail_shipping_estimate_request.py +++ b/patch_api/models/create_rail_shipping_estimate_request.py @@ -42,7 +42,6 @@ class CreateRailShippingEstimateRequest(object): "origin_postal_code": "str", "fuel_type": "str", "freight_mass_g": "int", - "distance_m": "int", "emissions_scope": "str", "project_id": "str", "create_order": "bool", @@ -57,7 +56,6 @@ class CreateRailShippingEstimateRequest(object): "origin_postal_code": "origin_postal_code", "fuel_type": "fuel_type", "freight_mass_g": "freight_mass_g", - "distance_m": "distance_m", "emissions_scope": "emissions_scope", "project_id": "project_id", "create_order": "create_order", @@ -71,9 +69,8 @@ def __init__( origin_country_code=None, origin_locode=None, origin_postal_code=None, - fuel_type="DEFAULT", + fuel_type="default", freight_mass_g=None, - distance_m=None, emissions_scope="wtw", project_id=None, create_order=False, @@ -92,7 +89,6 @@ def __init__( self._origin_postal_code = None self._fuel_type = None self._freight_mass_g = None - self._distance_m = None self._emissions_scope = None self._project_id = None self._create_order = None @@ -107,7 +103,6 @@ def __init__( self.fuel_type = fuel_type if freight_mass_g is not None: self.freight_mass_g = freight_mass_g - self.distance_m = distance_m self.emissions_scope = emissions_scope self.project_id = project_id self.create_order = create_order @@ -306,43 +301,6 @@ def freight_mass_g(self, freight_mass_g): self._freight_mass_g = freight_mass_g - @property - def distance_m(self): - """Gets the distance_m of this CreateRailShippingEstimateRequest. # noqa: E501 - - - :return: The distance_m of this CreateRailShippingEstimateRequest. # noqa: E501 - :rtype: int - """ - return self._distance_m - - @distance_m.setter - def distance_m(self, distance_m): - """Sets the distance_m of this CreateRailShippingEstimateRequest. - - - :param distance_m: The distance_m of this CreateRailShippingEstimateRequest. # 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 emissions_scope(self): """Gets the emissions_scope of this CreateRailShippingEstimateRequest. # noqa: E501 diff --git a/patch_api/models/create_road_shipping_estimate_request.py b/patch_api/models/create_road_shipping_estimate_request.py index 85f4082..5133ba6 100644 --- a/patch_api/models/create_road_shipping_estimate_request.py +++ b/patch_api/models/create_road_shipping_estimate_request.py @@ -42,7 +42,6 @@ class CreateRoadShippingEstimateRequest(object): "origin_postal_code": "str", "cargo_type": "str", "container_size_code": "str", - "distance_m": "int", "emissions_scope": "str", "freight_mass_g": "int", "fuel_type": "str", @@ -61,7 +60,6 @@ class CreateRoadShippingEstimateRequest(object): "origin_postal_code": "origin_postal_code", "cargo_type": "cargo_type", "container_size_code": "container_size_code", - "distance_m": "distance_m", "emissions_scope": "emissions_scope", "freight_mass_g": "freight_mass_g", "fuel_type": "fuel_type", @@ -81,7 +79,6 @@ def __init__( origin_postal_code=None, cargo_type="average_mixed", container_size_code=None, - distance_m=None, emissions_scope="wtw", freight_mass_g=None, fuel_type="diesel", @@ -104,7 +101,6 @@ def __init__( self._origin_postal_code = None self._cargo_type = None self._container_size_code = None - self._distance_m = None self._emissions_scope = None self._freight_mass_g = None self._fuel_type = None @@ -124,7 +120,6 @@ def __init__( self.cargo_type = cargo_type if container_size_code is not None: self.container_size_code = container_size_code - self.distance_m = distance_m self.emissions_scope = emissions_scope if freight_mass_g is not None: self.freight_mass_g = freight_mass_g @@ -322,43 +317,6 @@ def container_size_code(self, container_size_code): self._container_size_code = container_size_code - @property - def distance_m(self): - """Gets the distance_m of this CreateRoadShippingEstimateRequest. # noqa: E501 - - - :return: The distance_m of this CreateRoadShippingEstimateRequest. # noqa: E501 - :rtype: int - """ - return self._distance_m - - @distance_m.setter - def distance_m(self, distance_m): - """Sets the distance_m of this CreateRoadShippingEstimateRequest. - - - :param distance_m: The distance_m of this CreateRoadShippingEstimateRequest. # 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 emissions_scope(self): """Gets the emissions_scope of this CreateRoadShippingEstimateRequest. # noqa: E501 diff --git a/patch_api/models/create_sea_shipping_estimate_request.py b/patch_api/models/create_sea_shipping_estimate_request.py index 81acd6a..fa99f77 100644 --- a/patch_api/models/create_sea_shipping_estimate_request.py +++ b/patch_api/models/create_sea_shipping_estimate_request.py @@ -41,7 +41,6 @@ class CreateSeaShippingEstimateRequest(object): "origin_locode": "str", "origin_postal_code": "str", "container_size_code": "str", - "distance_m": "int", "emissions_scope": "str", "freight_mass_g": "int", "freight_volume_cubic_m": "int", @@ -59,7 +58,6 @@ class CreateSeaShippingEstimateRequest(object): "origin_locode": "origin_locode", "origin_postal_code": "origin_postal_code", "container_size_code": "container_size_code", - "distance_m": "distance_m", "emissions_scope": "emissions_scope", "freight_mass_g": "freight_mass_g", "freight_volume_cubic_m": "freight_volume_cubic_m", @@ -78,7 +76,6 @@ def __init__( origin_locode=None, origin_postal_code=None, container_size_code=None, - distance_m=None, emissions_scope="wtw", freight_mass_g=None, freight_volume_cubic_m=None, @@ -100,7 +97,6 @@ def __init__( self._origin_locode = None self._origin_postal_code = None self._container_size_code = None - self._distance_m = None self._emissions_scope = None self._freight_mass_g = None self._freight_volume_cubic_m = None @@ -118,7 +114,6 @@ def __init__( self.origin_postal_code = origin_postal_code if container_size_code is not None: self.container_size_code = container_size_code - self.distance_m = distance_m self.emissions_scope = emissions_scope if freight_mass_g is not None: self.freight_mass_g = freight_mass_g @@ -285,43 +280,6 @@ def container_size_code(self, container_size_code): self._container_size_code = container_size_code - @property - def distance_m(self): - """Gets the distance_m of this CreateSeaShippingEstimateRequest. # noqa: E501 - - - :return: The distance_m of this CreateSeaShippingEstimateRequest. # noqa: E501 - :rtype: int - """ - return self._distance_m - - @distance_m.setter - def distance_m(self, distance_m): - """Sets the distance_m of this CreateSeaShippingEstimateRequest. - - - :param distance_m: The distance_m of this CreateSeaShippingEstimateRequest. # 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 emissions_scope(self): """Gets the emissions_scope of this CreateSeaShippingEstimateRequest. # noqa: E501 diff --git a/test/test_estimates_api.py b/test/test_estimates_api.py index 8dd898d..30eef80 100644 --- a/test/test_estimates_api.py +++ b/test/test_estimates_api.py @@ -195,19 +195,6 @@ def test_create_hotel_estimate(self): estimate.data.mass_g, 15_000 ) # not setting an exact value since this is changing daily - def test_create_air_shipping_estimate_distance_m(self): - """Test case for create_air_shipping_estimate - - Create an estimate based on distance_m # noqa: E501 - """ - estimate = self.api.create_air_shipping_estimate( - distance_m=292_630, freight_mass_g=24_091 - ) - self.assertEqual(estimate.data.type, "shipping_air") - self.assertGreater( - estimate.data.mass_g, 5_000 - ) # not setting an exact value since the mock values returned are randomized - def test_create_air_shipping_estimate_airport_iatas(self): """Test case for create_air_shipping_estimate @@ -237,20 +224,6 @@ def test_create_air_shipping_estimate_create_order(self): self.assertEqual(estimate.data.type, "shipping_air") self.assertGreater( estimate.data.mass_g, 10_000 - ) # not setting an exact value since the mock values returned are randomized\ - - def test_create_rail_shipping_estimate_distance_m(self): - """Test case for create_rail_shipping_estimate - - Create an estimate based on distance_m # noqa: E501 - """ - estimate = self.api.create_rail_shipping_estimate( - distance_m=1_231_994, freight_mass_g=23_845 - ) - self.assertEqual(estimate.data.order, None) - self.assertEqual(estimate.data.type, "shipping_rail") - self.assertGreater( - estimate.data.mass_g, 400 ) # not setting an exact value since the mock values returned are randomized def test_create_rail_shipping_estimate_addresses(self): @@ -302,20 +275,6 @@ def test_create_rail_shipping_estimate_create_order(self): estimate.data.mass_g, 800 ) # not setting an exact value since the mock values returned are randomized - def test_create_road_shipping_estimate_distance_m(self): - """Test case for create_road_shipping_estimate - - Create an estimate based on distance_m # noqa: E501 - """ - estimate = self.api.create_road_shipping_estimate( - distance_m=1_300_167, freight_mass_g=20_738 - ) - self.assertEqual(estimate.data.order, None) - self.assertEqual(estimate.data.type, "shipping_road") - self.assertGreater( - estimate.data.mass_g, 400 - ) # not setting an exact value since the mock values returned are randomized - def test_create_road_shipping_estimate_addresses(self): """Test case for create_road_shipping_estimate @@ -365,20 +324,6 @@ def test_create_road_shipping_estimate_create_order(self): estimate.data.mass_g, 800 ) # not setting an exact value since the mock values returned are randomized - def test_create_sea_shipping_estimate_distance_m(self): - """Test case for create_sea_shipping_estimate - - Create an estimate based on distance_m # noqa: E501 - """ - estimate = self.api.create_sea_shipping_estimate( - distance_m=1_109_118, freight_mass_g=20_197 - ) - self.assertEqual(estimate.data.order, None) - self.assertEqual(estimate.data.type, "shipping_sea") - self.assertGreater( - estimate.data.mass_g, 400 - ) # not setting an exact value since the mock values returned are randomized - def test_create_sea_shipping_estimate_addresses(self): """Test case for create_sea_shipping_estimate From b030871048adf3638b08f024c9efc30536c01ad8 Mon Sep 17 00:00:00 2001 From: Brett Holt Date: Wed, 27 Jul 2022 16:53:52 -0700 Subject: [PATCH 6/6] Not sure why freight_mass_g wasn't included --- patch_api/api/estimates_api.py | 1 + 1 file changed, 1 insertion(+) diff --git a/patch_api/api/estimates_api.py b/patch_api/api/estimates_api.py index 71b5353..63cd6ba 100644 --- a/patch_api/api/estimates_api.py +++ b/patch_api/api/estimates_api.py @@ -157,6 +157,7 @@ def create_air_shipping_estimate_with_http_info( all_params.append("timestamp") all_params.append("origin_airport") all_params.append("destination_airport") + all_params.append("freight_mass_g") all_params.append("aircraft_code") all_params.append("cabin_class") all_params.append("passenger_count")