diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d3575c..ced6e74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.23.0] - 2022-06-03 + +### Added + +- Adds support for the `issued_to` parameter on `orders`, to add support for creating and placing orders on behalf of another party. + ## [1.22.0] - 2022-05-16 ### Added diff --git a/README.md b/README.md index a5c35aa..3ca9e7e 100644 --- a/README.md +++ b/README.md @@ -82,9 +82,17 @@ project_id = 'pro_test_1234' # Pass in the project's ID patch.orders.create_order(project_id=project_id, amount=amount, unit=unit) ## Orders also accept a metadata field (optional) -metadata = {user: "john doe"} +metadata = {"user": "john doe"} patch.orders.create_order(metadata=metadata, amount=amount, unit=unit) +## Orders also accept a metadata field (optional) +metadata = {"user": "john doe"} +patch.orders.create_order(metadata=metadata, amount=amount, unit=unit) + +## Orders also accept an issued_to field (optional) +issued_to = {"name": "Company A", "email": "envimpact@companya.com"} +patch.orders.create_order(issued_to=issued_to, amount=amount, unit=unit) + # Retrieve an order order_id = 'ord_test_1234' # Pass in the order's id patch.orders.retrieve_order(id=order_id) @@ -93,6 +101,10 @@ patch.orders.retrieve_order(id=order_id) order_id = 'ord_test_1234' # Pass in the order's id patch.orders.place_order(id=order_id) +## Placing an order on behalf of another party +issued_to = {"name": "Company A", "email": "envimpact@companya.com"} +patch.orders.place_order(id=order_id, issued_to=issued_to) + # Cancel an order order_id = 'ord_test_1234' # Pass in the order's id patch.orders.cancel_order(id=order_id) diff --git a/patch_api/__init__.py b/patch_api/__init__.py index 074ef0f..ba0ee57 100644 --- a/patch_api/__init__.py +++ b/patch_api/__init__.py @@ -15,7 +15,7 @@ from __future__ import absolute_import -__version__ = "1.22.0" +__version__ = "1.23.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 056dfa8..f442ad4 100644 --- a/patch_api/api/estimates_api.py +++ b/patch_api/api/estimates_api.py @@ -63,6 +63,7 @@ class EstimatesApi(object): "currency", "amount", "unit", + "issued_to", ] def __init__(self, api_client=None): @@ -166,6 +167,7 @@ def create_bitcoin_estimate_with_http_info( 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: @@ -340,6 +342,7 @@ def create_ethereum_estimate_with_http_info( 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: @@ -514,6 +517,7 @@ def create_flight_estimate_with_http_info( 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: @@ -688,6 +692,7 @@ def create_hotel_estimate_with_http_info( 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: @@ -862,6 +867,7 @@ def create_mass_estimate_with_http_info( 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: @@ -1036,6 +1042,7 @@ def create_shipping_estimate_with_http_info( 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: @@ -1210,6 +1217,7 @@ def create_vehicle_estimate_with_http_info( 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: @@ -1378,6 +1386,7 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501 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: @@ -1536,6 +1545,7 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501 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 11de538..4e793ca 100644 --- a/patch_api/api/orders_api.py +++ b/patch_api/api/orders_api.py @@ -63,6 +63,7 @@ class OrdersApi(object): "currency", "amount", "unit", + "issued_to", ] def __init__(self, api_client=None): @@ -160,6 +161,7 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501 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: @@ -320,6 +322,7 @@ def create_order_with_http_info(self, create_order_request, **kwargs): # noqa: 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: @@ -407,6 +410,7 @@ def place_order(self, id={}, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) + :param PlaceOrderRequest place_order_request: :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -432,6 +436,7 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) + :param PlaceOrderRequest place_order_request: :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -448,7 +453,7 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ["id"] # noqa: E501 + all_params = ["id", "place_order_request"] # noqa: E501 all_params.append("async_req") all_params.append("_return_http_data_only") all_params.append("_preload_content") @@ -488,6 +493,7 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501 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: @@ -526,11 +532,20 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501 local_var_files = {} body_params = None + if "place_order_request" in local_var_params: + body_params = local_var_params["place_order_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 @@ -646,6 +661,7 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501 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: @@ -815,6 +831,7 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501 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/projects_api.py b/patch_api/api/projects_api.py index d9849ec..7b740e7 100644 --- a/patch_api/api/projects_api.py +++ b/patch_api/api/projects_api.py @@ -63,6 +63,7 @@ class ProjectsApi(object): "currency", "amount", "unit", + "issued_to", ] def __init__(self, api_client=None): @@ -162,6 +163,7 @@ def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501 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: @@ -338,6 +340,7 @@ def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501 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/technology_types_api.py b/patch_api/api/technology_types_api.py index c5a6c78..a688e41 100644 --- a/patch_api/api/technology_types_api.py +++ b/patch_api/api/technology_types_api.py @@ -63,6 +63,7 @@ class TechnologyTypesApi(object): "currency", "amount", "unit", + "issued_to", ] def __init__(self, api_client=None): @@ -158,6 +159,7 @@ def retrieve_technology_types_with_http_info(self, **kwargs): # noqa: E501 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_client.py b/patch_api/api_client.py index 6751106..2ab12c7 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.22.0" + self.user_agent = "patch-python/1.23.0" def __del__(self): if self._pool: diff --git a/patch_api/configuration.py b/patch_api/configuration.py index fb0e066..721ae6b 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.22.0".format( + "SDK Package Version: 1.23.0".format( env=sys.platform, pyversion=sys.version ) ) diff --git a/patch_api/models/__init__.py b/patch_api/models/__init__.py index f4b1c4f..2e5ade6 100644 --- a/patch_api/models/__init__.py +++ b/patch_api/models/__init__.py @@ -39,6 +39,7 @@ from patch_api.models.estimate_response import EstimateResponse from patch_api.models.highlight import Highlight from patch_api.models.inventory import Inventory +from patch_api.models.issued_to import IssuedTo from patch_api.models.meta_index_object import MetaIndexObject from patch_api.models.order import Order from patch_api.models.order_inventory import OrderInventory @@ -47,6 +48,7 @@ from patch_api.models.order_response import OrderResponse from patch_api.models.parent_technology_type import ParentTechnologyType from patch_api.models.photo import Photo +from patch_api.models.place_order_request import PlaceOrderRequest from patch_api.models.project import Project from patch_api.models.project_list_response import ProjectListResponse from patch_api.models.project_response import ProjectResponse @@ -54,3 +56,4 @@ from patch_api.models.standard import Standard from patch_api.models.technology_type import TechnologyType from patch_api.models.technology_type_list_response import TechnologyTypeListResponse +from patch_api.models.v1_orders_issued_to import V1OrdersIssuedTo diff --git a/patch_api/models/allocation.py b/patch_api/models/allocation.py index dbb5a26..e4916bb 100644 --- a/patch_api/models/allocation.py +++ b/patch_api/models/allocation.py @@ -85,7 +85,7 @@ def id(self, id): def production(self): """Gets the production of this Allocation. # noqa: E501 - A boolean indicating if this project is a production or test mode project. # noqa: E501 + A boolean indicating if this project is a production or demo mode project. # noqa: E501 :return: The production of this Allocation. # noqa: E501 :rtype: bool @@ -96,7 +96,7 @@ def production(self): def production(self, production): """Sets the production of this Allocation. - A boolean indicating if this project is a production or test mode project. # noqa: E501 + A boolean indicating if this project is a production or demo mode project. # noqa: E501 :param production: The production of this Allocation. # noqa: E501 :type: bool diff --git a/patch_api/models/create_order_request.py b/patch_api/models/create_order_request.py index 86e68ff..8e8b68b 100644 --- a/patch_api/models/create_order_request.py +++ b/patch_api/models/create_order_request.py @@ -44,6 +44,7 @@ class CreateOrderRequest(object): "currency": "str", "amount": "int", "unit": "str", + "issued_to": "V1OrdersIssuedTo", } attribute_map = { @@ -57,6 +58,7 @@ class CreateOrderRequest(object): "currency": "currency", "amount": "amount", "unit": "unit", + "issued_to": "issued_to", } def __init__( @@ -71,6 +73,7 @@ def __init__( currency=None, amount=None, unit=None, + issued_to=None, local_vars_configuration=None, ): # noqa: E501 """CreateOrderRequest - a model defined in OpenAPI""" # noqa: E501 @@ -88,6 +91,7 @@ def __init__( self._currency = None self._amount = None self._unit = None + self._issued_to = None self.discriminator = None self.mass_g = mass_g @@ -100,6 +104,7 @@ def __init__( self.currency = currency self.amount = amount self.unit = unit + self.issued_to = issued_to @property def mass_g(self): @@ -395,6 +400,27 @@ def unit(self, unit): self._unit = unit + @property + def issued_to(self): + """Gets the issued_to of this CreateOrderRequest. # noqa: E501 + + + :return: The issued_to of this CreateOrderRequest. # noqa: E501 + :rtype: V1OrdersIssuedTo + """ + return self._issued_to + + @issued_to.setter + def issued_to(self, issued_to): + """Sets the issued_to of this CreateOrderRequest. + + + :param issued_to: The issued_to of this CreateOrderRequest. # noqa: E501 + :type: V1OrdersIssuedTo + """ + + self._issued_to = issued_to + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/patch_api/models/estimate.py b/patch_api/models/estimate.py index 08ced62..4414091 100644 --- a/patch_api/models/estimate.py +++ b/patch_api/models/estimate.py @@ -108,7 +108,7 @@ def id(self, id): def production(self): """Gets the production of this Estimate. # noqa: E501 - A boolean indicating if this estimate is a production or test mode estimate. # noqa: E501 + A boolean indicating if this estimate is a production or demo mode estimate. # noqa: E501 :return: The production of this Estimate. # noqa: E501 :rtype: bool @@ -119,7 +119,7 @@ def production(self): def production(self, production): """Sets the production of this Estimate. - A boolean indicating if this estimate is a production or test mode estimate. # noqa: E501 + A boolean indicating if this estimate is a production or demo mode estimate. # noqa: E501 :param production: The production of this Estimate. # noqa: E501 :type: bool diff --git a/patch_api/models/issued_to.py b/patch_api/models/issued_to.py new file mode 100644 index 0000000..e338047 --- /dev/null +++ b/patch_api/models/issued_to.py @@ -0,0 +1,147 @@ +# 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 IssuedTo(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 = {"name": "str", "email": "str"} + + attribute_map = {"name": "name", "email": "email"} + + def __init__( + self, name=None, email=None, local_vars_configuration=None + ): # noqa: E501 + """IssuedTo - 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._name = None + self._email = None + self.discriminator = None + + self.name = name + self.email = email + + @property + def name(self): + """Gets the name of this IssuedTo. # noqa: E501 + + Name provided for the issuee # noqa: E501 + + :return: The name of this IssuedTo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this IssuedTo. + + Name provided for the issuee # noqa: E501 + + :param name: The name of this IssuedTo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def email(self): + """Gets the email of this IssuedTo. # noqa: E501 + + Email address provided for the issuee # noqa: E501 + + :return: The email of this IssuedTo. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this IssuedTo. + + Email address provided for the issuee # noqa: E501 + + :param email: The email of this IssuedTo. # noqa: E501 + :type: str + """ + + self._email = email + + 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, IssuedTo): + 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, IssuedTo): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/order.py b/patch_api/models/order.py index 6ed49ec..2ff246c 100644 --- a/patch_api/models/order.py +++ b/patch_api/models/order.py @@ -51,6 +51,7 @@ class Order(object): "registry_url": "str", "metadata": "object", "inventory": "list[OrderInventory]", + "issued_to": "IssuedTo", } attribute_map = { @@ -71,6 +72,7 @@ class Order(object): "registry_url": "registry_url", "metadata": "metadata", "inventory": "inventory", + "issued_to": "issued_to", } def __init__( @@ -92,6 +94,7 @@ def __init__( registry_url=None, metadata=None, inventory=None, + issued_to=None, local_vars_configuration=None, ): # noqa: E501 """Order - a model defined in OpenAPI""" # noqa: E501 @@ -116,6 +119,7 @@ def __init__( self._registry_url = None self._metadata = None self._inventory = None + self._issued_to = None self.discriminator = None self.id = id @@ -139,6 +143,8 @@ def __init__( self.metadata = metadata if inventory is not None: self.inventory = inventory + if issued_to is not None: + self.issued_to = issued_to @property def id(self): @@ -239,7 +245,7 @@ def mass_g(self, mass_g): def production(self): """Gets the production of this Order. # noqa: E501 - A boolean indicating if this order is a production or test mode order. # noqa: E501 + A boolean indicating if this order is a production or demo mode order. # noqa: E501 :return: The production of this Order. # noqa: E501 :rtype: bool @@ -250,7 +256,7 @@ def production(self): def production(self, production): """Sets the production of this Order. - A boolean indicating if this order is a production or test mode order. # noqa: E501 + A boolean indicating if this order is a production or demo mode order. # noqa: E501 :param production: The production of this Order. # noqa: E501 :type: bool @@ -654,6 +660,27 @@ def inventory(self, inventory): self._inventory = inventory + @property + def issued_to(self): + """Gets the issued_to of this Order. # noqa: E501 + + + :return: The issued_to of this Order. # noqa: E501 + :rtype: IssuedTo + """ + return self._issued_to + + @issued_to.setter + def issued_to(self, issued_to): + """Sets the issued_to of this Order. + + + :param issued_to: The issued_to of this Order. # noqa: E501 + :type: IssuedTo + """ + + self._issued_to = issued_to + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/patch_api/models/place_order_request.py b/patch_api/models/place_order_request.py new file mode 100644 index 0000000..1e220cd --- /dev/null +++ b/patch_api/models/place_order_request.py @@ -0,0 +1,118 @@ +# 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 PlaceOrderRequest(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 = {"issued_to": "V1OrdersIssuedTo"} + + attribute_map = {"issued_to": "issued_to"} + + def __init__(self, issued_to=None, local_vars_configuration=None): # noqa: E501 + """PlaceOrderRequest - 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._issued_to = None + self.discriminator = None + + self.issued_to = issued_to + + @property + def issued_to(self): + """Gets the issued_to of this PlaceOrderRequest. # noqa: E501 + + + :return: The issued_to of this PlaceOrderRequest. # noqa: E501 + :rtype: V1OrdersIssuedTo + """ + return self._issued_to + + @issued_to.setter + def issued_to(self, issued_to): + """Sets the issued_to of this PlaceOrderRequest. + + + :param issued_to: The issued_to of this PlaceOrderRequest. # noqa: E501 + :type: V1OrdersIssuedTo + """ + + self._issued_to = issued_to + + 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, PlaceOrderRequest): + 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, PlaceOrderRequest): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/project.py b/patch_api/models/project.py index 892a8c3..0efe9d3 100644 --- a/patch_api/models/project.py +++ b/patch_api/models/project.py @@ -191,7 +191,7 @@ def id(self, id): def production(self): """Gets the production of this Project. # noqa: E501 - A boolean indicating if this project is a production or test mode project. # noqa: E501 + A boolean indicating if this project is a production or demo mode project. # noqa: E501 :return: The production of this Project. # noqa: E501 :rtype: bool @@ -202,7 +202,7 @@ def production(self): def production(self, production): """Sets the production of this Project. - A boolean indicating if this project is a production or test mode project. # noqa: E501 + A boolean indicating if this project is a production or demo mode project. # noqa: E501 :param production: The production of this Project. # noqa: E501 :type: bool diff --git a/patch_api/models/v1_orders_issued_to.py b/patch_api/models/v1_orders_issued_to.py new file mode 100644 index 0000000..a17688c --- /dev/null +++ b/patch_api/models/v1_orders_issued_to.py @@ -0,0 +1,143 @@ +# 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 V1OrdersIssuedTo(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 = {"email": "str", "name": "str"} + + attribute_map = {"email": "email", "name": "name"} + + def __init__( + self, email=None, name=None, local_vars_configuration=None + ): # noqa: E501 + """V1OrdersIssuedTo - 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._email = None + self._name = None + self.discriminator = None + + self.email = email + self.name = name + + @property + def email(self): + """Gets the email of this V1OrdersIssuedTo. # noqa: E501 + + + :return: The email of this V1OrdersIssuedTo. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this V1OrdersIssuedTo. + + + :param email: The email of this V1OrdersIssuedTo. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def name(self): + """Gets the name of this V1OrdersIssuedTo. # noqa: E501 + + + :return: The name of this V1OrdersIssuedTo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this V1OrdersIssuedTo. + + + :param name: The name of this V1OrdersIssuedTo. # noqa: E501 + :type: str + """ + + self._name = name + + 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, V1OrdersIssuedTo): + 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, V1OrdersIssuedTo): + return True + + return self.to_dict() != other.to_dict() diff --git a/setup.py b/setup.py index 5352ee6..7717870 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "patch-api" -VERSION = "1.22.0" +VERSION = "1.23.0" # To install the library, run the following # # python setup.py install diff --git a/test/test_orders_api.py b/test/test_orders_api.py index 2e3ea7e..716aaf2 100644 --- a/test/test_orders_api.py +++ b/test/test_orders_api.py @@ -136,6 +136,25 @@ def test_create_order_with_total_price_and_currency(self): self.assertTrue(99 <= (order.data.price + order.data.patch_fee) <= 101) self.assertEqual(order.data.currency, "EUR") + def test_create_order_with_issued_to(self): + """Test case for issued_to on create order""" + mass_g = 100 + issued_to = {"email": "sustainability@companyb.com", "name": "Company B"} + order = self.api.create_order(mass_g=mass_g, issued_to=issued_to) + + self.assertTrue(order) + self.assertEqual(order.data.mass_g, 100) + self.assertEqual(order.data.issued_to.email, "sustainability@companyb.com") + self.assertEqual(order.data.issued_to.name, "Company B") + + retrieved_order = self.api.retrieve_order(id=order.data.id) + self.assertEqual(order.data.issued_to.email, "sustainability@companyb.com") + self.assertEqual(order.data.issued_to.name, "Company B") + self.assertEqual( + retrieved_order.data.issued_to.email, "sustainability@companyb.com" + ) + self.assertEqual(retrieved_order.data.issued_to.name, "Company B") + if __name__ == "__main__": unittest.main()