Skip to content

Commit 574b589

Browse files
pcothenetbiglovisa
andauthored
Fix issue with total_price_cents_usd param in create_order (#24)
* Update SDK; format * Update test * Update changelog * Correct date * Add test and fix Co-authored-by: Lovisa Svallingson <[email protected]>
1 parent e6ff357 commit 574b589

13 files changed

+44
-31
lines changed

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.5.2] - 2021-03-30
9+
10+
### Fixed
11+
12+
- Fixes [#23](https://github.com/patch-technology/patch-python/issues/23) by allowing the expected parameter `total_price_cents_usd`
13+
814
## [1.5.1] - 2021-03-02
915

1016
### Fixed

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.5.1"
18+
__version__ = "1.5.2"
1919

2020
# import ApiClient
2121
from patch_api.api_client import ApiClient

patch_api/api/estimates_api.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class EstimatesApi(object):
3030

3131
ALLOWED_QUERY_PARAMS = [
3232
"mass_g",
33-
"price_cents_usd",
33+
"total_price_cents_usd",
3434
"project_id",
3535
"page",
3636
"distance_m",
@@ -109,7 +109,7 @@ def create_flight_estimate_with_http_info(
109109
all_params.append("_preload_content")
110110
all_params.append("_request_timeout")
111111
all_params.append("mass_g")
112-
all_params.append("price_cents_usd")
112+
all_params.append("total_price_cents_usd")
113113
all_params.append("project_id")
114114
all_params.append("metadata")
115115
all_params.append("distance_m")
@@ -252,7 +252,7 @@ def create_mass_estimate_with_http_info(
252252
all_params.append("_preload_content")
253253
all_params.append("_request_timeout")
254254
all_params.append("mass_g")
255-
all_params.append("price_cents_usd")
255+
all_params.append("total_price_cents_usd")
256256
all_params.append("project_id")
257257
all_params.append("metadata")
258258
all_params.append("distance_m")
@@ -395,7 +395,7 @@ def create_shipping_estimate_with_http_info(
395395
all_params.append("_preload_content")
396396
all_params.append("_request_timeout")
397397
all_params.append("mass_g")
398-
all_params.append("price_cents_usd")
398+
all_params.append("total_price_cents_usd")
399399
all_params.append("project_id")
400400
all_params.append("metadata")
401401
all_params.append("distance_m")
@@ -538,7 +538,7 @@ def create_vehicle_estimate_with_http_info(
538538
all_params.append("_preload_content")
539539
all_params.append("_request_timeout")
540540
all_params.append("mass_g")
541-
all_params.append("price_cents_usd")
541+
all_params.append("total_price_cents_usd")
542542
all_params.append("project_id")
543543
all_params.append("metadata")
544544
all_params.append("distance_m")
@@ -675,7 +675,7 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501
675675
all_params.append("_preload_content")
676676
all_params.append("_request_timeout")
677677
all_params.append("mass_g")
678-
all_params.append("price_cents_usd")
678+
all_params.append("total_price_cents_usd")
679679
all_params.append("project_id")
680680
all_params.append("metadata")
681681
all_params.append("distance_m")
@@ -802,7 +802,7 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501
802802
all_params.append("_preload_content")
803803
all_params.append("_request_timeout")
804804
all_params.append("mass_g")
805-
all_params.append("price_cents_usd")
805+
all_params.append("total_price_cents_usd")
806806
all_params.append("project_id")
807807
all_params.append("metadata")
808808
all_params.append("distance_m")

patch_api/api/orders_api.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class OrdersApi(object):
3030

3131
ALLOWED_QUERY_PARAMS = [
3232
"mass_g",
33-
"price_cents_usd",
33+
"total_price_cents_usd",
3434
"project_id",
3535
"page",
3636
"distance_m",
@@ -103,7 +103,7 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501
103103
all_params.append("_preload_content")
104104
all_params.append("_request_timeout")
105105
all_params.append("mass_g")
106-
all_params.append("price_cents_usd")
106+
all_params.append("total_price_cents_usd")
107107
all_params.append("project_id")
108108
all_params.append("metadata")
109109
all_params.append("distance_m")
@@ -232,7 +232,7 @@ def create_order_with_http_info(self, create_order_request, **kwargs): # noqa:
232232
all_params.append("_preload_content")
233233
all_params.append("_request_timeout")
234234
all_params.append("mass_g")
235-
all_params.append("price_cents_usd")
235+
all_params.append("total_price_cents_usd")
236236
all_params.append("project_id")
237237
all_params.append("metadata")
238238
all_params.append("distance_m")
@@ -369,7 +369,7 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501
369369
all_params.append("_preload_content")
370370
all_params.append("_request_timeout")
371371
all_params.append("mass_g")
372-
all_params.append("price_cents_usd")
372+
all_params.append("total_price_cents_usd")
373373
all_params.append("project_id")
374374
all_params.append("metadata")
375375
all_params.append("distance_m")
@@ -496,7 +496,7 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501
496496
all_params.append("_preload_content")
497497
all_params.append("_request_timeout")
498498
all_params.append("mass_g")
499-
all_params.append("price_cents_usd")
499+
all_params.append("total_price_cents_usd")
500500
all_params.append("project_id")
501501
all_params.append("metadata")
502502
all_params.append("distance_m")
@@ -623,7 +623,7 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501
623623
all_params.append("_preload_content")
624624
all_params.append("_request_timeout")
625625
all_params.append("mass_g")
626-
all_params.append("price_cents_usd")
626+
all_params.append("total_price_cents_usd")
627627
all_params.append("project_id")
628628
all_params.append("metadata")
629629
all_params.append("distance_m")

patch_api/api/preferences_api.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class PreferencesApi(object):
3030

3131
ALLOWED_QUERY_PARAMS = [
3232
"mass_g",
33-
"price_cents_usd",
33+
"total_price_cents_usd",
3434
"project_id",
3535
"page",
3636
"distance_m",
@@ -107,7 +107,7 @@ def create_preference_with_http_info(
107107
all_params.append("_preload_content")
108108
all_params.append("_request_timeout")
109109
all_params.append("mass_g")
110-
all_params.append("price_cents_usd")
110+
all_params.append("total_price_cents_usd")
111111
all_params.append("project_id")
112112
all_params.append("metadata")
113113
all_params.append("distance_m")
@@ -244,7 +244,7 @@ def delete_preference_with_http_info(self, id, **kwargs): # noqa: E501
244244
all_params.append("_preload_content")
245245
all_params.append("_request_timeout")
246246
all_params.append("mass_g")
247-
all_params.append("price_cents_usd")
247+
all_params.append("total_price_cents_usd")
248248
all_params.append("project_id")
249249
all_params.append("metadata")
250250
all_params.append("distance_m")
@@ -371,7 +371,7 @@ def retrieve_preference_with_http_info(self, id, **kwargs): # noqa: E501
371371
all_params.append("_preload_content")
372372
all_params.append("_request_timeout")
373373
all_params.append("mass_g")
374-
all_params.append("price_cents_usd")
374+
all_params.append("total_price_cents_usd")
375375
all_params.append("project_id")
376376
all_params.append("metadata")
377377
all_params.append("distance_m")
@@ -498,7 +498,7 @@ def retrieve_preferences_with_http_info(self, **kwargs): # noqa: E501
498498
all_params.append("_preload_content")
499499
all_params.append("_request_timeout")
500500
all_params.append("mass_g")
501-
all_params.append("price_cents_usd")
501+
all_params.append("total_price_cents_usd")
502502
all_params.append("project_id")
503503
all_params.append("metadata")
504504
all_params.append("distance_m")

patch_api/api/projects_api.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ProjectsApi(object):
3030

3131
ALLOWED_QUERY_PARAMS = [
3232
"mass_g",
33-
"price_cents_usd",
33+
"total_price_cents_usd",
3434
"project_id",
3535
"page",
3636
"distance_m",
@@ -103,7 +103,7 @@ def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501
103103
all_params.append("_preload_content")
104104
all_params.append("_request_timeout")
105105
all_params.append("mass_g")
106-
all_params.append("price_cents_usd")
106+
all_params.append("total_price_cents_usd")
107107
all_params.append("project_id")
108108
all_params.append("metadata")
109109
all_params.append("distance_m")
@@ -236,7 +236,7 @@ def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501
236236
all_params.append("_preload_content")
237237
all_params.append("_request_timeout")
238238
all_params.append("mass_g")
239-
all_params.append("price_cents_usd")
239+
all_params.append("total_price_cents_usd")
240240
all_params.append("project_id")
241241
all_params.append("metadata")
242242
all_params.append("distance_m")

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 = "OpenAPI-Generator/1.5.1/python"
94+
self.user_agent = "OpenAPI-Generator/1.5.2/python"
9595

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

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

347347
def get_host_settings(self):

patch_api/models/order.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,10 @@ def mass_g(self, mass_g):
160160
if (
161161
self.local_vars_configuration.client_side_validation
162162
and mass_g is not None
163-
and mass_g < 1
163+
and mass_g < 0
164164
): # noqa: E501
165165
raise ValueError(
166-
"Invalid value for `mass_g`, must be a value greater than or equal to `1`"
166+
"Invalid value for `mass_g`, must be a value greater than or equal to `0`"
167167
) # noqa: E501
168168

169169
self._mass_g = mass_g

patch_api/models/project.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def description(self, description):
230230
def type(self):
231231
"""Gets the type of this Project. # noqa: E501
232232
233-
The type of carbon removal project, currently available project types are Biomass, Dac, Forestry, Mineralization, Ocean, Soil. # noqa: E501
233+
The type of carbon removal project, currently available project types are Biomass, Dac, Forestry, Mineralization, Ocean, Renewables, Soil. # noqa: E501
234234
235235
:return: The type of this Project. # noqa: E501
236236
:rtype: str
@@ -241,7 +241,7 @@ def type(self):
241241
def type(self, type):
242242
"""Sets the type of this Project.
243243
244-
The type of carbon removal project, currently available project types are Biomass, Dac, Forestry, Mineralization, Ocean, Soil. # noqa: E501
244+
The type of carbon removal project, currently available project types are Biomass, Dac, Forestry, Mineralization, Ocean, Renewables, Soil. # noqa: E501
245245
246246
:param type: The type of this Project. # noqa: E501
247247
:type: str
@@ -252,6 +252,7 @@ def type(self, type):
252252
"forestry",
253253
"mineralization",
254254
"ocean",
255+
"renewables",
255256
"soil",
256257
] # noqa: E501
257258
if (

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.5.1"
15+
VERSION = "1.5.2"
1616
# To install the library, run the following
1717
#
1818
# python setup.py install

test/test_orders_api.py

+6
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ def test_interactions_with_an_order(self):
3838

3939
self.assertTrue(order)
4040

41+
"""Create an order on price
42+
"""
43+
order = self.api.create_order(total_price_cents_usd=100)
44+
45+
self.assertTrue(order)
46+
4147
"""Retrieve an order
4248
"""
4349
order = self.api.create_order(mass_g=100)

test/test_projects_api.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ def test_retrieve_projects(self):
5252
project = projects[0]
5353

5454
self.assertEqual(project.production, False)
55-
self.assertEqual(project.average_price_per_tonne_cents_usd, 0)
56-
self.assertEqual(project.remaining_mass_g, 0)
55+
self.assertGreater(project.average_price_per_tonne_cents_usd, 0)
56+
self.assertGreater(project.remaining_mass_g, 0)
5757
self.assertEqual(project.standard, None)
5858
self.assertEqual(project.name, "Carbo Culture Biochar")
5959
self.assertTrue(project.description)

0 commit comments

Comments
 (0)