Skip to content

Commit 77cf0e9

Browse files
author
Robert Segal
committed
Added accounts erp links endpoints
1 parent 7938167 commit 77cf0e9

4 files changed

Lines changed: 84 additions & 0 deletions

File tree

mpt_api_client/resources/accounts/accounts.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from mpt_api_client.http import AsyncHTTPClient, HTTPClient
22
from mpt_api_client.resources.accounts.account import AccountsService, AsyncAccountsService
3+
from mpt_api_client.resources.accounts.erp_links import AsyncErpLinksService, ErpLinksService
34
from mpt_api_client.resources.accounts.licensees import AsyncLicenseesService, LicenseesService
45
from mpt_api_client.resources.accounts.sellers import AsyncSellersService, SellersService
56
from mpt_api_client.resources.accounts.users import AsyncUsersService, UsersService
@@ -31,6 +32,11 @@ def licensees(self) -> LicenseesService:
3132
"""Licensees service."""
3233
return LicenseesService(http_client=self.http_client)
3334

35+
@property
36+
def erp_links(self) -> ErpLinksService:
37+
"""ERP Links service."""
38+
return ErpLinksService(http_client=self.http_client)
39+
3440

3541
class AsyncAccounts:
3642
"""Async Accounts MPT API Module."""
@@ -57,3 +63,8 @@ def sellers(self) -> AsyncSellersService:
5763
def licensees(self) -> AsyncLicenseesService:
5864
"""Licensees service."""
5965
return AsyncLicenseesService(http_client=self.http_client)
66+
67+
@property
68+
def erp_links(self) -> AsyncErpLinksService:
69+
"""ERP Links service."""
70+
return AsyncErpLinksService(http_client=self.http_client)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
from mpt_api_client.http import AsyncService, Service
2+
from mpt_api_client.http.mixins import (
3+
AsyncCreateMixin,
4+
AsyncUpdateMixin,
5+
CreateMixin,
6+
UpdateMixin,
7+
)
8+
from mpt_api_client.models import Model
9+
from mpt_api_client.resources.accounts.mixins import AsyncBlockableMixin, BlockableMixin
10+
11+
12+
class ErpLink(Model):
13+
"""ERP Link Model."""
14+
15+
16+
class ErpLinksServiceConfig:
17+
"""ERP Links Service Configuration."""
18+
19+
_endpoint = "/public/v1/accounts/erp-links"
20+
_model_class = ErpLink
21+
_collection_key = "data"
22+
23+
24+
class ErpLinksService(
25+
CreateMixin[ErpLink],
26+
UpdateMixin[ErpLink],
27+
BlockableMixin[ErpLink],
28+
Service[ErpLink],
29+
ErpLinksServiceConfig,
30+
):
31+
"""ERP Links Service."""
32+
33+
34+
class AsyncErpLinksService(
35+
AsyncCreateMixin[ErpLink],
36+
AsyncUpdateMixin[ErpLink],
37+
AsyncBlockableMixin[ErpLink],
38+
AsyncService[ErpLink],
39+
ErpLinksServiceConfig,
40+
):
41+
"""Async ERP Links Service."""

tests/resources/accounts/test_accounts.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from mpt_api_client.resources.accounts.account import AccountsService, AsyncAccountsService
44
from mpt_api_client.resources.accounts.accounts import Accounts, AsyncAccounts
5+
from mpt_api_client.resources.accounts.erp_links import AsyncErpLinksService, ErpLinksService
56
from mpt_api_client.resources.accounts.licensees import AsyncLicenseesService, LicenseesService
67
from mpt_api_client.resources.accounts.sellers import AsyncSellersService, SellersService
78
from mpt_api_client.resources.accounts.users import AsyncUsersService, UsersService
@@ -24,6 +25,7 @@ def async_accounts(async_http_client):
2425
("users", UsersService),
2526
("sellers", SellersService),
2627
("licensees", LicenseesService),
28+
("erp_links", ErpLinksService),
2729
],
2830
)
2931
def test_accounts_properties(accounts, property_name, expected_service_class):
@@ -41,6 +43,7 @@ def test_accounts_properties(accounts, property_name, expected_service_class):
4143
("users", AsyncUsersService),
4244
("sellers", AsyncSellersService),
4345
("licensees", AsyncLicenseesService),
46+
("erp_links", AsyncErpLinksService),
4447
],
4548
)
4649
def test_async_accounts_properties(async_accounts, property_name, expected_service_class):
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import pytest
2+
3+
from mpt_api_client.resources.accounts.erp_links import AsyncErpLinksService, ErpLinksService
4+
5+
6+
@pytest.fixture
7+
def erp_links_service(http_client):
8+
return ErpLinksService(http_client=http_client)
9+
10+
11+
@pytest.fixture
12+
def async_erp_links_service(async_http_client):
13+
return AsyncErpLinksService(http_client=async_http_client)
14+
15+
16+
@pytest.mark.parametrize(
17+
"method",
18+
["get", "create", "update", "block", "unblock"],
19+
)
20+
def test_mixins_present(erp_links_service, method):
21+
assert hasattr(erp_links_service, method)
22+
23+
24+
@pytest.mark.parametrize(
25+
"method",
26+
["get", "create", "update", "block", "unblock"],
27+
)
28+
def test_async_mixins_present(async_erp_links_service, method):
29+
assert hasattr(async_erp_links_service, method)

0 commit comments

Comments
 (0)