diff --git a/.gitignore b/.gitignore index 0e442f3..7ca58a0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ __pycache__/ *.py[cod] *$py.class +*.pyc # Installer logs pip-log.txt diff --git a/voipms/api/__init__.py b/voipms/api/__init__.py index ece95d7..9451b08 100644 --- a/voipms/api/__init__.py +++ b/voipms/api/__init__.py @@ -102,4 +102,32 @@ class Client(object): @property def registration_status(self): - return self.accounts.registration_status \ No newline at end of file + 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 \ No newline at end of file diff --git a/voipms/api/accounts/subaccount.py b/voipms/api/accounts/subaccount.py index ebddd69..7fe45c5 100644 --- a/voipms/api/accounts/subaccount.py +++ b/voipms/api/accounts/subaccount.py @@ -13,4 +13,8 @@ class Subaccount(): def fetch(self, params={}): self.method = "getSubAccounts" + return self.base.request(self.method, params=params) + + def set(self, params={}): + self.method = "setSubAccount" return self.base.request(self.method, params=params) \ No newline at end of file diff --git a/voipms/api/call_detail_records/__init__.py b/voipms/api/call_detail_records/__init__.py index ba6e4c7..48a7da6 100644 --- a/voipms/api/call_detail_records/__init__.py +++ b/voipms/api/call_detail_records/__init__.py @@ -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(): def __init__(self, base): - self.base = base \ No newline at end of file + 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 \ No newline at end of file diff --git a/voipms/api/call_detail_records/billing.py b/voipms/api/call_detail_records/billing.py new file mode 100644 index 0000000..3b86e41 --- /dev/null +++ b/voipms/api/call_detail_records/billing.py @@ -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) \ No newline at end of file diff --git a/voipms/api/call_detail_records/rates.py b/voipms/api/call_detail_records/rates.py new file mode 100644 index 0000000..cf778bb --- /dev/null +++ b/voipms/api/call_detail_records/rates.py @@ -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) \ No newline at end of file diff --git a/voipms/api/call_detail_records/records.py b/voipms/api/call_detail_records/records.py new file mode 100644 index 0000000..b221340 --- /dev/null +++ b/voipms/api/call_detail_records/records.py @@ -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) \ No newline at end of file diff --git a/voipms/api/call_detail_records/termination_rates.py b/voipms/api/call_detail_records/termination_rates.py new file mode 100644 index 0000000..377ac86 --- /dev/null +++ b/voipms/api/call_detail_records/termination_rates.py @@ -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) \ No newline at end of file diff --git a/voipms/api/dids/__init__.py b/voipms/api/dids/__init__.py index f53977b..49f57bd 100644 --- a/voipms/api/dids/__init__.py +++ b/voipms/api/dids/__init__.py @@ -1,5 +1,33 @@ +from voipms.api.dids.search import Search +from voipms.api.dids.sms import SMS class DIDs(): def __init__(self, base): + self._search = None + self._sms = None - self.base = base \ No newline at end of file + 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) \ No newline at end of file diff --git a/voipms/api/dids/search.py b/voipms/api/dids/search.py new file mode 100644 index 0000000..f1a2e6b --- /dev/null +++ b/voipms/api/dids/search.py @@ -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) \ No newline at end of file diff --git a/voipms/api/dids/sms.py b/voipms/api/dids/sms.py new file mode 100644 index 0000000..8d2c2b8 --- /dev/null +++ b/voipms/api/dids/sms.py @@ -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={}) \ No newline at end of file diff --git a/voipms/api/voicemail/__init__.py b/voipms/api/voicemail/__init__.py index 741dd7e..ff06e20 100644 --- a/voipms/api/voicemail/__init__.py +++ b/voipms/api/voicemail/__init__.py @@ -1,5 +1,28 @@ +from voipms.api.voicemail.messages import Messages class Voicemail(): def __init__(self, base): + self._messages = None + self.base = base - self.base = base \ No newline at end of file + @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) \ No newline at end of file diff --git a/voipms/api/voicemail/messages.py b/voipms/api/voicemail/messages.py new file mode 100644 index 0000000..7803ad5 --- /dev/null +++ b/voipms/api/voicemail/messages.py @@ -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) \ No newline at end of file diff --git a/voipms/version.py b/voipms/version.py deleted file mode 100644 index e69de29..0000000