Skip to content

Commit

Permalink
1.18.0 (#53)
Browse files Browse the repository at this point in the history
* 1.18.0

* spec coverage for draft orders, add allowed parameter
  • Loading branch information
rmody3 authored Mar 22, 2022
1 parent 3c22332 commit fc56f3e
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ 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.18.0] - 2022-03-22
### Changed

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

## [1.17.0] - 2022-01-11

### Changed
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.17.1"
__version__ = "1.18.0"

# import ApiClient
from patch_api.api_client import ApiClient
Expand Down
9 changes: 9 additions & 0 deletions patch_api/api/estimates_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class EstimatesApi(object):
"aircraft_code",
"cabin_class",
"passenger_count",
"state",
]

def __init__(self, api_client=None):
Expand Down Expand Up @@ -142,6 +143,7 @@ def create_bitcoin_estimate_with_http_info(
all_params.append("aircraft_code")
all_params.append("cabin_class")
all_params.append("passenger_count")
all_params.append("state")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -304,6 +306,7 @@ def create_ethereum_estimate_with_http_info(
all_params.append("aircraft_code")
all_params.append("cabin_class")
all_params.append("passenger_count")
all_params.append("state")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -466,6 +469,7 @@ def create_flight_estimate_with_http_info(
all_params.append("aircraft_code")
all_params.append("cabin_class")
all_params.append("passenger_count")
all_params.append("state")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -628,6 +632,7 @@ def create_mass_estimate_with_http_info(
all_params.append("aircraft_code")
all_params.append("cabin_class")
all_params.append("passenger_count")
all_params.append("state")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -790,6 +795,7 @@ def create_shipping_estimate_with_http_info(
all_params.append("aircraft_code")
all_params.append("cabin_class")
all_params.append("passenger_count")
all_params.append("state")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -952,6 +958,7 @@ def create_vehicle_estimate_with_http_info(
all_params.append("aircraft_code")
all_params.append("cabin_class")
all_params.append("passenger_count")
all_params.append("state")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -1108,6 +1115,7 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("aircraft_code")
all_params.append("cabin_class")
all_params.append("passenger_count")
all_params.append("state")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -1254,6 +1262,7 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501
all_params.append("aircraft_code")
all_params.append("cabin_class")
all_params.append("passenger_count")
all_params.append("state")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down
10 changes: 8 additions & 2 deletions patch_api/api/orders_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class OrdersApi(object):
"aircraft_code",
"cabin_class",
"passenger_count",
"state",
]

def __init__(self, api_client=None):
Expand Down Expand Up @@ -136,6 +137,7 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("aircraft_code")
all_params.append("cabin_class")
all_params.append("passenger_count")
all_params.append("state")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -205,7 +207,7 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501
def create_order(self, create_order_request={}, **kwargs): # noqa: E501
"""Creates an order # noqa: E501
Creates an order in the `placed` state. To create a `draft` order, create an estimate first. # noqa: E501
Creates an order in the `placed` or `draft` state. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_order(create_order_request, async_req=True)
Expand All @@ -232,7 +234,7 @@ def create_order(self, create_order_request={}, **kwargs): # noqa: E501
def create_order_with_http_info(self, create_order_request, **kwargs): # noqa: E501
"""Creates an order # noqa: E501
Creates an order in the `placed` state. To create a `draft` order, create an estimate first. # noqa: E501
Creates an order in the `placed` or `draft` state. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_order_with_http_info(create_order_request, async_req=True)
Expand Down Expand Up @@ -284,6 +286,7 @@ def create_order_with_http_info(self, create_order_request, **kwargs): # noqa:
all_params.append("aircraft_code")
all_params.append("cabin_class")
all_params.append("passenger_count")
all_params.append("state")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -440,6 +443,7 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("aircraft_code")
all_params.append("cabin_class")
all_params.append("passenger_count")
all_params.append("state")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -586,6 +590,7 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("aircraft_code")
all_params.append("cabin_class")
all_params.append("passenger_count")
all_params.append("state")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -743,6 +748,7 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501
all_params.append("aircraft_code")
all_params.append("cabin_class")
all_params.append("passenger_count")
all_params.append("state")

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 @@ -51,6 +51,7 @@ class ProjectsApi(object):
"aircraft_code",
"cabin_class",
"passenger_count",
"state",
]

def __init__(self, api_client=None):
Expand Down Expand Up @@ -136,6 +137,7 @@ def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("aircraft_code")
all_params.append("cabin_class")
all_params.append("passenger_count")
all_params.append("state")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -288,6 +290,7 @@ def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501
all_params.append("aircraft_code")
all_params.append("cabin_class")
all_params.append("passenger_count")
all_params.append("state")

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 @@ -51,6 +51,7 @@ class TechnologyTypesApi(object):
"aircraft_code",
"cabin_class",
"passenger_count",
"state",
]

def __init__(self, api_client=None):
Expand Down Expand Up @@ -134,6 +135,7 @@ def retrieve_technology_types_with_http_info(self, **kwargs): # noqa: E501
all_params.append("aircraft_code")
all_params.append("cabin_class")
all_params.append("passenger_count")
all_params.append("state")

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.17.1"
self.user_agent = "patch-python/1.18.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.17.1".format(
"SDK Package Version: 1.18.0".format(
env=sys.platform, pyversion=sys.version
)
)
Expand Down
37 changes: 37 additions & 0 deletions patch_api/models/create_order_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ class CreateOrderRequest(object):
"total_price_cents_usd": "int",
"project_id": "str",
"metadata": "object",
"state": "str",
}

attribute_map = {
"mass_g": "mass_g",
"total_price_cents_usd": "total_price_cents_usd",
"project_id": "project_id",
"metadata": "metadata",
"state": "state",
}

def __init__(
Expand All @@ -53,6 +55,7 @@ def __init__(
total_price_cents_usd=None,
project_id=None,
metadata=None,
state=None,
local_vars_configuration=None,
): # noqa: E501
"""CreateOrderRequest - a model defined in OpenAPI""" # noqa: E501
Expand All @@ -64,6 +67,7 @@ def __init__(
self._total_price_cents_usd = None
self._project_id = None
self._metadata = None
self._state = None
self.discriminator = None

if mass_g is not None:
Expand All @@ -74,6 +78,8 @@ def __init__(
self.project_id = project_id
if metadata is not None:
self.metadata = metadata
if state is not None:
self.state = state

@property
def mass_g(self):
Expand Down Expand Up @@ -183,6 +189,37 @@ def metadata(self, metadata):

self._metadata = metadata

@property
def state(self):
"""Gets the state of this CreateOrderRequest. # noqa: E501
:return: The state of this CreateOrderRequest. # noqa: E501
:rtype: str
"""
return self._state

@state.setter
def state(self, state):
"""Sets the state of this CreateOrderRequest.
:param state: The state of this CreateOrderRequest. # noqa: E501
:type: str
"""
allowed_values = ["draft", "placed"] # noqa: E501
if (
self.local_vars_configuration.client_side_validation
and state not in allowed_values
): # noqa: E501
raise ValueError(
"Invalid value for `state` ({0}), must be one of {1}".format( # noqa: E501
state, allowed_values
)
)

self._state = state

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.17.1"
VERSION = "1.18.0"
# To install the library, run the following
#
# python setup.py install
Expand Down
8 changes: 8 additions & 0 deletions test/test_orders_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ def test_interactions_with_an_order(self):
order.data.price_cents_usd + order.data.patch_fee_cents_usd, 100
)

"""Create an order in draft state
"""
order = self.api.create_order(mass_g=100, state="draft")

self.assertTrue(order)
self.assertEqual(order.data.mass_g, 100)
self.assertEqual(order.data.state, "draft")

def test_retrieve_order(self):
"""Test case for retrieve_order"""

Expand Down

0 comments on commit fc56f3e

Please sign in to comment.