Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SWI-5401 Rename it to bandwidth_numbers from iris_sdk #3

Merged
merged 3 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Needed tools

- Python 3.5
- Python >=3.7
- pip

## Requires
Expand All @@ -11,30 +11,28 @@
- requests

## Install
```console
pip install -e git+https://github.com/bandwidthcom/python-bandwidth-iris#egg=iris_sdk
```sh
pip install bandwidth-numbers-sdk
```

## Testing

Tests require the *mock* and *requests_mock* packages. You can install them
with

```console
pip install -r requirements.txt
```sh
pip install -r test-requirements.txt
```
The tests can be run by issuing
```console
python -m unittest discover
```sh
pytest
```

## Usage

```python
from iris_sdk import Account, Client
```
from bandwidth_numbers import Account, Client

```python
client = Client(url="https://dashboard.bandwidth.com/api", account_id=123456, username="foo",
password="bar")
```
Expand Down Expand Up @@ -124,7 +122,7 @@ account.available_npa_nxx.list({"state": "NJ"})
### Cities

```python
from iris_sdk import Cities
from bandwidth_numbers import Cities

cities = Cities(client=client)
cities.list({"state": "NC"})
Expand All @@ -133,7 +131,7 @@ cities.list({"state": "NC"})
### Covered rate centers

```python
from iris_sdk import CoveredRateCenters
from bandwidth_numbers import CoveredRateCenters

rate_centers = CoveredRateCenters(client=client)
rate_centers.list({"page": 1, "size": 10})
Expand Down Expand Up @@ -421,7 +419,7 @@ portin.loas.metadata.delete()
### Rate Centers

```python
from iris_sdk import RateCenters
from bandwidth_numbers import RateCenters
rc = RateCenters(client=client)
centers = rc.list({"state": "CA", "available": "true"})
```
Expand Down Expand Up @@ -607,7 +605,7 @@ subscription.delete()
#### Getting a phone number

```python
from iris_sdk import Tns
from bandwidth_numbers import Tns

tns = Tns(client=client)
tn = tns.get(id)
Expand Down
11 changes: 11 additions & 0 deletions bandwidth_numbers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from bandwidth_numbers.client import Client
from bandwidth_numbers.models.account import Account
from bandwidth_numbers.models.cities import Cities
from bandwidth_numbers.models.covered_rate_centers import CoveredRateCenters
from bandwidth_numbers.models.rate_centers import RateCenters
from bandwidth_numbers.models.tns import Tns
from bandwidth_numbers.models.users import Users
from bandwidth_numbers.utils.rest import RestError

__all__ = ["Client", "Account", "Tns", "Users", "Cities", "RateCenters",
"RestError", "CoveredRateCenters", ]
4 changes: 2 additions & 2 deletions iris_sdk/client.py → bandwidth_numbers/client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python

from iris_sdk.utils.config import Config
from iris_sdk.utils.rest import RestClient
from bandwidth_numbers.utils.config import Config
from bandwidth_numbers.utils.rest import RestClient

class Client(object):

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@
from __future__ import division, absolute_import, print_function
from future.builtins import super

from iris_sdk.models.account_users import AccountUsers
from iris_sdk.models.available_npa_nxx import AvailableNpaNxx
from iris_sdk.models.available_numbers import AvailableNumbers
from iris_sdk.models.base_resource import BaseResource
from iris_sdk.models.data.account import AccountData
from iris_sdk.models.disc_numbers import DiscNumbers
from iris_sdk.models.disconnects import Disconnects
from iris_sdk.models.in_service_numbers import InServiceNumbers
from iris_sdk.models.line_option_orders import LineOptionOrder
from iris_sdk.models.import_tn_checker import ImportTnChecker
from iris_sdk.models.lnpchecker import LnpChecker
from iris_sdk.models.orders import Orders
from iris_sdk.models.lidbs import Lidbs
from iris_sdk.models.dldas import Dldas
from iris_sdk.models.subscriptions import Subscriptions
from iris_sdk.models.portins import PortIns
from iris_sdk.models.portouts import PortOuts
from iris_sdk.models.reservation import Reservation
from iris_sdk.models.site_hosts import SiteHosts
from iris_sdk.models.sites import Sites
from iris_sdk.models.tn_option_orders import TnOptionOrders
from bandwidth_numbers.models.account_users import AccountUsers
from bandwidth_numbers.models.available_npa_nxx import AvailableNpaNxx
from bandwidth_numbers.models.available_numbers import AvailableNumbers
from bandwidth_numbers.models.base_resource import BaseResource
from bandwidth_numbers.models.data.account import AccountData
from bandwidth_numbers.models.disc_numbers import DiscNumbers
from bandwidth_numbers.models.disconnects import Disconnects
from bandwidth_numbers.models.in_service_numbers import InServiceNumbers
from bandwidth_numbers.models.line_option_orders import LineOptionOrder
from bandwidth_numbers.models.import_tn_checker import ImportTnChecker
from bandwidth_numbers.models.lnpchecker import LnpChecker
from bandwidth_numbers.models.orders import Orders
from bandwidth_numbers.models.lidbs import Lidbs
from bandwidth_numbers.models.dldas import Dldas
from bandwidth_numbers.models.subscriptions import Subscriptions
from bandwidth_numbers.models.portins import PortIns
from bandwidth_numbers.models.portouts import PortOuts
from bandwidth_numbers.models.reservation import Reservation
from bandwidth_numbers.models.site_hosts import SiteHosts
from bandwidth_numbers.models.sites import Sites
from bandwidth_numbers.models.tn_option_orders import TnOptionOrders

