Skip to content

Commit 9b6f0c7

Browse files
authored
Update type of cents_usd fields in response (#27)
* Update Python SDK * Update changelog * Remove print * Fix test
1 parent 0d83381 commit 9b6f0c7

9 files changed

+27
-13
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
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.7.0] - 2021-07-14
9+
10+
### Changed
11+
12+
- [BREAKING] Changed `order.price_cents_usd` and `order.patch_fee_cents_usd` from string to integer.
13+
814
## [1.6.0] - 2021-07-14
915

1016
### Added

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build:
55
python setup.py install
66

77
lint:
8-
pip install -r test-requirements.txt && \
8+
pip install black && \
99
black .
1010

1111
test:

patch_api/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from __future__ import absolute_import
1717

18-
__version__ = "1.6.0"
18+
__version__ = "1.7.0"
1919

2020
# import ApiClient
2121
from patch_api.api_client import ApiClient

patch_api/api_client.py

Lines changed: 1 addition & 1 deletion
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.6.0/python"
94+
self.user_agent = "OpenAPI-Generator/1.7.0/python"
9595

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

patch_api/configuration.py

Lines changed: 1 addition & 1 deletion
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.6.0".format(env=sys.platform, pyversion=sys.version)
344+
"SDK Package Version: 1.7.0".format(env=sys.platform, pyversion=sys.version)
345345
)
346346

347347
def get_host_settings(self):

patch_api/models/order.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class Order(object):
3939
"production": "bool",
4040
"state": "str",
4141
"allocation_state": "str",
42-
"price_cents_usd": "str",
43-
"patch_fee_cents_usd": "str",
42+
"price_cents_usd": "int",
43+
"patch_fee_cents_usd": "int",
4444
"allocations": "list[Allocation]",
4545
"registry_url": "str",
4646
"metadata": "object",
@@ -295,7 +295,7 @@ def price_cents_usd(self):
295295
The total price in cents USD of the carbon offsets purchased through this order. # noqa: E501
296296
297297
:return: The price_cents_usd of this Order. # noqa: E501
298-
:rtype: str
298+
:rtype: int
299299
"""
300300
return self._price_cents_usd
301301

@@ -306,7 +306,7 @@ def price_cents_usd(self, price_cents_usd):
306306
The total price in cents USD of the carbon offsets purchased through this order. # noqa: E501
307307
308308
:param price_cents_usd: The price_cents_usd of this Order. # noqa: E501
309-
:type: str
309+
:type: int
310310
"""
311311

312312
self._price_cents_usd = price_cents_usd
@@ -318,7 +318,7 @@ def patch_fee_cents_usd(self):
318318
The Patch Fee in cents USD for this order. # noqa: E501
319319
320320
:return: The patch_fee_cents_usd of this Order. # noqa: E501
321-
:rtype: str
321+
:rtype: int
322322
"""
323323
return self._patch_fee_cents_usd
324324

@@ -329,7 +329,7 @@ def patch_fee_cents_usd(self, patch_fee_cents_usd):
329329
The Patch Fee in cents USD for this order. # noqa: E501
330330
331331
:param patch_fee_cents_usd: The patch_fee_cents_usd of this Order. # noqa: E501
332-
:type: str
332+
:type: int
333333
"""
334334

335335
self._patch_fee_cents_usd = patch_fee_cents_usd

setup.py

Lines changed: 1 addition & 1 deletion
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.6.0"
15+
VERSION = "1.7.0"
1616
# To install the library, run the following
1717
#
1818
# python setup.py install

test-requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
black>=21.6b0
21
pytest~=4.6.7 # needed for python 2.7+3.4
32
pytest-cov>=2.8.1
43
pytest-randomly==1.2.3 # needed for python 2.7+3.4

test/test_orders_api.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,35 @@ def tearDown(self):
3030
self.api = None
3131

3232
def test_interactions_with_an_order(self):
33-
"""Test case for create_order, retrieve_order"""
33+
"""Test case for create_order"""
3434

3535
"""Create an order
3636
"""
3737
order = self.api.create_order(mass_g=100)
3838

3939
self.assertTrue(order)
4040

41+
self.assertEqual(order.data.mass_g, 100)
42+
4143
"""Create an order on price
4244
"""
4345
order = self.api.create_order(total_price_cents_usd=100)
4446

4547
self.assertTrue(order)
48+
self.assertEqual(
49+
order.data.price_cents_usd + order.data.patch_fee_cents_usd, 100
50+
)
51+
52+
def test_retrieve_order(self):
53+
"""Test case for retrieve_order"""
4654

4755
"""Retrieve an order
4856
"""
4957
order = self.api.create_order(mass_g=100)
5058
retrieved_order = self.api.retrieve_order(id=order.data.id)
5159

5260
self.assertTrue(retrieved_order)
61+
self.assertEqual(retrieved_order.data.mass_g, 100)
5362

5463
def test_retrieve_orders(self):
5564
"""Test case for retrieve_orders

0 commit comments

Comments
 (0)