Skip to content

Adds the verifier field to the project response #43

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 1 commit into from
Nov 4, 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.15.1] - 2021-11-04

### Added

- Adds verifier to project responses

## [1.15.0] - 2021-10-04

### Added
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.15.0"
__version__ = "1.15.1"

# 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 @@ -92,7 +92,7 @@ def __init__(
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = "patch-python/1.15.0"
self.user_agent = "patch-python/1.15.1"

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.15.0".format(
"SDK Package Version: 1.15.1".format(
env=sys.platform, pyversion=sys.version
)
)
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 @@ -281,7 +281,7 @@ def state(self, state):
def allocation_state(self):
"""Gets the allocation_state of this Order. # noqa: E501

The current state of the allocated carbon offsets of the order. # noqa: E501
DEPRECATED. Indicates if the order has been fully allocated to projects. # noqa: E501

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

The current state of the allocated carbon offsets of the order. # noqa: E501
DEPRECATED. Indicates if the order has been fully allocated to projects. # noqa: E501

:param allocation_state: The allocation_state of this Order. # noqa: E501
:type: str
Expand Down
33 changes: 31 additions & 2 deletions patch_api/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class Project(object):
"photos": "list[Photo]",
"average_price_per_tonne_cents_usd": "int",
"remaining_mass_g": "int",
"verifier": "str",
"standard": "Standard",
"sdgs": "list[Sdg]",
"tagline": "str",
Expand All @@ -69,6 +70,7 @@ class Project(object):
"photos": "photos",
"average_price_per_tonne_cents_usd": "average_price_per_tonne_cents_usd",
"remaining_mass_g": "remaining_mass_g",
"verifier": "verifier",
"standard": "standard",
"sdgs": "sdgs",
"tagline": "tagline",
Expand All @@ -91,6 +93,7 @@ def __init__(
photos=None,
average_price_per_tonne_cents_usd=None,
remaining_mass_g=None,
verifier=None,
standard=None,
sdgs=None,
tagline=None,
Expand All @@ -116,6 +119,7 @@ def __init__(
self._photos = None
self._average_price_per_tonne_cents_usd = None
self._remaining_mass_g = None
self._verifier = None
self._standard = None
self._sdgs = None
self._tagline = None
Expand All @@ -138,6 +142,8 @@ def __init__(
self.photos = photos
self.average_price_per_tonne_cents_usd = average_price_per_tonne_cents_usd
self.remaining_mass_g = remaining_mass_g
if verifier is not None:
self.verifier = verifier
self.standard = standard
self.sdgs = sdgs
if tagline is not None:
Expand Down Expand Up @@ -524,11 +530,34 @@ def remaining_mass_g(self, remaining_mass_g):

self._remaining_mass_g = remaining_mass_g

@property
def verifier(self):
"""Gets the verifier of this Project. # noqa: E501

The name of the project verifier. A verifier is the organization that verifies the calculations of the actual amount of greenhouse gas emissions that have been avoided or sequestered through implementation of the project. # noqa: E501

:return: The verifier of this Project. # noqa: E501
:rtype: str
"""
return self._verifier

@verifier.setter
def verifier(self, verifier):
"""Sets the verifier of this Project.

The name of the project verifier. A verifier is the organization that verifies the calculations of the actual amount of greenhouse gas emissions that have been avoided or sequestered through implementation of the project. # noqa: E501

:param verifier: The verifier of this Project. # noqa: E501
:type: str
"""

self._verifier = verifier

@property
def standard(self):
"""Gets the standard of this Project. # noqa: E501

An object returning the Standard associated with this project. # noqa: E501
An object returning the Standard associated with this project. Standards provide guidance on GHG quantification, monitoring, and reporting. Standards can include protocols/methodologies and guidance documents. # noqa: E501

:return: The standard of this Project. # noqa: E501
:rtype: Standard
Expand All @@ -539,7 +568,7 @@ def standard(self):
def standard(self, standard):
"""Sets the standard of this Project.

An object returning the Standard associated with this project. # noqa: E501
An object returning the Standard associated with this project. Standards provide guidance on GHG quantification, monitoring, and reporting. Standards can include protocols/methodologies and guidance documents. # noqa: E501

:param standard: The standard of this Project. # noqa: E501
:type: Standard
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.15.0"
VERSION = "1.15.1"
# To install the library, run the following
#
# python setup.py install
Expand Down
8 changes: 4 additions & 4 deletions test/test_projects_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ def test_retrieve_projects(self):
self.assertGreater(project.average_price_per_tonne_cents_usd, 0)
self.assertGreater(project.remaining_mass_g, 0)
self.assertEqual(project.standard, None)
self.assertRegex(project.name, r"Test Offset Project")
self.assertIsInstance(project.name, str)
self.assertTrue(project.description)
self.assertEqual(project.country, "US")
self.assertEqual(project.type, "biomass")
self.assertEqual(project.developer, "Patch Sandbox Supplier Test")
self.assertIsInstance(project.country, str)
self.assertIsInstance(project.type, str)
self.assertIsInstance(project.developer, str)
Comment on lines -75 to +77
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those were too brittle and failing. Proposing to keep tests dumb in the SDKs

Copy link
Contributor

Choose a reason for hiding this comment

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

no test for verifier?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, that data was too sparsely populated to make for a reliable test. To be revised when we can improve test strategies for SDKs.

self.assertTrue(isinstance(project.photos, list))

def test_retrieve_biomass_projects(self):
Expand Down