Skip to content

Commit

Permalink
Merge pull request #113 from JIR-21
Browse files Browse the repository at this point in the history
Minor changes to management.py
  • Loading branch information
princenyeche authored Jul 4, 2023
2 parents 7c0a435 + 5cb4a5d commit ddc29dc
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 36 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Jira one change log

**Release 0.7.8** - 2023-07-04
### Minor update #112
* Fix to management API for organization management.


**Release 0.7.7** - 2023-06-14
### Minor update #111
* Added minor updates to the `export_issues` method. Corrected some few grammatical errors
Expand Down
3 changes: 2 additions & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ Below shows the list of supported versions for the jiraone library

| Version | Supported |
|---------|--------------------|
| 0.7.8 | :white_check_mark: |
| 0.7.7 | :white_check_mark: |
| 0.7.6 | :white_check_mark: |
| 0.7.5 | :white_check_mark: |
| 0.7.4 | :white_check_mark: |
| 0.7.3 | :white_check_mark: |
| 0.7.3 | :x: |
| 0.7.2 | :x: |
| 0.7.1 | :x: |
| 0.7.0 | :x: |
Expand Down
2 changes: 1 addition & 1 deletion jiraone/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from jiraone.management import manage

__author__ = "Prince Nyeche"
__version__ = "0.7.7"
__version__ = "0.7.8"
__all__ = [
"LOGIN",
"endpoint",
Expand Down
2 changes: 1 addition & 1 deletion jiraone/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ def _parse_data_obj(self, data: requests.Response, types: str = "org") -> None:
"""
many = []
total = (
-1 if types == "org" or types == "domain" else data.json()["meta"]["total"]
-1 if types == "org" or types == "domain" else data.json()["meta"]["page_size"]
)
count = 0
for ids in data.json()["data"]:
Expand Down
68 changes: 36 additions & 32 deletions jiraone/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -2194,9 +2194,45 @@ def export_issues(
import random
from time import sleep

def validate_on_error(name_field: Any = None,
data_type: tuple = None,
err_message: str = None) -> None:
"""
Validate an argument and prepares an error response
:param name_field: An argument field name
:param data_type: The data type of the argument, it expects
a datatype object, the name of the argument and a message
which explains the expected object of the argument
:param err_message: Expected error message
:return: None
"""
if not isinstance(name_field, data_type[0]):
add_log(
'The `{}` argument seems to be using the wrong '
'data structure "{}" as value, '
'expecting {}.'.format(data_type[1],
name_field, data_type[2]),
"error",
)
raise JiraOneErrors(
"wrong",
"The `{}` argument should be "
"{}."
"Detected {} instead.".format(data_type[1], err_message,
type(name_field)),
)

check_auth: bool = (
kwargs["check_auth"] if "check_auth" in kwargs else True
)
validate_on_error(check_auth, (bool, "check_auth",
"a boolean to denote true or false"),
"a boolean to denote true or "
"false to check the initial authentication")

if check_auth is True:
reason = LOGIN.get(endpoint.myself())
Expand Down Expand Up @@ -2337,38 +2373,6 @@ def export_issues(
# stores most configuration data using a dictionary
config = {}

def validate_on_error(name_field: Any = None,
data_type: tuple = None,
err_message: str = None) -> None:
"""
Validate an argument and prepares an error response
:param name_field: An argument field name
:param data_type: The data type of the argument, it expects
a datatype object, the name of the argument and a message
which explains the expected object of the argument
:param err_message: Expected error message
:return: None
"""
if not isinstance(name_field, data_type[0]):
add_log(
'The `{}` argument seems to be using the wrong '
'data structure "{}" as value, '
'expecting {}.'.format(data_type[1],
name_field, data_type[2]),
"error",
)
raise JiraOneErrors(
"wrong",
"The `{}` argument should be "
"{}."
"Detected {} instead.".format(data_type[1], err_message,
type(name_field)),
)

# Checking that the arguments are passing correct data structure.
def field_value_check(
param_field: list = None,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="jiraone",
version="0.7.7",
version="0.7.8",
author="Prince Nyeche",
author_email="[email protected]",
description="A REST API Implementation to Jira Cloud APIs for creating reports and "
Expand Down

0 comments on commit ddc29dc

Please sign in to comment.