Skip to content

Commit

Permalink
Test still failing
Browse files Browse the repository at this point in the history
* Fixed error with file not found
* Corrected documentation text and reference.
  • Loading branch information
princenyeche committed Dec 23, 2023
1 parent 31b6a2f commit 787f3be
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 33 deletions.
47 changes: 28 additions & 19 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,31 +106,31 @@ Example usage:

For example 1::

from jiraone import LOGIN, endpoint
from jiraone import LOGIN, endpoint

# previous login
LOGIN.session.headers = LOGIN.headers
LOGIN.session.auth = LOGIN.auth_request
response = LOGIN.session.get(endpoint.myself())
print(response.status_code)
# <Response 200>
# previous login
LOGIN.session.headers = LOGIN.headers
LOGIN.session.auth = LOGIN.auth_request
response = LOGIN.session.get(endpoint.myself())
print(response.status_code)
# <Response 200>

If you want to use a self-signed certificate. You can set a path to the certificate or do not verify it.

For example 2::

from jiraone import LOGIN, endpoint
from jiraone import LOGIN, endpoint

# previous login
LOGIN.session.headers = LOGIN.headers
LOGIN.session.auth = LOGIN.auth_request
# not verifying SSL cert
LOGIN.session.verify = False
# setting a path to the certificate
LOGIN.session.verify = "your_cert_path"
response = LOGIN.session.get(endpoint.myself())
print(response.status_code)
# <Response 200>
# previous login
LOGIN.session.headers = LOGIN.headers
LOGIN.session.auth = LOGIN.auth_request
# not verifying SSL cert
LOGIN.session.verify = False
# setting a path to the certificate
LOGIN.session.verify = "your_cert_path"
response = LOGIN.session.get(endpoint.myself())
print(response.status_code)
# <Response 200>


**Attributes**, available to the :ref:`login` alias
Expand Down Expand Up @@ -651,13 +651,22 @@ You can be able to call various methods by altering the ``method`` keyword argum
* ``GET`` request: Returns information about a single Atlassian account by ID by using a "GET" request.

* ``PATCH`` request: Updates fields in a user account.

* Body parameter

* Any or all user object this is value

For example::

e.g. {"name": "Lila User", "nickname": "marshmallow"}

* ``PUT`` request: Sets the specified user's email address.

* Body parameter
e.g. {"email": "[email protected]"}

For example::

e.g. {"email": "[email protected]"}



Expand Down
28 changes: 18 additions & 10 deletions docs/apis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ API Documentation
.. module:: jiraone.access


.. _endpoint-class:
endpoint
--------

Expand All @@ -26,12 +27,13 @@ You can access this classmethod by calling ``jiraone.endpoint``.
...
.. _endpoint-class:
.. autoclass:: EndPoints
:members:


.. _credential-class:

LOGIN
--------

Expand All @@ -57,12 +59,13 @@ Once a login session starts, you can join other classes and make a call directly
LOGIN.get(endpoint.myself())
.. _credential-class:
.. autoclass:: Credentials
:members:


.. _field-class:

field
---------

Expand All @@ -81,18 +84,19 @@ You can access this class and make updates to Jira fields.
c = field.update_field_data(data=value, find_field=fields, key_or_id=issue, options="add", show=False)
echo(c)
.. _field-class:
.. autoclass:: Field
:members:


.. _for-class:

For
-------
The :ref:`for-class` class shows an implementation of a ``for`` loop. It comes with a special method that
helps with dictionary indexing.

.. _for-class:


.. autoclass:: For
:members:
Expand Down Expand Up @@ -125,6 +129,8 @@ user and organization management. The authentication is different as it uses a b
.. module:: jiraone.reporting


.. _project-class:

PROJECT
-----------

Expand All @@ -138,12 +144,14 @@ This is an alias to the :ref:`project-class` class of the ``reporting`` module.
jql = "project = ABC ORDER BY Rank DESC"
PROJECT.change_log(jql)
.. _project-class:
.. autoclass:: Projects
:members:


.. _user-class:

USER
------

Expand All @@ -157,7 +165,6 @@ USER
USER.get_all_users(file="user.csv", folder="USERS")
.. _user-class:
.. autoclass:: Users
:members:
Expand Down Expand Up @@ -195,7 +202,7 @@ as possible, so you can easily make calls to Jira's endpoint and get the require
# <Response [204]>
.. function:: field_update
.. autofunction:: field_update

.. autofunction:: time_in_status

Expand All @@ -207,10 +214,11 @@ as possible, so you can easily make calls to Jira's endpoint and get the require
.. module:: jiraone.utils


.. _dotnotation-class:

Utils
---------

.. _dotnotation-class:

.. autoclass:: DotNotation
:members:
Expand Down Expand Up @@ -240,12 +248,11 @@ Examples below

When loading a list of dictionaries, please refer to the second example as shown on the above code. The dictionary needs to be assigned to a key (any naming convention will do) to get the value. Failure will result in an error.

.. _dateformat-class:

.. autoclass:: DateFormat
:members:

The :ref:`dateformat-class` class provides the ability to construct datetime string directive which is used in Python's datetime class.
The ``DateFormat`` class provides the ability to construct datetime string directive which is used in Python's datetime class.

.. code-block:: python
Expand All @@ -268,4 +275,5 @@ threads to start with by increasing the ``workers`` argument
for items in list_items
process_executor(extract_issues, data=items)
.. autofunction:: validate_on_error
10 changes: 8 additions & 2 deletions docs/report.rst
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ This function has the ability to generate the time an issue has stayed in a part
key = ["COM-12", "COM-114", "TPS-14", 10024] # a list of issue keys or issue ids
key = {"jql": "project = COM ORDER BY created DESC"} # a dict using JQL
The third argument is file_reader function which you will need to pass or you can pass as a keyword argument as reader=file_reader. The remaining arguments can be passed as keyword arguments, pprint enables you to print out the time in status in Jira’s pretty format e.g. 13d 11h 22m 15s if it is set to True otherwise if it is not set at all, you will get the DateTime output as *13 days, 11:22:15.913* which is a time delta string of the DateTime string collected from the issue history. The output_format argument enables you to generate a report file either in *CSV* or *JSON* format. The words have to be strings and are case insensitive. E.g cSV or JsoN will output the correct file. The output_file argument basically just allows you to name the file, avoid using any extension as this will be automatically added based on the output_format. The status argument allows you to only output statuses that have that status name. For example, you want a report of only “In Progress” status, then you should write the name "In Progress" (this is case sensitive) as the value to the status argument. If left blank, the result will be all the statuses within the issues being searched. Therefore, if you want the time in status for all the statuses that exist within the Jira issues, do not set the status argument. The login argument is essential to the function as it is required for authenticating your API to the Jira issues. The `report_file` basically helps within the history generation, you do not have to set this as it is optional. The same goes for `report_folder` you do not have to set this as it is optional.
The third argument is file_reader function which you will need to pass or you can pass as a keyword argument as ``reader=file_reader``. The remaining arguments can be passed as keyword arguments, ``pprint`` enables you to print out the time in status in Jira’s pretty format e.g. 13d 11h 22m 15s if it is set to True otherwise if it is not set at all, you will get the DateTime output as *13 days, 11:22:15.913* which is a time delta string of the DateTime string collected from the issue history. The output_format argument enables you to generate a report file either in *CSV* or *JSON* format. The words have to be strings and are case insensitive. E.g cSV or JsoN will output the correct file. The output_file argument basically just allows you to name the file, avoid using any extension as this will be automatically added based on the output_format. The status argument allows you to only output statuses that have that status name. For example, you want a report of only “In Progress” status, then you should write the name "In Progress" (this is case sensitive) as the value to the status argument. If left blank, the result will be all the statuses within the issues being searched. Therefore, if you want the time in status for all the statuses that exist within the Jira issues, do not set the status argument. The login argument is essential to the function as it is required for authenticating your API to the Jira issues. The `report_file` basically helps within the history generation, you do not have to set this as it is optional. The same goes for ``report_folder`` you do not have to set this as it is optional.
Once you run the script, you will end up with a report that looks like the one below as the output

Expand All @@ -306,6 +306,12 @@ Once you run the script, you will end up with a report that looks like the one b
]
.. note::

The ``time_in_status`` - ``pprint`` argument supports both string and bool data types as of v0.7.9. When set with the string "timestamp" it produces the time_in_status with a
timestamp.


* Update custom field or system fields using a field update function. Please ensure that the fields you want to update is visible on screen in your projects, if not you will get a 400 error response instead. The API doesn't override the screen functions.


Expand All @@ -332,7 +338,7 @@ Once you run the script, you will end up with a report that looks like the one b
The above function is able to update any field used on Jira cloud. All you simply need to do is find the field based on it's name (case sensitive). If it exist, then a result will be shown for it. The field_update requires the below argument.
* field: a call to the :ref;`field-class` class needs to be passed as the first argument.
* field: a call to the :ref:`field-class` class needs to be passed as the first argument.
* key_or_id: An issue key or issue id needs to be passed as the second argument or you can use a keyword argument.
* update: A way to update the custom field. It accepts two valid values either ``add`` (adds a value to a list or dict) or `remove` (removes from a value to a list or dict)
* name: The name of a field
Expand Down
4 changes: 2 additions & 2 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def test_time_in_status(self):
reader=file_reader,
output_format="json",
report_folder="TEST",
output_filename="test_time_in_status.json",
output_filename="test_time_in_status",
login=LOGIN,
pprint="timestamp",
)
Expand All @@ -139,7 +139,7 @@ def test_time_in_status(self):
reader=file_reader,
output_format="csv",
report_folder="TEST",
output_filename="test_time_in_status.csv",
output_filename="test_time_in_status",
login=LOGIN,
pprint=True,
)
Expand Down

0 comments on commit 787f3be

Please sign in to comment.