Skip to content

Update type of cents_usd fields in response #27

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 4 commits into from
Jul 14, 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.7.0] - 2021-07-14

### Changed

- [BREAKING] Changed `order.price_cents_usd` and `order.patch_fee_cents_usd` from string to integer.

## [1.6.0] - 2021-07-14

### Added
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build:
python setup.py install

lint:
pip install -r test-requirements.txt && \
pip install black && \
black .

test:
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.6.0"
__version__ = "1.7.0"

# import ApiClient
from patch_api.api_client import ApiClient
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.6.0/python"
self.user_agent = "OpenAPI-Generator/1.7.0/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.6.0".format(env=sys.platform, pyversion=sys.version)
"SDK Package Version: 1.7.0".format(env=sys.platform, pyversion=sys.version)
)

def get_host_settings(self):
Expand Down
12 changes: 6 additions & 6 deletions patch_api/models/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class Order(object):
"production": "bool",
"state": "str",
"allocation_state": "str",
"price_cents_usd": "str",
"patch_fee_cents_usd": "str",
"price_cents_usd": "int",
"patch_fee_cents_usd": "int",
"allocations": "list[Allocation]",
"registry_url": "str",
"metadata": "object",
Expand Down Expand Up @@ -295,7 +295,7 @@ def price_cents_usd(self):
The total price in cents USD of the carbon offsets purchased through this order. # noqa: E501

:return: The price_cents_usd of this Order. # noqa: E501
:rtype: str
:rtype: int
"""
return self._price_cents_usd

Expand All @@ -306,7 +306,7 @@ def price_cents_usd(self, price_cents_usd):
The total price in cents USD of the carbon offsets purchased through this order. # noqa: E501

:param price_cents_usd: The price_cents_usd of this Order. # noqa: E501
:type: str
:type: int
"""

self._price_cents_usd = price_cents_usd
Expand All @@ -318,7 +318,7 @@ def patch_fee_cents_usd(self):
The Patch Fee in cents USD for this order. # noqa: E501

:return: The patch_fee_cents_usd of this Order. # noqa: E501
:rtype: str
:rtype: int
"""
return self._patch_fee_cents_usd

Expand All @@ -329,7 +329,7 @@ def patch_fee_cents_usd(self, patch_fee_cents_usd):
The Patch Fee in cents USD for this order. # noqa: E501

:param patch_fee_cents_usd: The patch_fee_cents_usd of this Order. # noqa: E501
:type: str
:type: int
"""

self._patch_fee_cents_usd = patch_fee_cents_usd
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.6.0"
VERSION = "1.7.0"
# To install the library, run the following
#
# python setup.py install
Expand Down
1 change: 0 additions & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
black>=21.6b0
pytest~=4.6.7 # needed for python 2.7+3.4
pytest-cov>=2.8.1
pytest-randomly==1.2.3 # needed for python 2.7+3.4
11 changes: 10 additions & 1 deletion test/test_orders_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,35 @@ def tearDown(self):
self.api = None

def test_interactions_with_an_order(self):
"""Test case for create_order, retrieve_order"""
"""Test case for create_order"""

"""Create an order
"""
order = self.api.create_order(mass_g=100)

self.assertTrue(order)

self.assertEqual(order.data.mass_g, 100)

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

self.assertTrue(order)
self.assertEqual(
order.data.price_cents_usd + order.data.patch_fee_cents_usd, 100
)

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

"""Retrieve an order
"""
order = self.api.create_order(mass_g=100)
retrieved_order = self.api.retrieve_order(id=order.data.id)

self.assertTrue(retrieved_order)
self.assertEqual(retrieved_order.data.mass_g, 100)

def test_retrieve_orders(self):
"""Test case for retrieve_orders
Expand Down