Skip to content

Fix issue with total_price_cents_usd param in create_order #24

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 6 commits into from
Mar 30, 2021
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.5.2] - 2021-03-30

### Fixed

- Fixes [#23](https://github.com/patch-technology/patch-python/issues/23) by allowing the expected parameter `total_price_cents_usd`

## [1.5.1] - 2021-03-02

### Fixed
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.5.1"
__version__ = "1.5.2"

# import ApiClient
from patch_api.api_client import ApiClient
Expand Down
14 changes: 7 additions & 7 deletions patch_api/api/estimates_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class EstimatesApi(object):

ALLOWED_QUERY_PARAMS = [
"mass_g",
"price_cents_usd",
"total_price_cents_usd",
"project_id",
"page",
"distance_m",
Expand Down Expand Up @@ -109,7 +109,7 @@ def create_flight_estimate_with_http_info(
all_params.append("_preload_content")
all_params.append("_request_timeout")
all_params.append("mass_g")
all_params.append("price_cents_usd")
all_params.append("total_price_cents_usd")
all_params.append("project_id")
all_params.append("metadata")
all_params.append("distance_m")
Expand Down Expand Up @@ -252,7 +252,7 @@ def create_mass_estimate_with_http_info(
all_params.append("_preload_content")
all_params.append("_request_timeout")
all_params.append("mass_g")
all_params.append("price_cents_usd")
all_params.append("total_price_cents_usd")
all_params.append("project_id")
all_params.append("metadata")
all_params.append("distance_m")
Expand Down Expand Up @@ -395,7 +395,7 @@ def create_shipping_estimate_with_http_info(
all_params.append("_preload_content")
all_params.append("_request_timeout")
all_params.append("mass_g")
all_params.append("price_cents_usd")
all_params.append("total_price_cents_usd")
all_params.append("project_id")
all_params.append("metadata")
all_params.append("distance_m")
Expand Down Expand Up @@ -538,7 +538,7 @@ def create_vehicle_estimate_with_http_info(
all_params.append("_preload_content")
all_params.append("_request_timeout")
all_params.append("mass_g")
all_params.append("price_cents_usd")
all_params.append("total_price_cents_usd")
all_params.append("project_id")
all_params.append("metadata")
all_params.append("distance_m")
Expand Down Expand Up @@ -675,7 +675,7 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("_preload_content")
all_params.append("_request_timeout")
all_params.append("mass_g")
all_params.append("price_cents_usd")
all_params.append("total_price_cents_usd")
all_params.append("project_id")
all_params.append("metadata")
all_params.append("distance_m")
Expand Down Expand Up @@ -802,7 +802,7 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501
all_params.append("_preload_content")
all_params.append("_request_timeout")
all_params.append("mass_g")
all_params.append("price_cents_usd")
all_params.append("total_price_cents_usd")
all_params.append("project_id")
all_params.append("metadata")
all_params.append("distance_m")
Expand Down
12 changes: 6 additions & 6 deletions patch_api/api/orders_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class OrdersApi(object):

ALLOWED_QUERY_PARAMS = [
"mass_g",
"price_cents_usd",
"total_price_cents_usd",
"project_id",
"page",
"distance_m",
Expand Down Expand Up @@ -103,7 +103,7 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("_preload_content")
all_params.append("_request_timeout")
all_params.append("mass_g")
all_params.append("price_cents_usd")
all_params.append("total_price_cents_usd")
all_params.append("project_id")
all_params.append("metadata")
all_params.append("distance_m")
Expand Down Expand Up @@ -232,7 +232,7 @@ def create_order_with_http_info(self, create_order_request, **kwargs): # noqa:
all_params.append("_preload_content")
all_params.append("_request_timeout")
all_params.append("mass_g")
all_params.append("price_cents_usd")
all_params.append("total_price_cents_usd")
all_params.append("project_id")
all_params.append("metadata")
all_params.append("distance_m")
Expand Down Expand Up @@ -369,7 +369,7 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("_preload_content")
all_params.append("_request_timeout")
all_params.append("mass_g")
all_params.append("price_cents_usd")
all_params.append("total_price_cents_usd")
all_params.append("project_id")
all_params.append("metadata")
all_params.append("distance_m")
Expand Down Expand Up @@ -496,7 +496,7 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("_preload_content")
all_params.append("_request_timeout")
all_params.append("mass_g")
all_params.append("price_cents_usd")
all_params.append("total_price_cents_usd")
all_params.append("project_id")
all_params.append("metadata")
all_params.append("distance_m")
Expand Down Expand Up @@ -623,7 +623,7 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501
all_params.append("_preload_content")
all_params.append("_request_timeout")
all_params.append("mass_g")
all_params.append("price_cents_usd")
all_params.append("total_price_cents_usd")
all_params.append("project_id")
all_params.append("metadata")
all_params.append("distance_m")
Expand Down
10 changes: 5 additions & 5 deletions patch_api/api/preferences_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class PreferencesApi(object):

ALLOWED_QUERY_PARAMS = [
"mass_g",
"price_cents_usd",
"total_price_cents_usd",
"project_id",
"page",
"distance_m",
Expand Down Expand Up @@ -107,7 +107,7 @@ def create_preference_with_http_info(
all_params.append("_preload_content")
all_params.append("_request_timeout")
all_params.append("mass_g")
all_params.append("price_cents_usd")
all_params.append("total_price_cents_usd")
all_params.append("project_id")
all_params.append("metadata")
all_params.append("distance_m")
Expand Down Expand Up @@ -244,7 +244,7 @@ def delete_preference_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("_preload_content")
all_params.append("_request_timeout")
all_params.append("mass_g")
all_params.append("price_cents_usd")
all_params.append("total_price_cents_usd")
all_params.append("project_id")
all_params.append("metadata")
all_params.append("distance_m")
Expand Down Expand Up @@ -371,7 +371,7 @@ def retrieve_preference_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("_preload_content")
all_params.append("_request_timeout")
all_params.append("mass_g")
all_params.append("price_cents_usd")
all_params.append("total_price_cents_usd")
all_params.append("project_id")
all_params.append("metadata")
all_params.append("distance_m")
Expand Down Expand Up @@ -498,7 +498,7 @@ def retrieve_preferences_with_http_info(self, **kwargs): # noqa: E501
all_params.append("_preload_content")
all_params.append("_request_timeout")
all_params.append("mass_g")
all_params.append("price_cents_usd")
all_params.append("total_price_cents_usd")
all_params.append("project_id")
all_params.append("metadata")
all_params.append("distance_m")
Expand Down
6 changes: 3 additions & 3 deletions patch_api/api/projects_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ProjectsApi(object):

ALLOWED_QUERY_PARAMS = [
"mass_g",
"price_cents_usd",
"total_price_cents_usd",
"project_id",
"page",
"distance_m",
Expand Down Expand Up @@ -103,7 +103,7 @@ def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("_preload_content")
all_params.append("_request_timeout")
all_params.append("mass_g")
all_params.append("price_cents_usd")
all_params.append("total_price_cents_usd")
all_params.append("project_id")
all_params.append("metadata")
all_params.append("distance_m")
Expand Down Expand Up @@ -236,7 +236,7 @@ def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501
all_params.append("_preload_content")
all_params.append("_request_timeout")
all_params.append("mass_g")
all_params.append("price_cents_usd")
all_params.append("total_price_cents_usd")
all_params.append("project_id")
all_params.append("metadata")
all_params.append("distance_m")
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 = "OpenAPI-Generator/1.5.1/python"
self.user_agent = "OpenAPI-Generator/1.5.2/python"

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.5.1".format(env=sys.platform, pyversion=sys.version)
"SDK Package Version: 1.5.2".format(env=sys.platform, pyversion=sys.version)
)

def get_host_settings(self):
Expand Down
4 changes: 2 additions & 2 deletions patch_api/models/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ def mass_g(self, mass_g):
if (
self.local_vars_configuration.client_side_validation
and mass_g is not None
and mass_g < 1
and mass_g < 0
): # noqa: E501
raise ValueError(
"Invalid value for `mass_g`, must be a value greater than or equal to `1`"
"Invalid value for `mass_g`, must be a value greater than or equal to `0`"
) # noqa: E501

self._mass_g = mass_g
Expand Down
5 changes: 3 additions & 2 deletions patch_api/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def description(self, description):
def type(self):
"""Gets the type of this Project. # noqa: E501

The type of carbon removal project, currently available project types are Biomass, Dac, Forestry, Mineralization, Ocean, Soil. # noqa: E501
The type of carbon removal project, currently available project types are Biomass, Dac, Forestry, Mineralization, Ocean, Renewables, Soil. # noqa: E501

:return: The type of this Project. # noqa: E501
:rtype: str
Expand All @@ -241,7 +241,7 @@ def type(self):
def type(self, type):
"""Sets the type of this Project.

The type of carbon removal project, currently available project types are Biomass, Dac, Forestry, Mineralization, Ocean, Soil. # noqa: E501
The type of carbon removal project, currently available project types are Biomass, Dac, Forestry, Mineralization, Ocean, Renewables, Soil. # noqa: E501

:param type: The type of this Project. # noqa: E501
:type: str
Expand All @@ -252,6 +252,7 @@ def type(self, type):
"forestry",
"mineralization",
"ocean",
"renewables",
"soil",
] # noqa: E501
if (
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.5.1"
VERSION = "1.5.2"
# 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 @@ -38,6 +38,12 @@ def test_interactions_with_an_order(self):

self.assertTrue(order)

"""Create an order on price
"""
order = self.api.create_order(total_price_cents_usd=100)

self.assertTrue(order)
Comment on lines +41 to +45
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test would have caught #23


"""Retrieve an order
"""
order = self.api.create_order(mass_g=100)
Expand Down
4 changes: 2 additions & 2 deletions test/test_projects_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def test_retrieve_projects(self):
project = projects[0]

self.assertEqual(project.production, False)
self.assertEqual(project.average_price_per_tonne_cents_usd, 0)
self.assertEqual(project.remaining_mass_g, 0)
self.assertGreater(project.average_price_per_tonne_cents_usd, 0)
self.assertGreater(project.remaining_mass_g, 0)
Comment on lines -55 to +56
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@biglovisa I had to relax this test because we added records to this project on the sandbox.
Generally, I wouldn't want those tests to be too locked in to a specific value.

self.assertEqual(project.standard, None)
self.assertEqual(project.name, "Carbo Culture Biochar")
self.assertTrue(project.description)
Expand Down