Skip to content

Commit da9c727

Browse files
Add timezone (#10)
* Add timezone * fix account type * add RoutingPlan
1 parent cd34ed7 commit da9c727

File tree

7 files changed

+62
-4
lines changed

7 files changed

+62
-4
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
11+
python-version: ['3.8', '3.9', '3.10', '3.11']
1212

1313
steps:
1414
- uses: actions/checkout@v2

yeti_switch_api/orm/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from .numberlist import Numberlist # noqa: F401
1414
from .numberlist_item import NumberlistItem # noqa: F401
1515
from .rateplan import Rateplan # noqa: F401
16+
from .routing_plan import RoutingPlan # noqa: F401
1617
from .routing_tag import RoutingTag # noqa: F401
1718

1819
from .gateway import Gateway # noqa: F401
@@ -23,3 +24,4 @@
2324
from .country import Country # noqa: F401
2425
from .network import Network # noqa: F401
2526
from .network_type import NetworkType # noqa: F401
27+
from .timezone import Timezone # noqa: F401

yeti_switch_api/orm/account.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
class Account(BaseModel):
55
class Meta:
66
path = "accounts"
7-
type = "account"
7+
type = "accounts"
88

99
contractor = RelationField("contractor")
10+
timezone = RelationField("timezone")
1011

1112
name = AttributeField("name")
1213
balance = AttributeField("balance")
1314
min_balance = AttributeField("min-balance")
1415
max_balance = AttributeField("max-balance")
1516

1617
def creatable_fields(self):
17-
return ["contractor", "min_balace", "max_balance"]
18+
return ["name", "contractor", "timezone", "min-balance", "max-balance"]

yeti_switch_api/orm/customers_auth.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,34 @@ class Meta:
77
type = "customers-auths"
88

99
name = AttributeField("name")
10-
src_numberlist = RelationField("src_numberlist")
10+
enabled = AttributeField("enabled")
11+
src_numberlist = RelationField("src-numberlist")
12+
dst_numberlist = RelationField("dst-numberlist")
13+
customer = RelationField("customer")
14+
account = RelationField("account")
15+
rateplan = RelationField("rateplan")
16+
routing_plan = RelationField("routing-plan")
17+
gateway = RelationField("gateway")
18+
pop = RelationField("pop")
19+
ip = AttributeField("ip")
20+
src_prefix = AttributeField("src-prefix")
21+
dst_prefix = AttributeField("dst-prefix")
22+
x_yeti_auth = AttributeField("x-yeti-auth")
23+
24+
def creatable_fields(self):
25+
return [
26+
"name",
27+
"enabled",
28+
"src-numberlist",
29+
"dst-numberlist",
30+
"customer",
31+
"account",
32+
"rateplan",
33+
"routing-plan",
34+
"gateway",
35+
"pop",
36+
"ip",
37+
"src-prefix",
38+
"dst-prefix",
39+
"x-yeti-auth",
40+
]

yeti_switch_api/orm/orm_client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from .numberlist import Numberlist
1717
from .numberlist_item import NumberlistItem
1818
from .rateplan import Rateplan
19+
from .routing_plan import RoutingPlan
1920
from .routing_tag import RoutingTag
2021

2122
from .gateway import Gateway
@@ -26,6 +27,7 @@
2627
from .country import Country
2728
from .network import Network
2829
from .network_type import NetworkType
30+
from .timezone import Timezone
2931

3032

3133
class OrmClient:
@@ -55,6 +57,7 @@ def __register_models(cls):
5557
cls.__register_model(Numberlist)
5658
cls.__register_model(NumberlistItem)
5759
cls.__register_model(Rateplan)
60+
cls.__register_model(RoutingPlan)
5861
cls.__register_model(RoutingTag)
5962
cls.__register_model(Gateway)
6063
cls.__register_model(GatewayGroup)
@@ -63,6 +66,7 @@ def __register_models(cls):
6366
cls.__register_model(Country)
6467
cls.__register_model(Network)
6568
cls.__register_model(NetworkType)
69+
cls.__register_model(Timezone)
6670

6771
@classmethod
6872
def __register_model(cls, model_class):
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from .base_model import BaseModel, AttributeField
2+
3+
4+
class RoutingPlan(BaseModel):
5+
class Meta:
6+
path = "routing-plans"
7+
type = "routing-plans"
8+
9+
name = AttributeField("name")
10+
rate_delta_max = AttributeField("rate-delta-max")
11+
use_lnp = AttributeField("use-lnp")
12+
max_rerouting_attempts = AttributeField("max-rerouting-attempts")

yeti_switch_api/orm/timezone.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from .base_model import BaseModel, AttributeField
2+
3+
4+
class Timezone(BaseModel):
5+
class Meta:
6+
path = "timezones"
7+
type = "timezones"
8+
9+
name = AttributeField("name")

0 commit comments

Comments
 (0)