Skip to content

Commit fdb7d2b

Browse files
Add more API objects. Switch to new API format (#8)
* add more API objects * switch to new API format
1 parent 23ef0c0 commit fdb7d2b

25 files changed

+150
-44
lines changed

yeti_switch_api/orm/__init__.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,25 @@
11
from .orm_client import OrmClient # noqa: F401
22
from .contractor import Contractor # noqa: F401
3+
from .contact import Contact # noqa: F401
4+
from .account import Account # noqa: F401
5+
from .invoice import Invoice # noqa: F401
6+
from .invoice_originated_destination import InvoiceOriginatedDestination # noqa: F401
7+
from .invoice_originated_network import InvoiceOriginatedNetwork # noqa: F401
8+
from .invoice_terminated_destination import InvoiceTerminatedDestination # noqa: F401
9+
from .invoice_terminated_network import InvoiceTerminatedNetwork # noqa: F401
10+
11+
from .customers_auth import CustomersAuth # noqa: F401
12+
from .dialpeer import Dialpeer # noqa: F401
13+
from .numberlist import Numberlist # noqa: F401
14+
from .numberlist_item import NumberlistItem # noqa: F401
15+
from .rateplan import Rateplan # noqa: F401
16+
from .routing_tag import RoutingTag # noqa: F401
17+
18+
from .gateway import Gateway # noqa: F401
19+
from .gateway_group import GatewayGroup # noqa: F401
20+
21+
from .pop import Pop # noqa: F401
22+
from .smtp_connection import SmtpConnection # noqa: F401
23+
from .country import Country # noqa: F401
24+
from .network import Network # noqa: F401
25+
from .network_type import NetworkType # noqa: F401

yeti_switch_api/orm/account.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from ..base_model import BaseModel, AttributeField, RelationField
2+
3+
4+
class Account(BaseModel):
5+
class Meta:
6+
path = "accounts"
7+
type = "account"
8+
9+
contractor = RelationField("contractor")
10+
11+
name = AttributeField("name")
12+
balance = AttributeField("balance")
13+
min_balance = AttributeField("min-balance")
14+
max_balance = AttributeField("max-balance")
15+
16+
def creatable_fields(self):
17+
return ["contractor", "min_balace", "max_balance"]

yeti_switch_api/orm/billing/__init__.py

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class Contact(BaseModel):
55
class Meta:
6-
path = "billing/contacts"
6+
path = "contacts"
77
type = "contacts"
88

99
name = AttributeField("name")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class Country(BaseModel):
55
class Meta:
6-
path = "system/countries"
6+
path = "countries"
77
type = "countries"
88

99
name = AttributeField("name")
File renamed without changes.

yeti_switch_api/orm/gateway.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
from ..base_model import BaseModel, AttributeField, RelationField
2+
3+
4+
class Gateway(BaseModel):
5+
class Meta:
6+
path = "gateways"
7+
type = "gateways"
8+
9+
contractor = RelationField("contractor")
10+
gateway_group = RelationField("gateway-group")
11+
pop = RelationField("pop")
12+
13+
name = AttributeField("name")
14+
enabled = AttributeField("enabled")
15+
priority = AttributeField("priority")
16+
weight = AttributeField("weight")
17+
allow_origination = AttributeField("allow-origination")
18+
allow_termination = AttributeField("allow-termination")
19+
host = AttributeField("host")
20+
port = AttributeField("port")
21+
registered_aor_mode = AttributeField("registered-aor-mode-id")
22+
23+
REGISTERED_AOR_MODE_DISABLE = 1
24+
REGISTERED_AOR_MODE_AS_IS = 2
25+
REGISTERED_AOR_MODE_REPLACE_USEPART = 3
26+
27+
def creatable_fields(self):
28+
return [
29+
"contractor",
30+
"gateway-group",
31+
"pop",
32+
"name",
33+
"enabled",
34+
"priority",
35+
"weight",
36+
"allow-origination",
37+
"allow-termination",
38+
"host",
39+
"port",
40+
"registered-aor-mode-id",
41+
]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from ..base_model import BaseModel, AttributeField, RelationField
2+
3+
4+
class GatewayGroup(BaseModel):
5+
class Meta:
6+
path = "gateway-groups"
7+
type = "gateway-groups"
8+
9+
vendor = RelationField("vendor")
10+
11+
name = AttributeField("name")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class Invoice(BaseModel):
55
class Meta:
6-
path = "billing/invoices"
6+
path = "invoices"
77
type = "invoices"
88

99
account = RelationField("account")

0 commit comments

Comments
 (0)