Skip to content

1.20.0 - create order by vintage year #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.20.0] - 2022-04-18

### Added

- Adds optional `vintage_year` field to `order` creation

## [1.19.0] - 2022-04-11
### Added

Expand Down
2 changes: 1 addition & 1 deletion patch_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from __future__ import absolute_import

__version__ = "1.19.0"
__version__ = "1.20.0"

# import ApiClient
from patch_api.api_client import ApiClient
Expand Down
10 changes: 10 additions & 0 deletions patch_api/api/estimates_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class EstimatesApi(object):
"star_rating",
"number_of_nights",
"number_of_rooms",
"vintage_year",
]

def __init__(self, api_client=None):
Expand Down Expand Up @@ -156,6 +157,7 @@ def create_bitcoin_estimate_with_http_info(
all_params.append("star_rating")
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -325,6 +327,7 @@ def create_ethereum_estimate_with_http_info(
all_params.append("star_rating")
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -494,6 +497,7 @@ def create_flight_estimate_with_http_info(
all_params.append("star_rating")
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -663,6 +667,7 @@ def create_hotel_estimate_with_http_info(
all_params.append("star_rating")
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -832,6 +837,7 @@ def create_mass_estimate_with_http_info(
all_params.append("star_rating")
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -1001,6 +1007,7 @@ def create_shipping_estimate_with_http_info(
all_params.append("star_rating")
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -1170,6 +1177,7 @@ def create_vehicle_estimate_with_http_info(
all_params.append("star_rating")
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -1333,6 +1341,7 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("star_rating")
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -1486,6 +1495,7 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501
all_params.append("star_rating")
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down
6 changes: 6 additions & 0 deletions patch_api/api/orders_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class OrdersApi(object):
"star_rating",
"number_of_nights",
"number_of_rooms",
"vintage_year",
]

def __init__(self, api_client=None):
Expand Down Expand Up @@ -150,6 +151,7 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("star_rating")
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -305,6 +307,7 @@ def create_order_with_http_info(self, create_order_request, **kwargs): # noqa:
all_params.append("star_rating")
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -468,6 +471,7 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("star_rating")
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -621,6 +625,7 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("star_rating")
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -785,6 +790,7 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501
all_params.append("star_rating")
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down
3 changes: 3 additions & 0 deletions patch_api/api/projects_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class ProjectsApi(object):
"star_rating",
"number_of_nights",
"number_of_rooms",
"vintage_year",
]

def __init__(self, api_client=None):
Expand Down Expand Up @@ -150,6 +151,7 @@ def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("star_rating")
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -309,6 +311,7 @@ def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501
all_params.append("star_rating")
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down
2 changes: 2 additions & 0 deletions patch_api/api/technology_types_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class TechnologyTypesApi(object):
"star_rating",
"number_of_nights",
"number_of_rooms",
"vintage_year",
]

def __init__(self, api_client=None):
Expand Down Expand Up @@ -148,6 +149,7 @@ def retrieve_technology_types_with_http_info(self, **kwargs): # noqa: E501
all_params.append("star_rating")
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down
2 changes: 1 addition & 1 deletion patch_api/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.19.0"
self.user_agent = "patch-python/1.20.0"

def __del__(self):
if self._pool:
Expand Down
2 changes: 1 addition & 1 deletion patch_api/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.19.0".format(
"SDK Package Version: 1.20.0".format(
env=sys.platform, pyversion=sys.version
)
)
Expand Down
59 changes: 48 additions & 11 deletions patch_api/models/create_order_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class CreateOrderRequest(object):
"project_id": "str",
"metadata": "object",
"state": "str",
"vintage_year": "int",
}

attribute_map = {
Expand All @@ -47,6 +48,7 @@ class CreateOrderRequest(object):
"project_id": "project_id",
"metadata": "metadata",
"state": "state",
"vintage_year": "vintage_year",
}

def __init__(
Expand All @@ -56,6 +58,7 @@ def __init__(
project_id=None,
metadata=None,
state=None,
vintage_year=None,
local_vars_configuration=None,
): # noqa: E501
"""CreateOrderRequest - a model defined in OpenAPI""" # noqa: E501
Expand All @@ -68,18 +71,15 @@ def __init__(
self._project_id = None
self._metadata = None
self._state = None
self._vintage_year = None
self.discriminator = None

if mass_g is not None:
self.mass_g = mass_g
if total_price_cents_usd is not None:
self.total_price_cents_usd = total_price_cents_usd
if project_id is not None:
self.project_id = project_id
if metadata is not None:
self.metadata = metadata
if state is not None:
self.state = state
self.mass_g = mass_g
self.total_price_cents_usd = total_price_cents_usd
self.project_id = project_id
self.metadata = metadata
self.state = state
self.vintage_year = vintage_year

@property
def mass_g(self):
Expand Down Expand Up @@ -207,7 +207,7 @@ def state(self, state):
:param state: The state of this CreateOrderRequest. # noqa: E501
:type: str
"""
allowed_values = ["draft", "placed"] # noqa: E501
allowed_values = [None, "draft", "placed"] # noqa: E501
if (
self.local_vars_configuration.client_side_validation
and state not in allowed_values
Expand All @@ -220,6 +220,43 @@ def state(self, state):

self._state = state

@property
def vintage_year(self):
"""Gets the vintage_year of this CreateOrderRequest. # noqa: E501


:return: The vintage_year of this CreateOrderRequest. # noqa: E501
:rtype: int
"""
return self._vintage_year

@vintage_year.setter
def vintage_year(self, vintage_year):
"""Sets the vintage_year of this CreateOrderRequest.


:param vintage_year: The vintage_year of this CreateOrderRequest. # noqa: E501
:type: int
"""
if (
self.local_vars_configuration.client_side_validation
and vintage_year is not None
and vintage_year > 2100
): # noqa: E501
raise ValueError(
"Invalid value for `vintage_year`, must be a value less than or equal to `2100`"
) # noqa: E501
if (
self.local_vars_configuration.client_side_validation
and vintage_year is not None
and vintage_year < 1900
): # noqa: E501
raise ValueError(
"Invalid value for `vintage_year`, must be a value greater than or equal to `1900`"
) # noqa: E501

self._vintage_year = vintage_year

def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from setuptools import setup, find_packages # noqa: H301

NAME = "patch-api"
VERSION = "1.19.0"
VERSION = "1.20.0"
# To install the library, run the following
#
# python setup.py install
Expand Down
6 changes: 6 additions & 0 deletions test/test_orders_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ def test_cancel_order_in_draft_state(self):
cancelled_order = self.api.cancel_order(id=order.data.id)
self.assertEqual(cancelled_order.data.state, "cancelled")

def test_create_order_with_vintage_year(self):
"""Test case for vintage_year on create order"""
order = self.api.create_order(mass_g=100, vintage_year=2022)

self.assertTrue(order)


if __name__ == "__main__":
unittest.main()