XPATH_ACCOUNT = "/accounts/{}"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from __future__ import division, absolute_import, print_function
from future.builtins import super

from iris_sdk.models.base_resource import BaseResource
from iris_sdk.models.data.account_users import AccountUsersData
from bandwidth_numbers.models.base_resource import BaseResource
from bandwidth_numbers.models.data.account_users import AccountUsersData

XML_NAME_USERS_ACC = "Users"
XPATH_USERS_ACC = "/users"
Expand All @@ -21,4 +21,4 @@ def __init__(self, parent=None, client=None):
AccountUsersData.__init__(self)

def list(self):
return self._get_data().user
return self._get_data().user
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from __future__ import division, absolute_import, print_function
from future.builtins import super

from iris_sdk.models.base_resource import BaseResource
from iris_sdk.models.data.activation_status import ActivationStatusData
from bandwidth_numbers.models.base_resource import BaseResource
from bandwidth_numbers.models.data.activation_status import ActivationStatusData

XPATH_ACTIVATION_STATUS = "/activationStatus"

Expand All @@ -24,4 +24,4 @@ def get(self):

def save(self):
self.id = 1
self._save()
self._save()
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from __future__ import division, absolute_import, print_function
from future.builtins import super

from iris_sdk.models.base_resource import BaseResource
from iris_sdk.models.data.available_npa_nxx import AvailableNpaNxxData
from bandwidth_numbers.models.base_resource import BaseResource
from bandwidth_numbers.models.data.available_npa_nxx import AvailableNpaNxxData

XML_NAME_AVAILABLE_NPA_NXX = "SearchResultForAvailableNpaNxx"
XPATH_AVAILABLE_NPA_NXX = "/availableNpaNxx"
Expand All @@ -22,4 +22,4 @@ def __init__(self, parent=None, client=None):

def list(self, params):
return self.get(params=params).available_npa_nxx_list.\
available_npa_nxx
available_npa_nxx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from __future__ import division, absolute_import, print_function
from future.builtins import super

from iris_sdk.include.xml_consts import XML_PARAM_TN_DETAIL, XML_TRUE
from iris_sdk.models.base_resource import BaseResource
from iris_sdk.models.data.available_numbers import AvailableNumbersData
from bandwidth_numbers.include.xml_consts import XML_PARAM_TN_DETAIL, XML_TRUE
from bandwidth_numbers.models.base_resource import BaseResource
from bandwidth_numbers.models.data.available_numbers import AvailableNumbersData

XML_NAME_AVAILABLE_NUMBERS = "SearchResult"
XPATH_AVAILABLE_NUMBERS = "/availableNumbers"
Expand All @@ -26,4 +26,4 @@ def list(self, params):
if params.get(XML_PARAM_TN_DETAIL, "") == XML_TRUE:
return self.telephone_number_detail_list.telephone_number_detail
else:
return self.telephone_number_list.telephone_number
return self.telephone_number_list.telephone_number
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from io import BytesIO
from xml.etree.ElementTree import Element, ElementTree, fromstring, SubElement

from iris_sdk.models.maps.base_map import BaseMap
from iris_sdk.utils.rest import HTTP_OK
from iris_sdk.utils.strings import Converter
from bandwidth_numbers.models.maps.base_map import BaseMap
from bandwidth_numbers.utils.rest import HTTP_OK
from bandwidth_numbers.utils.strings import Converter

BASE_MAP_SUFFIX = "Map"
BASE_PROP_CLIENT = "client"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from __future__ import division, absolute_import, print_function
from future.builtins import super

from iris_sdk.models.base_resource import BaseResource
from iris_sdk.models.data.cities import CitiesData
from bandwidth_numbers.models.base_resource import BaseResource
from bandwidth_numbers.models.data.cities import CitiesData

XML_NAME_CITIES = "CityResponse"
XPATH_RATE_CITIES = "/cities"
Expand All @@ -21,4 +21,4 @@ def __init__(self, parent=None, client=None):
CitiesData.__init__(self)

def list(self, params):
return self._get_data(params=params).cities.city
return self._get_data(params=params).cities.city
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from __future__ import division, absolute_import, print_function
from future.builtins import super

from iris_sdk.models.base_resource import BaseResource
from iris_sdk.models.data.covered_rate_centers import CoveredRateCentersData
from iris_sdk.models.rate_center import RateCenter
from bandwidth_numbers.models.base_resource import BaseResource
from bandwidth_numbers.models.data.covered_rate_centers import CoveredRateCentersData
from bandwidth_numbers.models.rate_center import RateCenter

