Skip to content

Commit d560aa4

Browse files
author
Rahul Mody
authored
1.20.0 - create order by vintage year (#56)
1 parent 9fde2d3 commit d560aa4

11 files changed

+85
-15
lines changed

Diff for: CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.20.0] - 2022-04-18
9+
10+
### Added
11+
12+
- Adds optional `vintage_year` field to `order` creation
13+
814
## [1.19.0] - 2022-04-11
915
### Added
1016

Diff for: patch_api/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from __future__ import absolute_import
1717

18-
__version__ = "1.19.0"
18+
__version__ = "1.20.0"
1919

2020
# import ApiClient
2121
from patch_api.api_client import ApiClient

Diff for: patch_api/api/estimates_api.py

+10
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class EstimatesApi(object):
5858
"star_rating",
5959
"number_of_nights",
6060
"number_of_rooms",
61+
"vintage_year",
6162
]
6263

6364
def __init__(self, api_client=None):
@@ -156,6 +157,7 @@ def create_bitcoin_estimate_with_http_info(
156157
all_params.append("star_rating")
157158
all_params.append("number_of_nights")
158159
all_params.append("number_of_rooms")
160+
all_params.append("vintage_year")
159161

160162
for key, val in six.iteritems(local_var_params["kwargs"]):
161163
if key not in all_params:
@@ -325,6 +327,7 @@ def create_ethereum_estimate_with_http_info(
325327
all_params.append("star_rating")
326328
all_params.append("number_of_nights")
327329
all_params.append("number_of_rooms")
330+
all_params.append("vintage_year")
328331

329332
for key, val in six.iteritems(local_var_params["kwargs"]):
330333
if key not in all_params:
@@ -494,6 +497,7 @@ def create_flight_estimate_with_http_info(
494497
all_params.append("star_rating")
495498
all_params.append("number_of_nights")
496499
all_params.append("number_of_rooms")
500+
all_params.append("vintage_year")
497501

498502
for key, val in six.iteritems(local_var_params["kwargs"]):
499503
if key not in all_params:
@@ -663,6 +667,7 @@ def create_hotel_estimate_with_http_info(
663667
all_params.append("star_rating")
664668
all_params.append("number_of_nights")
665669
all_params.append("number_of_rooms")
670+
all_params.append("vintage_year")
666671

667672
for key, val in six.iteritems(local_var_params["kwargs"]):
668673
if key not in all_params:
@@ -832,6 +837,7 @@ def create_mass_estimate_with_http_info(
832837
all_params.append("star_rating")
833838
all_params.append("number_of_nights")
834839
all_params.append("number_of_rooms")
840+
all_params.append("vintage_year")
835841

836842
for key, val in six.iteritems(local_var_params["kwargs"]):
837843
if key not in all_params:
@@ -1001,6 +1007,7 @@ def create_shipping_estimate_with_http_info(
10011007
all_params.append("star_rating")
10021008
all_params.append("number_of_nights")
10031009
all_params.append("number_of_rooms")
1010+
all_params.append("vintage_year")
10041011

10051012
for key, val in six.iteritems(local_var_params["kwargs"]):
10061013
if key not in all_params:
@@ -1170,6 +1177,7 @@ def create_vehicle_estimate_with_http_info(
11701177
all_params.append("star_rating")
11711178
all_params.append("number_of_nights")
11721179
all_params.append("number_of_rooms")
1180+
all_params.append("vintage_year")
11731181

11741182
for key, val in six.iteritems(local_var_params["kwargs"]):
11751183
if key not in all_params:
@@ -1333,6 +1341,7 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501
13331341
all_params.append("star_rating")
13341342
all_params.append("number_of_nights")
13351343
all_params.append("number_of_rooms")
1344+
all_params.append("vintage_year")
13361345

13371346
for key, val in six.iteritems(local_var_params["kwargs"]):
13381347
if key not in all_params:
@@ -1486,6 +1495,7 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501
14861495
all_params.append("star_rating")
14871496
all_params.append("number_of_nights")
14881497
all_params.append("number_of_rooms")
1498+
all_params.append("vintage_year")
14891499

14901500
for key, val in six.iteritems(local_var_params["kwargs"]):
14911501
if key not in all_params:

Diff for: patch_api/api/orders_api.py

+6
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class OrdersApi(object):
5858
"star_rating",
5959
"number_of_nights",
6060
"number_of_rooms",
61+
"vintage_year",
6162
]
6263

6364
def __init__(self, api_client=None):
@@ -150,6 +151,7 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501
150151
all_params.append("star_rating")
151152
all_params.append("number_of_nights")
152153
all_params.append("number_of_rooms")
154+
all_params.append("vintage_year")
153155

154156
for key, val in six.iteritems(local_var_params["kwargs"]):
155157
if key not in all_params:
@@ -305,6 +307,7 @@ def create_order_with_http_info(self, create_order_request, **kwargs): # noqa:
305307
all_params.append("star_rating")
306308
all_params.append("number_of_nights")
307309
all_params.append("number_of_rooms")
310+
all_params.append("vintage_year")
308311

309312
for key, val in six.iteritems(local_var_params["kwargs"]):
310313
if key not in all_params:
@@ -468,6 +471,7 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501
468471
all_params.append("star_rating")
469472
all_params.append("number_of_nights")
470473
all_params.append("number_of_rooms")
474+
all_params.append("vintage_year")
471475

472476
for key, val in six.iteritems(local_var_params["kwargs"]):
473477
if key not in all_params:
@@ -621,6 +625,7 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501
621625
all_params.append("star_rating")
622626
all_params.append("number_of_nights")
623627
all_params.append("number_of_rooms")
628+
all_params.append("vintage_year")
624629

625630
for key, val in six.iteritems(local_var_params["kwargs"]):
626631
if key not in all_params:
@@ -785,6 +790,7 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501
785790
all_params.append("star_rating")
786791
all_params.append("number_of_nights")
787792
all_params.append("number_of_rooms")
793+
all_params.append("vintage_year")
788794

789795
for key, val in six.iteritems(local_var_params["kwargs"]):
790796
if key not in all_params:

Diff for: patch_api/api/projects_api.py

+3
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class ProjectsApi(object):
5858
"star_rating",
5959
"number_of_nights",
6060
"number_of_rooms",
61+
"vintage_year",
6162
]
6263

6364
def __init__(self, api_client=None):
@@ -150,6 +151,7 @@ def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501
150151
all_params.append("star_rating")
151152
all_params.append("number_of_nights")
152153
all_params.append("number_of_rooms")
154+
all_params.append("vintage_year")
153155

154156
for key, val in six.iteritems(local_var_params["kwargs"]):
155157
if key not in all_params:
@@ -309,6 +311,7 @@ def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501
309311
all_params.append("star_rating")
310312
all_params.append("number_of_nights")
311313
all_params.append("number_of_rooms")
314+
all_params.append("vintage_year")
312315

313316
for key, val in six.iteritems(local_var_params["kwargs"]):
314317
if key not in all_params:

Diff for: patch_api/api/technology_types_api.py

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class TechnologyTypesApi(object):
5858
"star_rating",
5959
"number_of_nights",
6060
"number_of_rooms",
61+
"vintage_year",
6162
]
6263

6364
def __init__(self, api_client=None):
@@ -148,6 +149,7 @@ def retrieve_technology_types_with_http_info(self, **kwargs): # noqa: E501
148149
all_params.append("star_rating")
149150
all_params.append("number_of_nights")
150151
all_params.append("number_of_rooms")
152+
all_params.append("vintage_year")
151153

152154
for key, val in six.iteritems(local_var_params["kwargs"]):
153155
if key not in all_params:

Diff for: patch_api/api_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __init__(
9191
self.default_headers[header_name] = header_value
9292
self.cookie = cookie
9393
# Set default User-Agent.
94-
self.user_agent = "patch-python/1.19.0"
94+
self.user_agent = "patch-python/1.20.0"
9595

9696
def __del__(self):
9797
if self._pool:

Diff for: patch_api/configuration.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def to_debug_report(self):
341341
"OS: {env}\n"
342342
"Python Version: {pyversion}\n"
343343
"Version of the API: v1\n"
344-
"SDK Package Version: 1.19.0".format(
344+
"SDK Package Version: 1.20.0".format(
345345
env=sys.platform, pyversion=sys.version
346346
)
347347
)

Diff for: patch_api/models/create_order_request.py

+48-11
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class CreateOrderRequest(object):
3939
"project_id": "str",
4040
"metadata": "object",
4141
"state": "str",
42+
"vintage_year": "int",
4243
}
4344

4445
attribute_map = {
@@ -47,6 +48,7 @@ class CreateOrderRequest(object):
4748
"project_id": "project_id",
4849
"metadata": "metadata",
4950
"state": "state",
51+
"vintage_year": "vintage_year",
5052
}
5153

5254
def __init__(
@@ -56,6 +58,7 @@ def __init__(
5658
project_id=None,
5759
metadata=None,
5860
state=None,
61+
vintage_year=None,
5962
local_vars_configuration=None,
6063
): # noqa: E501
6164
"""CreateOrderRequest - a model defined in OpenAPI""" # noqa: E501
@@ -68,18 +71,15 @@ def __init__(
6871
self._project_id = None
6972
self._metadata = None
7073
self._state = None
74+
self._vintage_year = None
7175
self.discriminator = None
7276

73-
if mass_g is not None:
74-
self.mass_g = mass_g
75-
if total_price_cents_usd is not None:
76-
self.total_price_cents_usd = total_price_cents_usd
77-
if project_id is not None:
78-
self.project_id = project_id
79-
if metadata is not None:
80-
self.metadata = metadata
81-
if state is not None:
82-
self.state = state
77+
self.mass_g = mass_g
78+
self.total_price_cents_usd = total_price_cents_usd
79+
self.project_id = project_id
80+
self.metadata = metadata
81+
self.state = state
82+
self.vintage_year = vintage_year
8383

8484
@property
8585
def mass_g(self):
@@ -207,7 +207,7 @@ def state(self, state):
207207
:param state: The state of this CreateOrderRequest. # noqa: E501
208208
:type: str
209209
"""
210-
allowed_values = ["draft", "placed"] # noqa: E501
210+
allowed_values = [None, "draft", "placed"] # noqa: E501
211211
if (
212212
self.local_vars_configuration.client_side_validation
213213
and state not in allowed_values
@@ -220,6 +220,43 @@ def state(self, state):
220220

221221
self._state = state
222222

223+
@property
224+
def vintage_year(self):
225+
"""Gets the vintage_year of this CreateOrderRequest. # noqa: E501
226+
227+
228+
:return: The vintage_year of this CreateOrderRequest. # noqa: E501
229+
:rtype: int
230+
"""
231+
return self._vintage_year
232+
233+
@vintage_year.setter
234+
def vintage_year(self, vintage_year):
235+
"""Sets the vintage_year of this CreateOrderRequest.
236+
237+
238+
:param vintage_year: The vintage_year of this CreateOrderRequest. # noqa: E501
239+
:type: int
240+
"""
241+
if (
242+
self.local_vars_configuration.client_side_validation
243+
and vintage_year is not None
244+
and vintage_year > 2100
245+
): # noqa: E501
246+
raise ValueError(
247+
"Invalid value for `vintage_year`, must be a value less than or equal to `2100`"
248+
) # noqa: E501
249+
if (
250+
self.local_vars_configuration.client_side_validation
251+
and vintage_year is not None
252+
and vintage_year < 1900
253+
): # noqa: E501
254+
raise ValueError(
255+
"Invalid value for `vintage_year`, must be a value greater than or equal to `1900`"
256+
) # noqa: E501
257+
258+
self._vintage_year = vintage_year
259+
223260
def to_dict(self):
224261
"""Returns the model properties as a dict"""
225262
result = {}

Diff for: setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from setuptools import setup, find_packages # noqa: H301
1313

1414
NAME = "patch-api"
15-
VERSION = "1.19.0"
15+
VERSION = "1.20.0"
1616
# To install the library, run the following
1717
#
1818
# python setup.py install

Diff for: test/test_orders_api.py

+6
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ def test_cancel_order_in_draft_state(self):
112112
cancelled_order = self.api.cancel_order(id=order.data.id)
113113
self.assertEqual(cancelled_order.data.state, "cancelled")
114114

115+
def test_create_order_with_vintage_year(self):
116+
"""Test case for vintage_year on create order"""
117+
order = self.api.create_order(mass_g=100, vintage_year=2022)
118+
119+
self.assertTrue(order)
120+
115121

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

0 commit comments

Comments
 (0)