diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 03d1321..e1f839e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,8 +5,14 @@ on: jobs: publish: + # 03/27/23: it looks like there are issues with the tarballs for all python 3.6 versions + # that are on ubuntu-22.04 (ubuntu-latest at the time). To maintain python compatibility + # we're pinning ubuntu-20.04 so that we can properly run install python 3.6. + # + # As soon as this issue is addressed, we should put the image back to ubuntu-latest: + # https://github.com/actions/setup-python/issues/544 name: Publish - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 env: TARGET_URL: https://pypi.org/project/patch-api/ steps: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4457110..d28808a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,13 @@ jobs: - uses: psf/black@stable build-and-test: - runs-on: ubuntu-latest + # 03/27/23: it looks like there are issues with the tarballs for all python 3.6 versions + # that are on ubuntu-22.04 (ubuntu-latest at the time). To maintain python compatibility + # we're pinning ubuntu-20.04 so that we can properly run install python 3.6. + # + # As soon as this issue is addressed, we should put the image back to ubuntu-latest: + # https://github.com/actions/setup-python/issues/544 + runs-on: ubuntu-20.04 name: Python Library tests steps: - name: Check out code @@ -24,6 +30,7 @@ jobs: uses: actions/setup-python@v2 with: python-version: '3.6' + - name: Run tests env: SANDBOX_API_KEY: ${{ secrets.SANDBOX_API_KEY }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 71a3d33..68e7278 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.1.0] - 2023-04-04 + +### Added + +- Adds optional `vintage_start_year` and `vintage_end_year` fields to `order` creation +- Adds optional `vintage_start_year` and `vintage_end_year` fields to `order_line_item` create and update +- Adds optional `vintage_start_year` and `vintage_end_year` fields to `inventory` creation +- Adds `vintage_start_year` and `vintage_end_year` fields to `order` response +- Adds `vintage_start_year` and `vintage_end_year` fields to `order_line_item` response +- Adds optional `carrier_scac` field to `patch.estimates.create_road_shipping_estimate` +- Deprecates `create_shipping_estimate` in favor of `create_ecommerce_estimate` + ## [1.24.2] - 2022-08-10 ### Added diff --git a/patch_api/__init__.py b/patch_api/__init__.py index b089014..f92471d 100644 --- a/patch_api/__init__.py +++ b/patch_api/__init__.py @@ -15,7 +15,7 @@ from __future__ import absolute_import -__version__ = "2.0.0" +__version__ = "2.1.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 5960204..04270eb 100644 --- a/patch_api/api/estimates_api.py +++ b/patch_api/api/estimates_api.py @@ -79,6 +79,8 @@ class EstimatesApi(object): "origin_postal_code", "truck_weight_t", "vessel_imo", + "vintage_start_year", + "vintage_end_year", ] def __init__(self, api_client=None): @@ -203,6 +205,8 @@ def create_air_shipping_estimate_with_http_info( all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -399,6 +403,8 @@ def create_bitcoin_estimate_with_http_info( all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -598,6 +604,8 @@ def create_ecommerce_estimate_with_http_info( all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -794,6 +802,8 @@ def create_ethereum_estimate_with_http_info( all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -990,6 +1000,8 @@ def create_flight_estimate_with_http_info( all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -1186,6 +1198,8 @@ def create_hotel_estimate_with_http_info( all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -1382,6 +1396,8 @@ def create_mass_estimate_with_http_info( all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -1581,6 +1597,8 @@ def create_rail_shipping_estimate_with_http_info( all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -1780,6 +1798,8 @@ def create_road_shipping_estimate_with_http_info( all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -1979,6 +1999,8 @@ def create_sea_shipping_estimate_with_http_info( all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -2175,6 +2197,8 @@ def create_shipping_estimate_with_http_info( all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -2371,6 +2395,8 @@ def create_vehicle_estimate_with_http_info( all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -2561,6 +2587,8 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501 all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -2741,6 +2769,8 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501 all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: diff --git a/patch_api/api/order_line_items_api.py b/patch_api/api/order_line_items_api.py index 158fe51..6b54928 100644 --- a/patch_api/api/order_line_items_api.py +++ b/patch_api/api/order_line_items_api.py @@ -79,6 +79,8 @@ class OrderLineItemsApi(object): "origin_postal_code", "truck_weight_t", "vessel_imo", + "vintage_start_year", + "vintage_end_year", ] def __init__(self, api_client=None): @@ -206,6 +208,8 @@ def create_order_line_item_with_http_info( all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -411,6 +415,8 @@ def delete_order_line_item_with_http_info( all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -618,6 +624,8 @@ def update_order_line_item_with_http_info( all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: diff --git a/patch_api/api/orders_api.py b/patch_api/api/orders_api.py index 77e3242..ef095aa 100644 --- a/patch_api/api/orders_api.py +++ b/patch_api/api/orders_api.py @@ -79,6 +79,8 @@ class OrdersApi(object): "origin_postal_code", "truck_weight_t", "vessel_imo", + "vintage_start_year", + "vintage_end_year", ] def __init__(self, api_client=None): @@ -194,6 +196,8 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501 all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -376,6 +380,8 @@ def create_order_with_http_info(self, create_order_request, **kwargs): # noqa: all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -566,6 +572,8 @@ def delete_order_with_http_info(self, uid, **kwargs): # noqa: E501 all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -748,6 +756,8 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501 all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -937,6 +947,8 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501 all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -1129,6 +1141,8 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501 all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: diff --git a/patch_api/api/projects_api.py b/patch_api/api/projects_api.py index 402e412..e1ea187 100644 --- a/patch_api/api/projects_api.py +++ b/patch_api/api/projects_api.py @@ -79,6 +79,8 @@ class ProjectsApi(object): "origin_postal_code", "truck_weight_t", "vessel_imo", + "vintage_start_year", + "vintage_end_year", ] def __init__(self, api_client=None): @@ -196,6 +198,8 @@ def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501 all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -395,6 +399,8 @@ def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501 all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: diff --git a/patch_api/api/technology_types_api.py b/patch_api/api/technology_types_api.py index 4e32b6a..73d1518 100644 --- a/patch_api/api/technology_types_api.py +++ b/patch_api/api/technology_types_api.py @@ -79,6 +79,8 @@ class TechnologyTypesApi(object): "origin_postal_code", "truck_weight_t", "vessel_imo", + "vintage_start_year", + "vintage_end_year", ] def __init__(self, api_client=None): @@ -192,6 +194,8 @@ def retrieve_technology_types_with_http_info(self, **kwargs): # noqa: E501 all_params.append("origin_postal_code") all_params.append("truck_weight_t") all_params.append("vessel_imo") + all_params.append("vintage_start_year") + all_params.append("vintage_end_year") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: diff --git a/patch_api/api_client.py b/patch_api/api_client.py index b308160..ed472c8 100644 --- a/patch_api/api_client.py +++ b/patch_api/api_client.py @@ -92,7 +92,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = "patch-python/2.0.0" + self.user_agent = "patch-python/2.1.0" # Set default Patch-Version self.patch_version = 2 @@ -163,7 +163,6 @@ def __call_api( _request_timeout=None, _host=None, ): - config = self.configuration # header parameters diff --git a/patch_api/configuration.py b/patch_api/configuration.py index 9d4f034..0021f03 100644 --- a/patch_api/configuration.py +++ b/patch_api/configuration.py @@ -341,7 +341,7 @@ def to_debug_report(self): "OS: {env}\n" "Python Version: {pyversion}\n" "Version of the API: 2\n" - "SDK Package Version: 2.0.0".format(env=sys.platform, pyversion=sys.version) + "SDK Package Version: 2.1.0".format(env=sys.platform, pyversion=sys.version) ) def get_host_settings(self): diff --git a/patch_api/models/create_mass_estimate_request.py b/patch_api/models/create_mass_estimate_request.py index 33267bd..39443be 100644 --- a/patch_api/models/create_mass_estimate_request.py +++ b/patch_api/models/create_mass_estimate_request.py @@ -90,10 +90,10 @@ def mass_g(self, mass_g): if ( self.local_vars_configuration.client_side_validation and mass_g is not None - and mass_g > 100000000000 + and mass_g > 100000000000000 ): # noqa: E501 raise ValueError( - "Invalid value for `mass_g`, must be a value less than or equal to `100000000000`" + "Invalid value for `mass_g`, must be a value less than or equal to `100000000000000`" ) # noqa: E501 if ( self.local_vars_configuration.client_side_validation diff --git a/patch_api/models/create_order_line_item_request.py b/patch_api/models/create_order_line_item_request.py index a80e799..0556b0a 100644 --- a/patch_api/models/create_order_line_item_request.py +++ b/patch_api/models/create_order_line_item_request.py @@ -36,6 +36,8 @@ class CreateOrderLineItemRequest(object): openapi_types = { "project_id": "str", "vintage_year": "int", + "vintage_start_year": "int", + "vintage_end_year": "int", "price": "int", "currency": "str", "amount": "int", @@ -45,6 +47,8 @@ class CreateOrderLineItemRequest(object): attribute_map = { "project_id": "project_id", "vintage_year": "vintage_year", + "vintage_start_year": "vintage_start_year", + "vintage_end_year": "vintage_end_year", "price": "price", "currency": "currency", "amount": "amount", @@ -55,6 +59,8 @@ def __init__( self, project_id=None, vintage_year=None, + vintage_start_year=None, + vintage_end_year=None, price=None, currency=None, amount=None, @@ -68,6 +74,8 @@ def __init__( self._project_id = None self._vintage_year = None + self._vintage_start_year = None + self._vintage_end_year = None self._price = None self._currency = None self._amount = None @@ -77,6 +85,8 @@ def __init__( if project_id is not None: self.project_id = project_id self.vintage_year = vintage_year + self.vintage_start_year = vintage_start_year + self.vintage_end_year = vintage_end_year self.price = price self.currency = currency self.amount = amount @@ -140,6 +150,80 @@ def vintage_year(self, vintage_year): self._vintage_year = vintage_year + @property + def vintage_start_year(self): + """Gets the vintage_start_year of this CreateOrderLineItemRequest. # noqa: E501 + + + :return: The vintage_start_year of this CreateOrderLineItemRequest. # noqa: E501 + :rtype: int + """ + return self._vintage_start_year + + @vintage_start_year.setter + def vintage_start_year(self, vintage_start_year): + """Sets the vintage_start_year of this CreateOrderLineItemRequest. + + + :param vintage_start_year: The vintage_start_year of this CreateOrderLineItemRequest. # noqa: E501 + :type: int + """ + if ( + self.local_vars_configuration.client_side_validation + and vintage_start_year is not None + and vintage_start_year > 2100 + ): # noqa: E501 + raise ValueError( + "Invalid value for `vintage_start_year`, must be a value less than or equal to `2100`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and vintage_start_year is not None + and vintage_start_year < 1900 + ): # noqa: E501 + raise ValueError( + "Invalid value for `vintage_start_year`, must be a value greater than or equal to `1900`" + ) # noqa: E501 + + self._vintage_start_year = vintage_start_year + + @property + def vintage_end_year(self): + """Gets the vintage_end_year of this CreateOrderLineItemRequest. # noqa: E501 + + + :return: The vintage_end_year of this CreateOrderLineItemRequest. # noqa: E501 + :rtype: int + """ + return self._vintage_end_year + + @vintage_end_year.setter + def vintage_end_year(self, vintage_end_year): + """Sets the vintage_end_year of this CreateOrderLineItemRequest. + + + :param vintage_end_year: The vintage_end_year of this CreateOrderLineItemRequest. # noqa: E501 + :type: int + """ + if ( + self.local_vars_configuration.client_side_validation + and vintage_end_year is not None + and vintage_end_year > 2100 + ): # noqa: E501 + raise ValueError( + "Invalid value for `vintage_end_year`, must be a value less than or equal to `2100`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and vintage_end_year is not None + and vintage_end_year < 1900 + ): # noqa: E501 + raise ValueError( + "Invalid value for `vintage_end_year`, must be a value greater than or equal to `1900`" + ) # noqa: E501 + + self._vintage_end_year = vintage_end_year + @property def price(self): """Gets the price of this CreateOrderLineItemRequest. # noqa: E501 @@ -211,10 +295,10 @@ def amount(self, amount): if ( self.local_vars_configuration.client_side_validation and amount is not None - and amount > 100000000000 + and amount > 100000000000000 ): # noqa: E501 raise ValueError( - "Invalid value for `amount`, must be a value less than or equal to `100000000000`" + "Invalid value for `amount`, must be a value less than or equal to `100000000000000`" ) # noqa: E501 if ( self.local_vars_configuration.client_side_validation diff --git a/patch_api/models/create_order_request.py b/patch_api/models/create_order_request.py index 1b385ee..735340c 100644 --- a/patch_api/models/create_order_request.py +++ b/patch_api/models/create_order_request.py @@ -38,6 +38,8 @@ class CreateOrderRequest(object): "metadata": "object", "state": "str", "vintage_year": "int", + "vintage_start_year": "int", + "vintage_end_year": "int", "total_price": "int", "currency": "str", "amount": "int", @@ -50,6 +52,8 @@ class CreateOrderRequest(object): "metadata": "metadata", "state": "state", "vintage_year": "vintage_year", + "vintage_start_year": "vintage_start_year", + "vintage_end_year": "vintage_end_year", "total_price": "total_price", "currency": "currency", "amount": "amount", @@ -63,6 +67,8 @@ def __init__( metadata=None, state=None, vintage_year=None, + vintage_start_year=None, + vintage_end_year=None, total_price=None, currency=None, amount=None, @@ -79,6 +85,8 @@ def __init__( self._metadata = None self._state = None self._vintage_year = None + self._vintage_start_year = None + self._vintage_end_year = None self._total_price = None self._currency = None self._amount = None @@ -90,6 +98,8 @@ def __init__( self.metadata = metadata self.state = state self.vintage_year = vintage_year + self.vintage_start_year = vintage_start_year + self.vintage_end_year = vintage_end_year self.total_price = total_price self.currency = currency self.amount = amount @@ -207,6 +217,80 @@ def vintage_year(self, vintage_year): self._vintage_year = vintage_year + @property + def vintage_start_year(self): + """Gets the vintage_start_year of this CreateOrderRequest. # noqa: E501 + + + :return: The vintage_start_year of this CreateOrderRequest. # noqa: E501 + :rtype: int + """ + return self._vintage_start_year + + @vintage_start_year.setter + def vintage_start_year(self, vintage_start_year): + """Sets the vintage_start_year of this CreateOrderRequest. + + + :param vintage_start_year: The vintage_start_year of this CreateOrderRequest. # noqa: E501 + :type: int + """ + if ( + self.local_vars_configuration.client_side_validation + and vintage_start_year is not None + and vintage_start_year > 2100 + ): # noqa: E501 + raise ValueError( + "Invalid value for `vintage_start_year`, must be a value less than or equal to `2100`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and vintage_start_year is not None + and vintage_start_year < 1900 + ): # noqa: E501 + raise ValueError( + "Invalid value for `vintage_start_year`, must be a value greater than or equal to `1900`" + ) # noqa: E501 + + self._vintage_start_year = vintage_start_year + + @property + def vintage_end_year(self): + """Gets the vintage_end_year of this CreateOrderRequest. # noqa: E501 + + + :return: The vintage_end_year of this CreateOrderRequest. # noqa: E501 + :rtype: int + """ + return self._vintage_end_year + + @vintage_end_year.setter + def vintage_end_year(self, vintage_end_year): + """Sets the vintage_end_year of this CreateOrderRequest. + + + :param vintage_end_year: The vintage_end_year of this CreateOrderRequest. # noqa: E501 + :type: int + """ + if ( + self.local_vars_configuration.client_side_validation + and vintage_end_year is not None + and vintage_end_year > 2100 + ): # noqa: E501 + raise ValueError( + "Invalid value for `vintage_end_year`, must be a value less than or equal to `2100`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and vintage_end_year is not None + and vintage_end_year < 1900 + ): # noqa: E501 + raise ValueError( + "Invalid value for `vintage_end_year`, must be a value greater than or equal to `1900`" + ) # noqa: E501 + + self._vintage_end_year = vintage_end_year + @property def total_price(self): """Gets the total_price of this CreateOrderRequest. # noqa: E501 @@ -278,10 +362,10 @@ def amount(self, amount): if ( self.local_vars_configuration.client_side_validation and amount is not None - and amount > 100000000000 + and amount > 100000000000000 ): # noqa: E501 raise ValueError( - "Invalid value for `amount`, must be a value less than or equal to `100000000000`" + "Invalid value for `amount`, must be a value less than or equal to `100000000000000`" ) # noqa: E501 if ( self.local_vars_configuration.client_side_validation diff --git a/patch_api/models/create_road_shipping_estimate_request.py b/patch_api/models/create_road_shipping_estimate_request.py index ed08036..1edbb73 100644 --- a/patch_api/models/create_road_shipping_estimate_request.py +++ b/patch_api/models/create_road_shipping_estimate_request.py @@ -47,6 +47,7 @@ class CreateRoadShippingEstimateRequest(object): "fuel_type": "str", "number_of_containers": "int", "truck_weight_t": "int", + "carrier_scac": "str", "project_id": "str", "create_order": "bool", } @@ -65,6 +66,7 @@ class CreateRoadShippingEstimateRequest(object): "fuel_type": "fuel_type", "number_of_containers": "number_of_containers", "truck_weight_t": "truck_weight_t", + "carrier_scac": "carrier_scac", "project_id": "project_id", "create_order": "create_order", } @@ -84,6 +86,7 @@ def __init__( fuel_type="diesel", number_of_containers=None, truck_weight_t=None, + carrier_scac=None, project_id=None, create_order=False, local_vars_configuration=None, @@ -106,6 +109,7 @@ def __init__( self._fuel_type = None self._number_of_containers = None self._truck_weight_t = None + self._carrier_scac = None self._project_id = None self._create_order = None self.discriminator = None @@ -126,6 +130,7 @@ def __init__( self.fuel_type = fuel_type self.number_of_containers = number_of_containers self.truck_weight_t = truck_weight_t + self.carrier_scac = carrier_scac self.project_id = project_id self.create_order = create_order @@ -482,6 +487,27 @@ def truck_weight_t(self, truck_weight_t): self._truck_weight_t = truck_weight_t + @property + def carrier_scac(self): + """Gets the carrier_scac of this CreateRoadShippingEstimateRequest. # noqa: E501 + + + :return: The carrier_scac of this CreateRoadShippingEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._carrier_scac + + @carrier_scac.setter + def carrier_scac(self, carrier_scac): + """Sets the carrier_scac of this CreateRoadShippingEstimateRequest. + + + :param carrier_scac: The carrier_scac of this CreateRoadShippingEstimateRequest. # noqa: E501 + :type: str + """ + + self._carrier_scac = carrier_scac + @property def project_id(self): """Gets the project_id of this CreateRoadShippingEstimateRequest. # noqa: E501 diff --git a/patch_api/models/inventory.py b/patch_api/models/inventory.py index 1674cca..d9b89be 100644 --- a/patch_api/models/inventory.py +++ b/patch_api/models/inventory.py @@ -35,6 +35,8 @@ class Inventory(object): """ openapi_types = { "vintage_year": "int", + "vintage_start_year": "int", + "vintage_end_year": "int", "amount_available": "int", "price": "int", "currency": "str", @@ -43,6 +45,8 @@ class Inventory(object): attribute_map = { "vintage_year": "vintage_year", + "vintage_start_year": "vintage_start_year", + "vintage_end_year": "vintage_end_year", "amount_available": "amount_available", "price": "price", "currency": "currency", @@ -52,6 +56,8 @@ class Inventory(object): def __init__( self, vintage_year=None, + vintage_start_year=None, + vintage_end_year=None, amount_available=None, price=None, currency=None, @@ -64,6 +70,8 @@ def __init__( self.local_vars_configuration = local_vars_configuration self._vintage_year = None + self._vintage_start_year = None + self._vintage_end_year = None self._amount_available = None self._price = None self._currency = None @@ -71,6 +79,8 @@ def __init__( self.discriminator = None self.vintage_year = vintage_year + self.vintage_start_year = vintage_start_year + self.vintage_end_year = vintage_end_year self.amount_available = amount_available self.price = price self.currency = currency @@ -106,6 +116,66 @@ def vintage_year(self, vintage_year): self._vintage_year = vintage_year + @property + def vintage_start_year(self): + """Gets the vintage_start_year of this Inventory. # noqa: E501 + + The starting year in which the climate impacts of the project occurred, or will occur. # noqa: E501 + + :return: The vintage_start_year of this Inventory. # noqa: E501 + :rtype: int + """ + return self._vintage_start_year + + @vintage_start_year.setter + def vintage_start_year(self, vintage_start_year): + """Sets the vintage_start_year of this Inventory. + + The starting year in which the climate impacts of the project occurred, or will occur. # noqa: E501 + + :param vintage_start_year: The vintage_start_year of this Inventory. # noqa: E501 + :type: int + """ + if ( + self.local_vars_configuration.client_side_validation + and vintage_start_year is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `vintage_start_year`, must not be `None`" + ) # noqa: E501 + + self._vintage_start_year = vintage_start_year + + @property + def vintage_end_year(self): + """Gets the vintage_end_year of this Inventory. # noqa: E501 + + The ending year in which the climate impacts of the project occurred, or will occur. # noqa: E501 + + :return: The vintage_end_year of this Inventory. # noqa: E501 + :rtype: int + """ + return self._vintage_end_year + + @vintage_end_year.setter + def vintage_end_year(self, vintage_end_year): + """Sets the vintage_end_year of this Inventory. + + The ending year in which the climate impacts of the project occurred, or will occur. # noqa: E501 + + :param vintage_end_year: The vintage_end_year of this Inventory. # noqa: E501 + :type: int + """ + if ( + self.local_vars_configuration.client_side_validation + and vintage_end_year is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `vintage_end_year`, must not be `None`" + ) # noqa: E501 + + self._vintage_end_year = vintage_end_year + @property def amount_available(self): """Gets the amount_available of this Inventory. # noqa: E501 diff --git a/patch_api/models/order.py b/patch_api/models/order.py index 24a88e4..e718a54 100644 --- a/patch_api/models/order.py +++ b/patch_api/models/order.py @@ -274,10 +274,10 @@ def amount(self, amount): if ( self.local_vars_configuration.client_side_validation and amount is not None - and amount > 100000000000 + and amount > 100000000000000 ): # noqa: E501 raise ValueError( - "Invalid value for `amount`, must be a value less than or equal to `100000000000`" + "Invalid value for `amount`, must be a value less than or equal to `100000000000000`" ) # noqa: E501 if ( self.local_vars_configuration.client_side_validation diff --git a/patch_api/models/order_line_item.py b/patch_api/models/order_line_item.py index 583830b..5e1d61f 100644 --- a/patch_api/models/order_line_item.py +++ b/patch_api/models/order_line_item.py @@ -37,6 +37,8 @@ class OrderLineItem(object): "id": "str", "project": "OrderLineItemProject", "vintage_year": "int", + "vintage_start_year": "int", + "vintage_end_year": "int", "amount": "int", "unit": "str", "price": "int", @@ -47,6 +49,8 @@ class OrderLineItem(object): "id": "id", "project": "project", "vintage_year": "vintage_year", + "vintage_start_year": "vintage_start_year", + "vintage_end_year": "vintage_end_year", "amount": "amount", "unit": "unit", "price": "price", @@ -58,6 +62,8 @@ def __init__( id=None, project=None, vintage_year=None, + vintage_start_year=None, + vintage_end_year=None, amount=None, unit=None, price=None, @@ -72,6 +78,8 @@ def __init__( self._id = None self._project = None self._vintage_year = None + self._vintage_start_year = None + self._vintage_end_year = None self._amount = None self._unit = None self._price = None @@ -82,6 +90,8 @@ def __init__( self.id = id self.project = project self.vintage_year = vintage_year + self.vintage_start_year = vintage_start_year + self.vintage_end_year = vintage_end_year self.amount = amount self.unit = unit self.price = price @@ -169,6 +179,66 @@ def vintage_year(self, vintage_year): self._vintage_year = vintage_year + @property + def vintage_start_year(self): + """Gets the vintage_start_year of this OrderLineItem. # noqa: E501 + + The starting_year in which the climate impacts of the project occurred, or will occur. # noqa: E501 + + :return: The vintage_start_year of this OrderLineItem. # noqa: E501 + :rtype: int + """ + return self._vintage_start_year + + @vintage_start_year.setter + def vintage_start_year(self, vintage_start_year): + """Sets the vintage_start_year of this OrderLineItem. + + The starting_year in which the climate impacts of the project occurred, or will occur. # noqa: E501 + + :param vintage_start_year: The vintage_start_year of this OrderLineItem. # noqa: E501 + :type: int + """ + if ( + self.local_vars_configuration.client_side_validation + and vintage_start_year is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `vintage_start_year`, must not be `None`" + ) # noqa: E501 + + self._vintage_start_year = vintage_start_year + + @property + def vintage_end_year(self): + """Gets the vintage_end_year of this OrderLineItem. # noqa: E501 + + The ending year in which the climate impacts of the project occurred, or will occur. # noqa: E501 + + :return: The vintage_end_year of this OrderLineItem. # noqa: E501 + :rtype: int + """ + return self._vintage_end_year + + @vintage_end_year.setter + def vintage_end_year(self, vintage_end_year): + """Sets the vintage_end_year of this OrderLineItem. + + The ending year in which the climate impacts of the project occurred, or will occur. # noqa: E501 + + :param vintage_end_year: The vintage_end_year of this OrderLineItem. # noqa: E501 + :type: int + """ + if ( + self.local_vars_configuration.client_side_validation + and vintage_end_year is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `vintage_end_year`, must not be `None`" + ) # noqa: E501 + + self._vintage_end_year = vintage_end_year + @property def amount(self): """Gets the amount of this OrderLineItem. # noqa: E501 diff --git a/patch_api/models/update_order_line_item_request.py b/patch_api/models/update_order_line_item_request.py index e0974c6..bae2261 100644 --- a/patch_api/models/update_order_line_item_request.py +++ b/patch_api/models/update_order_line_item_request.py @@ -35,6 +35,8 @@ class UpdateOrderLineItemRequest(object): """ openapi_types = { "vintage_year": "int", + "vintage_start_year": "int", + "vintage_end_year": "int", "price": "int", "currency": "str", "amount": "int", @@ -43,6 +45,8 @@ class UpdateOrderLineItemRequest(object): attribute_map = { "vintage_year": "vintage_year", + "vintage_start_year": "vintage_start_year", + "vintage_end_year": "vintage_end_year", "price": "price", "currency": "currency", "amount": "amount", @@ -52,6 +56,8 @@ class UpdateOrderLineItemRequest(object): def __init__( self, vintage_year=None, + vintage_start_year=None, + vintage_end_year=None, price=None, currency=None, amount=None, @@ -64,6 +70,8 @@ def __init__( self.local_vars_configuration = local_vars_configuration self._vintage_year = None + self._vintage_start_year = None + self._vintage_end_year = None self._price = None self._currency = None self._amount = None @@ -71,6 +79,8 @@ def __init__( self.discriminator = None self.vintage_year = vintage_year + self.vintage_start_year = vintage_start_year + self.vintage_end_year = vintage_end_year self.price = price self.currency = currency self.amount = amount @@ -113,6 +123,80 @@ def vintage_year(self, vintage_year): self._vintage_year = vintage_year + @property + def vintage_start_year(self): + """Gets the vintage_start_year of this UpdateOrderLineItemRequest. # noqa: E501 + + + :return: The vintage_start_year of this UpdateOrderLineItemRequest. # noqa: E501 + :rtype: int + """ + return self._vintage_start_year + + @vintage_start_year.setter + def vintage_start_year(self, vintage_start_year): + """Sets the vintage_start_year of this UpdateOrderLineItemRequest. + + + :param vintage_start_year: The vintage_start_year of this UpdateOrderLineItemRequest. # noqa: E501 + :type: int + """ + if ( + self.local_vars_configuration.client_side_validation + and vintage_start_year is not None + and vintage_start_year > 2100 + ): # noqa: E501 + raise ValueError( + "Invalid value for `vintage_start_year`, must be a value less than or equal to `2100`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and vintage_start_year is not None + and vintage_start_year < 1900 + ): # noqa: E501 + raise ValueError( + "Invalid value for `vintage_start_year`, must be a value greater than or equal to `1900`" + ) # noqa: E501 + + self._vintage_start_year = vintage_start_year + + @property + def vintage_end_year(self): + """Gets the vintage_end_year of this UpdateOrderLineItemRequest. # noqa: E501 + + + :return: The vintage_end_year of this UpdateOrderLineItemRequest. # noqa: E501 + :rtype: int + """ + return self._vintage_end_year + + @vintage_end_year.setter + def vintage_end_year(self, vintage_end_year): + """Sets the vintage_end_year of this UpdateOrderLineItemRequest. + + + :param vintage_end_year: The vintage_end_year of this UpdateOrderLineItemRequest. # noqa: E501 + :type: int + """ + if ( + self.local_vars_configuration.client_side_validation + and vintage_end_year is not None + and vintage_end_year > 2100 + ): # noqa: E501 + raise ValueError( + "Invalid value for `vintage_end_year`, must be a value less than or equal to `2100`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and vintage_end_year is not None + and vintage_end_year < 1900 + ): # noqa: E501 + raise ValueError( + "Invalid value for `vintage_end_year`, must be a value greater than or equal to `1900`" + ) # noqa: E501 + + self._vintage_end_year = vintage_end_year + @property def price(self): """Gets the price of this UpdateOrderLineItemRequest. # noqa: E501 @@ -184,10 +268,10 @@ def amount(self, amount): if ( self.local_vars_configuration.client_side_validation and amount is not None - and amount > 100000000000 + and amount > 100000000000000 ): # noqa: E501 raise ValueError( - "Invalid value for `amount`, must be a value less than or equal to `100000000000`" + "Invalid value for `amount`, must be a value less than or equal to `100000000000000`" ) # noqa: E501 if ( self.local_vars_configuration.client_side_validation diff --git a/setup.py b/setup.py index 5327caa..3dbfb72 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "patch-api" -VERSION = "2.0.0" +VERSION = "2.1.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 8c16d4d..7e13424 100644 --- a/test/test_estimates_api.py +++ b/test/test_estimates_api.py @@ -89,7 +89,7 @@ def test_create_and_retrieve_shipping_estimate(self): create_order=False, ) self.assertEqual(estimate.data.order, None) - self.assertEqual(estimate.data.type, "shipping") + self.assertEqual(estimate.data.type, "ecommerce") self.assertGreater(estimate.data.mass_g, 200) retrieved_estimate = self.api.retrieve_estimate(id=estimate.data.id) diff --git a/test/test_orders_api.py b/test/test_orders_api.py index 4886449..5d37264 100644 --- a/test/test_orders_api.py +++ b/test/test_orders_api.py @@ -119,6 +119,16 @@ def test_create_order_with_vintage_year(self): self.assertTrue(order) + def test_create_order_with_vintage_start_year_and_vintage_end_year(self): + """Test case for vintage_start_year and vintage_end_year on + create order + """ + order = self.api.create_order( + amount=100, unit="g", vintage_start_year=2023, vintage_end_year=2025 + ) + + self.assertTrue(order) + def test_create_order_with_amount_and_unit(self): """Test case for amount and unit on create order""" order = self.api.create_order(amount=100, unit="g") @@ -204,6 +214,46 @@ def test_create_empty_order_add_line_items(self): self.assertTrue(delete_line_item_response.success) self.assertEqual(delete_line_item_response.data, line_item_id) + # Add line item via vintage_start_year and vintage_end_year + create_order_line_item_response = self.line_items_api.create_order_line_item( + order_id=order_id, + create_order_line_item_request={ + "amount": 3000, + "unit": "g", + "project_id": project_id, + "vintage_start_year": 2023, + "vintage_end_year": 2025, + }, + ) + + self.assertTrue(create_order_line_item_response.success) + self.assertEqual(create_order_line_item_response.data.id, line_item_id) + self.assertEqual(create_order_line_item_response.data.amount, 3000) + self.assertEqual(create_order_line_item_response.data.vintage_start_year, 2023) + self.assertEqual(create_order_line_item_response.data.vintage_end_year, 2025) + self.assertGreater(create_order_line_item_response.data.price, 0) + + # Fetch order and check line item matches + line_item_id = create_line_item_response.data.id + retrieve_order_response = self.api.retrieve_order(id=order_id) + self.assertEqual(retrieve_order_response.data.id, order_id) + self.assertEqual(len(retrieve_order_response.data.line_items), 1) + self.assertEqual(retrieve_order_response.data.line_items[0].id, line_item_id) + self.assertEqual(retrieve_order_response.data.line_items[0].amount, 3000) + self.assertEqual( + retrieve_order_response.data.line_items[0].vintage_start_year, 2023 + ) + self.assertEqual( + retrieve_order_response.data.line_items[0].vintage_end_year, 2025 + ) + + # Delete line item + delete_line_item_response = self.line_items_api.delete_order_line_item( + order_id=order_id, serial_number=line_item_id + ) + self.assertTrue(delete_line_item_response.success) + self.assertEqual(delete_line_item_response.data, line_item_id) + # Fetch order and see it has no line items retrieve_order_response = self.api.retrieve_order(id=order_id) self.assertEqual(retrieve_order_response.data.id, order_id) diff --git a/test/test_projects_api.py b/test/test_projects_api.py index 46a102b..92e1c16 100644 --- a/test/test_projects_api.py +++ b/test/test_projects_api.py @@ -59,6 +59,8 @@ def test_retrieve_project(self): inventory = project.inventory self.assertTrue(isinstance(inventory, list)) self.assertTrue(isinstance(inventory[0].vintage_year, int)) + self.assertTrue(isinstance(inventory[0].vintage_start_year, int)) + self.assertTrue(isinstance(inventory[0].vintage_end_year, int)) self.assertTrue(isinstance(inventory[0].amount_available, int)) self.assertTrue(isinstance(inventory[0].price, int)) self.assertTrue(isinstance(inventory[0].currency, str))