Skip to content
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

Fix list uri and single uri #2

Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ projects = client.projects.all()

## Prerequisite

* Python >= 3.8
* Python >= 3.10

## Installation

Expand Down
1 change: 0 additions & 1 deletion boondmanager/api/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class Actions(DefaultEndpointMixin, BaseClient):
list_uri = '/actions'
single_uri = '/actions/{}'
tabs = ['rights', 'attached-flags']
list_uri = '/actions'


class ActionsTemplates(BaseClient):
Expand Down
9 changes: 4 additions & 5 deletions boondmanager/api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class BaseClient:
query_params = None
_domain = None

def __init__(self, basic_auth=None, jwt_app=None, jwt_client=None, resource_id=None, domain=None):
def __init__(self, *, basic_auth=None, jwt_app=None, jwt_client=None, resource_id=None, domain=None):
self.client = requests
self.resource_id = resource_id
if basic_auth:
Expand Down Expand Up @@ -184,7 +184,7 @@ def _set_headers(self):
if self.jwt_client:
self.headers['X-Jwt-Client-Boondmanager'] = self.jwt_client

def request(self, method, resource_id=None, post_data=None, tab_name=None, forced_uri=None):
def request(self, method, *, resource_id=None, post_data=None, tab_name=None, forced_uri=None):
"""
Make a request to the API

Expand All @@ -199,6 +199,7 @@ def request(self, method, resource_id=None, post_data=None, tab_name=None, force
if resource_id:
self.resource_id = resource_id
if post_data:
self.add_header('content-type', 'application/json')
self.post_data = post_data
session = self.client.Session()
url = self._make_url(self.resource_id, tab_name, forced_uri=forced_uri)
Expand Down Expand Up @@ -258,7 +259,6 @@ def post(self, data=None):

:param data: The data to send in the request (default: None)
"""
self.add_header('content-type', 'application/json')
return self.request('POST', post_data=data)

def post_tab(self, resource_id, tab_name, data=None):
Expand All @@ -268,8 +268,7 @@ def post_tab(self, resource_id, tab_name, data=None):
:param resource_id: The id of the content to work on
:param tab_name: The tab to use
"""
self.add_header('content-type', 'application/json')
return self.request('GET', resource_id=resource_id, tab_name=tab_name, post_data=data)
return self.request('POST', resource_id=resource_id, tab_name=tab_name, post_data=data)

def put(self, resource_id=None, data=None, tab_name=None):
"""
Expand Down
4 changes: 2 additions & 2 deletions boondmanager/api/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ class Flags(BaseClient):
>>> flags_client.delete(5)
"""
allowed_methods = ['GET', 'POST', 'DELETE', 'PUT']
single_uri = '/flags'
list_uri = '/flags/{}'
single_uri = '/flags/{}'
list_uri = '/flags'
4 changes: 2 additions & 2 deletions boondmanager/api/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Forms(BaseClient):
"""
allowed_methods = ['GET', 'PUT', 'POST', 'DELETE']
list_uri = '/forms'
list_uri = '/forms/{}'
single_uri = '/forms/{}'
tabs = ['remind', 'rights', 'tasks']


Expand All @@ -62,4 +62,4 @@ class FormsTemplates(BaseClient):
"""
allowed_methods = ['GET', 'PUT', 'POST', 'DELETE']
list_uri = '/forms/templates'
list_uri = '/forms/templates/{}'
single_uri = '/forms/templates/{}'
4 changes: 2 additions & 2 deletions boondmanager/api/invoices.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ class Invoices(DefaultEndpointMixin, BaseClient):
>>> invoices_client.get_default()
"""
allowed_methods = ['GET', 'POST', 'DELETE', 'PUT']
single_uri = '/invoices'
list_uri = '/invoices/{}'
list_uri = '/invoices'
single_uri = '/invoices/{}'
tabs = ['rights', 'information', 'attached-flags', 'actions', 'download', 'send', 'tasks']
4 changes: 2 additions & 2 deletions boondmanager/api/poles.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ class Poles(BaseClient):
>>> poles_client.delete(5)
"""
allowed_methods = ['GET', 'POST', 'DELETE', 'PUT']
single_uri = '/poles'
list_uri = '/poles/{}'
list_uri = '/poles'
single_uri = '/poles/{}'
4 changes: 2 additions & 2 deletions boondmanager/api/products.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ class Products(DefaultEndpointMixin, BaseClient):
>>> products_client.get_default()
"""
allowed_methods = ['GET', 'POST', 'DELETE', 'PUT']
single_uri = '/products'
list_uri = '/products/{}'
list_uri = '/products'
single_uri = '/products/{}'
tabs = ['rights', 'information', 'attached-flags', 'opportunities', 'projects', 'tasks']
4 changes: 2 additions & 2 deletions boondmanager/api/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Projects(BaseClient):
>>> projects_client.delete(5)
"""
allowed_methods = ['GET', 'POST', 'DELETE', 'PUT']
single_uri = '/projects'
list_uri = '/projects/{}'
list_uri = '/projects'
single_uri = '/projects/{}'
tabs = ['rights', 'information', 'attached-flags', 'batches-markers', 'actions', 'simulation',
'deliveries-groupments', 'advantages', 'purchases', 'productivity', 'orders', 'tasks']
4 changes: 2 additions & 2 deletions boondmanager/api/savedsearches.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ class SavedSearches(BaseClient):
>>> saved_searches_client.delete(5)
"""
allowed_methods = ['GET', 'POST', 'DELETE', 'PUT']
single_uri = '/savedsearches'
list_uri = '/savedsearches/{}'
list_uri = '/savedsearches'
single_uri = '/savedsearches/{}'
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
requests==2.27.1
requests==2.32.3
6 changes: 3 additions & 3 deletions requirements/doc.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Sphinx==5.3.0
Sphinx==8.1.3
sphinx_rtd_theme
myst-parser==0.18.1
sphinxcontrib-confluencebuilder==1.7.1
myst-parser==4.0.0
sphinxcontrib-confluencebuilder==2.8.0
6 changes: 3 additions & 3 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pytest==6.2.5
coverage==6.2
pytest-mock==3.10.0
pytest==8.3.3
coverage==7.6.4
pytest-mock==3.14.0
Loading