Skip to content

Commit

Permalink
change paths
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-sinina committed Dec 3, 2024
1 parent de29f2c commit b9c3a70
Show file tree
Hide file tree
Showing 26 changed files with 72 additions and 50 deletions.
24 changes: 24 additions & 0 deletions yeti_switch_api/orm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,26 @@
from .orm_client import OrmClient # noqa: F401
from .contractor import Contractor # noqa: F401
from .contact import Contact # noqa: F401
from .account import Account # noqa: F401
from .invoice import Invoice # noqa: F401
from .invoice_originated_destination import InvoiceOriginatedDestination # noqa: F401
from .invoice_originated_network import InvoiceOriginatedNetwork # noqa: F401
from .invoice_terminated_destination import InvoiceTerminatedDestination # noqa: F401
from .invoice_terminated_network import InvoiceTerminatedNetwork # noqa: F401

from .customer_auth import CustomersAuth # noqa: F401
from .dialpeer import Dialpeer # noqa: F401
from .numberlist import Numberlist # noqa: F401
from .numberlist_item import NumberlistItem # noqa: F401
from .rateplan import Rateplan # noqa: F401
from .routing_tag import RoutingTag # noqa: F401

from .gateway import Gateway # noqa: F401
from .gateway_group import GatewayGroup # noqa: F401

from .pop import Pop # noqa: F401
from .smtp_connection import SmtpConnection # noqa: F401
from .country import Country # noqa: F401
from .network import Network # noqa: F401
from .network_type import NetworkType # noqa: F401

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class Account(BaseModel):
class Meta:
path = "billing/accounts"
path = "accounts"
type = "account"

contractor = RelationField("contractor")
Expand Down
7 changes: 0 additions & 7 deletions yeti_switch_api/orm/billing/__init__.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class Contact(BaseModel):
class Meta:
path = "billing/contacts"
path = "contacts"
type = "contacts"

name = AttributeField("name")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class Country(BaseModel):
class Meta:
path = "system/countries"
path = "countries"
type = "countries"

name = AttributeField("name")
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions yeti_switch_api/orm/equipment/__init__.py

This file was deleted.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class Invoice(BaseModel):
class Meta:
path = "billing/invoices"
path = "invoices"
type = "invoices"

account = RelationField("account")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class InvoiceOriginatedDestination(BaseModel):
class Meta:
path = "billing/invoice-originated-destinations"
path = "invoice-originated-destinations"
type = "invoice-originated-destinations"

invoice = RelationField("invoice")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class InvoiceOriginatedNetwork(BaseModel):
class Meta:
path = "billing/invoice-originated-networks"
path = "invoice-originated-networks"
type = "invoice-originated-networks"

invoice = RelationField("invoice")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class InvoiceTerminatedDestination(BaseModel):
class Meta:
path = "billing/invoice-terminated-destinations"
path = "invoice-terminated-destinations"
type = "invoice-terminated-destinations"

invoice = RelationField("invoice")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class InvoiceTerminatedNetwork(BaseModel):
class Meta:
path = "billing/invoice-terminated-networks"
path = "invoice-terminated-networks"
type = "invoice-terminated-networks"

invoice = RelationField("invoice")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class Network(BaseModel):
class Meta:
path = "system/networks"
path = "networks"
type = "networks"

name = AttributeField("name")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class NetworkType(BaseModel):
class Meta:
path = "system/network-types"
path = "network-types"
type = "network-types"

name = AttributeField("name")
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class Numberlist(BaseModel):
class Meta:
path = "routing/numberlists"
path = "numberlists"
type = "numberlists"

name = AttributeField("name")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class NumberlistItem(BaseModel):
class Meta:
path = "routing/numberlist-items"
path = "numberlist-items"
type = "numberlist-items"

key = AttributeField("key")
Expand Down
48 changes: 33 additions & 15 deletions yeti_switch_api/orm/orm_client.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@
from jsonapi_requests.orm import OrmApi

from ..common import build_client_config
from .routing import Rateplan, RoutingTag
from .billing import (
Contact,
Account,
Invoice,
InvoiceOriginatedDestination,
InvoiceOriginatedNetwork,
InvoiceTerminatedDestination,
InvoiceTerminatedNetwork,
)

from .contractor import Contractor
from .equipment import Gateway, GatewayGroup
from .system import SmtpConnection, Country, Network, NetworkType
from .contact import Contact
from .account import Account
from .invoice import Invoice
from .invoice_originated_destination import InvoiceOriginatedDestination
from .invoice_originated_network import InvoiceOriginatedNetwork
from .invoice_terminated_destination import InvoiceTerminatedDestination
from .invoice_terminated_network import InvoiceTerminatedNetwork

from .customer_auth import CustomersAuth
from .dialpeer import Dialpeer
from .numberlist import Numberlist
from .numberlist_item import NumberlistItem
from .rateplan import Rateplan
from .routing_tag import RoutingTag

from .gateway import Gateway
from .gateway_group import GatewayGroup

from .pop import Pop
from .smtp_connection import SmtpConnection
from .country import Country
from .network import Network
from .network_type import NetworkType



class OrmClient:
Expand All @@ -38,14 +51,19 @@ def __register_models(cls):
cls.__register_model(InvoiceOriginatedNetwork)
cls.__register_model(InvoiceTerminatedDestination)
cls.__register_model(InvoiceTerminatedNetwork)
cls.__register_model(CustomerAuth)
cls.__register_model(Dialpeer)
cls.__register_model(Numberlist)
cls.__register_model(NumberlistItem)
cls.__register_model(Rateplan)
cls.__register_model(RoutingTag)
cls.__register_model(Gateway)
cls.__register_model(GatewayGroup)
cls.__register_model(Pop)
cls.__register_model(SmtpConnection)
cls.__register_model(Country)
cls.__register_model(Network)
cls.__register_model(NetworkType)
cls.__register_model(Rateplan)
cls.__register_model(RoutingTag)
cls.__register_model(SmtpConnection)

@classmethod
def __register_model(cls, model_class):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class Rateplan(BaseModel):
class Meta:
path = "routing/rateplans"
path = "rateplans"
type = "rateplans"

name = AttributeField("name")
Expand Down
6 changes: 0 additions & 6 deletions yeti_switch_api/orm/routing/__init__.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class RoutingTag(BaseModel):
class Meta:
path = "routing/routing-tags"
path = "routing-tags"
type = "routing-tags"

name = AttributeField("name")
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class SmtpConnection(BaseModel):
class Meta:
path = "system/smtp-connections"
path = "smtp-connections"
type = "smtp-connections"

name = AttributeField("name")
Expand Down
5 changes: 0 additions & 5 deletions yeti_switch_api/orm/system/__init__.py

This file was deleted.

0 comments on commit b9c3a70

Please sign in to comment.