brynq-sdk-nmbrs 1.3.3__tar.gz → 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/PKG-INFO +1 -1
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/__init__.py +13 -12
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/companies.py +1 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/debtors.py +2 -1
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/employees.py +16 -1
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs.egg-info/PKG-INFO +1 -1
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs.egg-info/requires.txt +1 -1
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/setup.py +2 -2
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/address.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/bank.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/children.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/contract.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/costcenter.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/costunit.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/department.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/document.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/employment.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/function.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/hours.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/salaries.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/salary_tables.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/schedules.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/schemas/__init__.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/schemas/address.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/schemas/bank.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/schemas/contracts.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/schemas/costcenter.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/schemas/costunit.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/schemas/department.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/schemas/employees.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/schemas/employment.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/schemas/function.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/schemas/hours.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/schemas/salary.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/schemas/schedules.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/schemas/wagecomponents.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs/wagecomponents.py +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs.egg-info/SOURCES.txt +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs.egg-info/dependency_links.txt +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs.egg-info/not-zip-safe +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs.egg-info/top_level.txt +0 -0
- {brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/setup.cfg +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import warnings
|
|
2
|
-
from typing import Union, List
|
|
2
|
+
from typing import Union, List, Literal, Optional
|
|
3
3
|
import re
|
|
4
4
|
import pandas as pd
|
|
5
5
|
import requests
|
|
@@ -23,10 +23,11 @@ from .hours import VariableHours, FixedHours
|
|
|
23
23
|
from .salaries import Salaries
|
|
24
24
|
from .schedules import Schedule
|
|
25
25
|
from .wagecomponents import EmployeeFixedWageComponents, EmployeeVariableWageComponents
|
|
26
|
+
import os
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
class Nmbrs(BrynQ):
|
|
29
|
-
def __init__(self,
|
|
30
|
+
def __init__(self, system_type: Optional[Literal['source', 'target']] = None, debug: bool = False, mock_mode: bool = True):
|
|
30
31
|
"""
|
|
31
32
|
Initialize the Nmbrs class.
|
|
32
33
|
|
|
@@ -38,10 +39,11 @@ class Nmbrs(BrynQ):
|
|
|
38
39
|
self.mock_mode = mock_mode
|
|
39
40
|
self.debug = debug
|
|
40
41
|
self.timeout = 3600
|
|
42
|
+
self.system_type = system_type
|
|
41
43
|
if mock_mode is False:
|
|
42
44
|
super().__init__()
|
|
43
|
-
self.
|
|
44
|
-
headers = self._get_request_headers(
|
|
45
|
+
self.data_interface_id = os.getenv("DATA_INTERFACE_ID")
|
|
46
|
+
headers = self._get_request_headers()
|
|
45
47
|
self.base_url = "https://api.nmbrsapp.com/api/"
|
|
46
48
|
self.session = requests.Session()
|
|
47
49
|
self.session.headers.update(headers)
|
|
@@ -64,7 +66,7 @@ class Nmbrs(BrynQ):
|
|
|
64
66
|
self.companies = Companies(self)
|
|
65
67
|
self.contract = Contract(self)
|
|
66
68
|
self.department = EmployeeDepartment(self)
|
|
67
|
-
self.company_ids = self.companies.get()['
|
|
69
|
+
self.company_ids = self.companies.get()['companyId']
|
|
68
70
|
self.soap_company_ids = self.companies.get_soap_ids()
|
|
69
71
|
self.employees = Employees(self)
|
|
70
72
|
self.employment = Employment(self)
|
|
@@ -80,14 +82,13 @@ class Nmbrs(BrynQ):
|
|
|
80
82
|
self.salary_scales = SalaryScales(self)
|
|
81
83
|
self.salary_steps = SalarySteps(self)
|
|
82
84
|
|
|
83
|
-
def _get_request_headers(self
|
|
84
|
-
|
|
85
|
-
credentials = self.refresh_system_credential(system='nmbrs', system_id=initial_credentials['id'])
|
|
85
|
+
def _get_request_headers(self):
|
|
86
|
+
credentials = self.interfaces.credentials.get(system='nmbrs', system_type=self.system_type)
|
|
86
87
|
headers = {
|
|
87
88
|
"accept": "application/json",
|
|
88
|
-
"Authorization": f"Bearer {credentials
|
|
89
|
+
"Authorization": f"Bearer {credentials.get('data').get('access_token')}",
|
|
89
90
|
# partner identifier
|
|
90
|
-
"X-Subscription-Key":
|
|
91
|
+
"X-Subscription-Key": credentials.get("custom_data").get("subscription_key")
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
return headers
|
|
@@ -99,7 +100,7 @@ class Nmbrs(BrynQ):
|
|
|
99
100
|
Returns:
|
|
100
101
|
AuthHeaderWithDomainType: The authentication header for SOAP requests
|
|
101
102
|
"""
|
|
102
|
-
initial_credentials = self.get_system_credential(system='nmbrs', label=
|
|
103
|
+
initial_credentials = self.get_system_credential(system='nmbrs', label='bob')
|
|
103
104
|
config = initial_credentials.get("config", {})
|
|
104
105
|
|
|
105
106
|
# Get the AuthHeaderWithDomain type from the WSDL
|
|
@@ -120,7 +121,7 @@ class Nmbrs(BrynQ):
|
|
|
120
121
|
while has_next_page:
|
|
121
122
|
prepped = request.prepare()
|
|
122
123
|
prepped.headers.update(self.session.headers)
|
|
123
|
-
resp = self.session.send(prepped, timeout=self.
|
|
124
|
+
resp = self.session.send(prepped, timeout=self.timeout)
|
|
124
125
|
resp.raise_for_status()
|
|
125
126
|
response_data = resp.json()
|
|
126
127
|
result_data += response_data['data']
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import pandas as pd
|
|
2
2
|
import requests
|
|
3
|
+
from pydantic import BaseModel
|
|
4
|
+
|
|
3
5
|
from brynq_sdk_functions import Functions
|
|
4
6
|
from typing import Dict, Any, Optional
|
|
5
7
|
|
|
@@ -87,7 +89,20 @@ class Employees:
|
|
|
87
89
|
Response from the API
|
|
88
90
|
"""
|
|
89
91
|
# Validate with Pydantic model
|
|
90
|
-
|
|
92
|
+
def nest_dict(flat_dict, model):
|
|
93
|
+
nested = {}
|
|
94
|
+
for name, field in model.model_fields.items():
|
|
95
|
+
key_in_input = name # Original model field name as key in flat_dict
|
|
96
|
+
alias = field.alias or name
|
|
97
|
+
if isinstance(field.annotation, type) and issubclass(field.annotation, BaseModel):
|
|
98
|
+
nested[alias] = nest_dict(flat_dict, field.annotation)
|
|
99
|
+
else:
|
|
100
|
+
if key_in_input in flat_dict:
|
|
101
|
+
nested[alias] = flat_dict[key_in_input]
|
|
102
|
+
return nested
|
|
103
|
+
|
|
104
|
+
nested_data = nest_dict(data, EmployeeCreate)
|
|
105
|
+
employee_model = EmployeeCreate(**nested_data)
|
|
91
106
|
|
|
92
107
|
if self.nmbrs.mock_mode:
|
|
93
108
|
return employee_model
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_namespace_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name='brynq_sdk_nmbrs',
|
|
5
|
-
version='
|
|
5
|
+
version='2.0.0',
|
|
6
6
|
description='Nmbrs wrapper from BrynQ',
|
|
7
7
|
long_description='Nmbrs wrapper from BrynQ',
|
|
8
8
|
author='BrynQ',
|
|
@@ -10,7 +10,7 @@ setup(
|
|
|
10
10
|
packages=find_namespace_packages(include=['brynq_sdk*']),
|
|
11
11
|
license='BrynQ License',
|
|
12
12
|
install_requires=[
|
|
13
|
-
'brynq-sdk-brynq>=
|
|
13
|
+
'brynq-sdk-brynq>=4,<5',
|
|
14
14
|
'pandas>=2.2.0,<3.0.0',
|
|
15
15
|
'pydantic>=2.5.0,<3.0.0',
|
|
16
16
|
'pandera>=0.16.0,<1.0.0',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{brynq_sdk_nmbrs-1.3.3 → brynq_sdk_nmbrs-2.0.0}/brynq_sdk_nmbrs.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|