XPATH_COVERED_RATE_CENTERS = "/coveredratecenters"

Expand All @@ -23,4 +23,4 @@ def get(self, id):
return RateCenter(self).get(id)

def list(self, params):
return self._get_data(params=params).covered_rate_center
return self._get_data(params=params).covered_rate_center
7 changes: 7 additions & 0 deletions bandwidth_numbers/models/data/a2p_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env python

from bandwidth_numbers.models.base_resource import BaseData
from bandwidth_numbers.models.maps.a2p_settings import A2pSettingsMap

class A2pSettings(A2pSettingsMap, BaseData):
pass
14 changes: 14 additions & 0 deletions bandwidth_numbers/models/data/account.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env python

from bandwidth_numbers.models.base_resource import BaseData
from bandwidth_numbers.models.data.address import Address
from bandwidth_numbers.models.data.contact import Contact
from bandwidth_numbers.models.data.tier_list import TierList
from bandwidth_numbers.models.maps.account import AccountMap

class AccountData(AccountMap, BaseData):

def __init__(self):
self.address = Address()
self.contact = Contact()
self.tiers = TierList()
10 changes: 10 additions & 0 deletions bandwidth_numbers/models/data/account_user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python

from bandwidth_numbers.models.base_resource import BaseData
from bandwidth_numbers.models.data.roles_list import RolesList
from bandwidth_numbers.models.maps.account_user import AccountUserMap

class AccountUser(AccountUserMap, BaseData):

def __init__(self):
self.roles = RolesList()
10 changes: 10 additions & 0 deletions bandwidth_numbers/models/data/account_users.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python

from bandwidth_numbers.models.base_resource import BaseData, BaseResourceList
from bandwidth_numbers.models.data.account_user import AccountUser
from bandwidth_numbers.models.maps.account_users import AccountUsersMap

class AccountUsersData(AccountUsersMap, BaseData):

def __init__(self):
self.user = BaseResourceList(AccountUser)
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env python

from iris_sdk.models.base_resource import BaseData
from iris_sdk.models.data.telephone_number_list import TelephoneNumberList
from iris_sdk.models.maps.activation_status import ActivationStatusMap
from bandwidth_numbers.models.base_resource import BaseData
from bandwidth_numbers.models.data.telephone_number_list import TelephoneNumberList
from bandwidth_numbers.models.maps.activation_status import ActivationStatusMap

class ActivationStatusData(ActivationStatusMap, BaseData):

def __init__(self):
self.activated_telephone_numbers_list = TelephoneNumberList()
self.not_yet_activated_telephone_numbers_list = TelephoneNumberList()
self.not_yet_activated_telephone_numbers_list = TelephoneNumberList()
7 changes: 7 additions & 0 deletions bandwidth_numbers/models/data/address.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env python

from bandwidth_numbers.models.base_resource import BaseData
from bandwidth_numbers.models.maps.address import AddressMap

class Address(AddressMap, BaseData):
pass
10 changes: 10 additions & 0 deletions bandwidth_numbers/models/data/available_npa_nxx.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python

from bandwidth_numbers.models.base_resource import BaseData
from bandwidth_numbers.models.data.available_npa_nxx_list import AvailableNpaNxxList
from bandwidth_numbers.models.maps.available_npa_nxx import AvailableNpaNxxMap

class AvailableNpaNxxData(AvailableNpaNxxMap, BaseData):

def __init__(self):
self.available_npa_nxx_list = AvailableNpaNxxList()
14 changes: 14 additions & 0 deletions bandwidth_numbers/models/data/available_npa_nxx_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env python

from bandwidth_numbers.models.base_resource import BaseData, BaseResourceList
from bandwidth_numbers.models.data.npa_nxx import NpaNxx
from bandwidth_numbers.models.maps.available_npa_nxx_list import AvailableNpaNxxListMap

class AvailableNpaNxxList(AvailableNpaNxxListMap, BaseData):

@property
def items(self):
return self.available_npa_nxx.items

def __init__(self):
self.available_npa_nxx = BaseResourceList(NpaNxx)
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python

from iris_sdk.models.base_resource import BaseResource
from iris_sdk.models.data.telephone_number_list import TelephoneNumberList
from iris_sdk.models.data.telephone_number_detail_list import \
from bandwidth_numbers.models.base_resource import BaseResource
from bandwidth_numbers.models.data.telephone_number_list import TelephoneNumberList
from bandwidth_numbers.models.data.telephone_number_detail_list import \
TelephoneNumberDetailList
from iris_sdk.models.maps.available_numbers import AvailableNumbersMap
from bandwidth_numbers.models.maps.available_numbers import AvailableNumbersMap

class AvailableNumbersData(AvailableNumbersMap):

Expand All @@ -17,4 +17,4 @@ def total_count(self, total_count):

def __init__(self):
self.telephone_number_detail_list = TelephoneNumberDetailList()
self.telephone_number_list = TelephoneNumberList()
self.telephone_number_list = TelephoneNumberList()
Loading