-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fdda51d
commit c33a927
Showing
6 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from .wilayah import Wilayah | ||
|
||
from .base import BaseCustomrest | ||
|
||
__all__ = ["BaseCustomrest", "Wilayah"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from typing import List | ||
|
||
from dapodik.base import BaseDapodik | ||
from dapodik.utils.helper import cached | ||
|
||
from . import Wilayah | ||
|
||
|
||
class BaseCustomrest(BaseDapodik): | ||
@cached("kecamatan") | ||
def kecamatan( | ||
self, query: str, page: int = 1, start: int = 0, limit: int = 50 | ||
) -> List[Wilayah]: | ||
return self._get_rest( | ||
"kecamatan", | ||
List[Wilayah], | ||
page, | ||
start, | ||
limit, | ||
query=self._query(query=query), | ||
prefix="customrest/", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import attr | ||
from datetime import datetime | ||
from typing import Optional | ||
|
||
|
||
@attr.dataclass(frozen=True, slots=True) | ||
class Wilayah: | ||
kode_wilayah: str | ||
nama: str | ||
id_level_wilayah: int | ||
mst_kode_wilayah: str | ||
negara_id: str | ||
asal_wilayah: str | ||
kode_bps: str | ||
kode_dagri: str | ||
kode_keu: str | ||
id_prov: Optional[int] | ||
id_kabkota: Optional[int] | ||
id_kec: Optional[int] | ||
a_desa: int | ||
a_kelurahan: int | ||
a_35: int | ||
a_urban: int | ||
kategori_desa_id: Optional[int] | ||
create_date: datetime | ||
last_update: datetime | ||
expired_date: Optional[datetime] | ||
last_sync: datetime | ||
nama_kabupaten: str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import attr | ||
|
||
from dapodik.base import BaseDapodik | ||
from dapodik.customrest import BaseCustomrest | ||
from dapodik.customrest import Wilayah | ||
|
||
|
||
def test_base_customresr(): | ||
assert issubclass(BaseCustomrest, BaseDapodik) | ||
|
||
|
||
def test_member(): | ||
assert attr.has(Wilayah) |