added more endpoints, probably done adding more for now as majority of other endpoints are for resellers

This commit is contained in:
Daniel Tesfai 2019-09-03 16:21:52 -04:00
parent 7144b41c63
commit 98d2f202fb
14 changed files with 188 additions and 4 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@
__pycache__/ __pycache__/
*.py[cod] *.py[cod]
*$py.class *$py.class
*.pyc
# Installer logs # Installer logs
pip-log.txt pip-log.txt

View File

@ -103,3 +103,31 @@ class Client(object):
@property @property
def registration_status(self): def registration_status(self):
return self.accounts.registration_status return self.accounts.registration_status
@property
def billing(self):
return self.call_detail_records.billing
@property
def records(self):
return self.call_detail_records.records
@property
def rates(self):
return self.call_detail_records.rates
@property
def termination_rates(self):
return self.call_detail_records.termination_rates
@property
def search(self):
return self.dids.search
@property
def sms(self):
return self.dids.sms
@property
def messages(self):
return self.voicemail.messages

View File

@ -14,3 +14,7 @@ class Subaccount():
def fetch(self, params={}): def fetch(self, params={}):
self.method = "getSubAccounts" self.method = "getSubAccounts"
return self.base.request(self.method, params=params) return self.base.request(self.method, params=params)
def set(self, params={}):
self.method = "setSubAccount"
return self.base.request(self.method, params=params)

View File

@ -1,5 +1,37 @@
from voipms.api.call_detail_records.billing import Billing
from voipms.api.call_detail_records.records import Records
from voipms.api.call_detail_records.rates import Rates
from voipms.api.call_detail_records.termination_rates import TerminationRates
class CallDetailRecords(): class CallDetailRecords():
def __init__(self, base): def __init__(self, base):
self.base = base self.base = base
self._billing = None
self._records = None
self._rates = None
self._termination_rates = None
@property
def billing(self):
if self._billing is None:
self._billing = Billing(self.base)
return self._billing
@property
def records(self):
if self._records is None:
self._records = Records(self.base)
return self._records
@property
def rates(self):
if self._rates is None:
self._rates = Rates(self.base)
return self._rates
@property
def termination_rates(self):
if self._termination_rates is None:
self._termination_rates = TerminationRates(self.base)
return self._termination_rates

View File

@ -0,0 +1,7 @@
class Billing():
def __init__(self, base):
self.method = "getCallBilling"
self.base = base
def fetch(self, params={}):
return self.base.request(self.method, params=params)

View File

@ -0,0 +1,7 @@
class Rates():
def __init__(self, base):
self.method = "getRates"
self.base = base
def fetch(self, params={}):
return self.base.request(self.method, params=params)

View File

@ -0,0 +1,7 @@
class Records():
def __init__(self, base):
self.method = "getCDR"
self.base = base
def fetch(self, params={}):
return self.base.request(self.method, params=params)

View File

@ -0,0 +1,7 @@
class TerminationRates():
def __init__(self, base):
self.method = "getTerminationRates"
self.base = base
def fetch(self, params={}):
return self.base.request(self.method, params=params)

View File

@ -1,5 +1,33 @@
from voipms.api.dids.search import Search
from voipms.api.dids.sms import SMS
class DIDs(): class DIDs():
def __init__(self, base): def __init__(self, base):
self._search = None
self._sms = None
self.base = base self.base = base
@property
def search(self):
if self._search is None:
self._search = Search(self.base)
return self._search
@property
def sms(self):
if self._sms is None:
self._sms = SMS(self.base)
return self._sms
def cancel(self, params={}):
self.method = "cancelDID"
return self.base.request(self.method, params=params)
def order(self, params={}):
self.method = "orderDID"
return self.base.request(self.method, params=params)
def fetch(self, params={}):
self.method = "getDIDsInfo"
return self.base.request(self.method, params=params)

12
voipms/api/dids/search.py Normal file
View File

@ -0,0 +1,12 @@
class Search():
def __init__(self, base):
self.method = ""
self.base = base
def canada(self, params={}):
self.method = "searchDIDsCAN"
return self.base.request(self.method, params=params)
def usa(self, params={}):
self.method = "searchDIDsUSA"
return self.base.request(self.method, params=params)

16
voipms/api/dids/sms.py Normal file
View File

@ -0,0 +1,16 @@
class SMS():
def __init__(self, base):
self.method = ""
self.base = base
def fetch(self, params={}):
self.method = "getSMS"
return self.base.request(self.method, params=params)
def create(self, params={}):
self.method = "sendSMS"
return self.base.request(self.method, params=params)
def set(self, params={}):
self.method = "setSMS"
return self.base.request(self.method, params={})

View File

@ -1,5 +1,28 @@
from voipms.api.voicemail.messages import Messages
class Voicemail(): class Voicemail():
def __init__(self, base): def __init__(self, base):
self._messages = None
self.base = base self.base = base
@property
def messages(self):
if self._messages is None:
self._messages = Messages(self.base)
return self._messages
def create(self, params={}):
self.method = "createVoicemail"
return self.base.request(self.method, params=params)
def delete(self, params={}):
self.method = "delVoicemail"
return self.base.request(self.method, params=params)
def fetch(self, params={}):
self.method = "getVoicemails"
return self.base.request(self.method, params=params)
def set(self, params={}):
self.method = "setVoicemail"
return self.base.request(self.method, params=params)

View File

@ -0,0 +1,12 @@
class Messages():
def __init__(self, base):
self.method = ""
self.base = base
def fetch(self, params={}):
self.method = "getVoicemailMessages"
return self.base.request(self.method, params=params)
def delete(self, params={}):
self.method = "delMessages"
return self.base.request(self.method, params=params)

View File