|
|
@ -3,14 +3,12 @@ |
|
|
|
""" |
|
|
|
""" |
|
|
|
flowroutenumbersandmessaging.controllers.e911s_controller |
|
|
|
flowroutenumbersandmessaging.controllers.e911s_controller |
|
|
|
|
|
|
|
|
|
|
|
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). |
|
|
|
This file was automatically generated by APIMATIC v2.0 (https://apimatic.io) |
|
|
|
""" |
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
from .base_controller import BaseController |
|
|
|
from .base_controller import BaseController |
|
|
|
from ..api_helper import APIHelper |
|
|
|
from ..api_helper import APIHelper |
|
|
|
from ..configuration import Configuration |
|
|
|
from ..configuration import Configuration |
|
|
|
from ..http.auth.basic_auth import BasicAuth |
|
|
|
|
|
|
|
from ..exceptions.error_exception import ErrorException |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class E911sController(BaseController): |
|
|
|
class E911sController(BaseController): |
|
|
@ -57,23 +55,15 @@ class E911sController(BaseController): |
|
|
|
'offset': offset, |
|
|
|
'offset': offset, |
|
|
|
'state': state |
|
|
|
'state': state |
|
|
|
} |
|
|
|
} |
|
|
|
_query_builder = APIHelper.append_url_with_query_parameters(_query_builder, |
|
|
|
_query_builder = APIHelper.append_url_with_query_parameters( |
|
|
|
_query_parameters, Configuration.array_serialization) |
|
|
|
_query_builder, _query_parameters, |
|
|
|
|
|
|
|
Configuration.array_serialization) |
|
|
|
_query_url = APIHelper.clean_url(_query_builder) |
|
|
|
_query_url = APIHelper.clean_url(_query_builder) |
|
|
|
|
|
|
|
|
|
|
|
# Prepare and execute request |
|
|
|
# Prepare and execute request |
|
|
|
_request = self.http_client.get(_query_url) |
|
|
|
_request = self.http_client.get(_query_url) |
|
|
|
BasicAuth.apply(_request) |
|
|
|
|
|
|
|
_context = self.execute_request(_request) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Endpoint and global error handling using HTTP status codes. |
|
|
|
return self.handle_request_and_response(_request) |
|
|
|
if _context.response.status_code == 401: |
|
|
|
|
|
|
|
raise ErrorException('Unauthorized – There was an issue with your API credentials.', _context) |
|
|
|
|
|
|
|
elif _context.response.status_code == 404: |
|
|
|
|
|
|
|
raise ErrorException('The specified resource was not found', _context) |
|
|
|
|
|
|
|
self.validate_response(_context) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return APIHelper.json_deserialize(_context.response.raw_body) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_e911(self, e911_id): |
|
|
|
def get_e911(self, e911_id): |
|
|
|
"""Does a GET request to /v2/e911s/<e911_id>. |
|
|
|
"""Does a GET request to /v2/e911s/<e911_id>. |
|
|
@ -101,17 +91,8 @@ class E911sController(BaseController): |
|
|
|
|
|
|
|
|
|
|
|
# Prepare and execute request |
|
|
|
# Prepare and execute request |
|
|
|
_request = self.http_client.get(_query_url) |
|
|
|
_request = self.http_client.get(_query_url) |
|
|
|
BasicAuth.apply(_request) |
|
|
|
|
|
|
|
_context = self.execute_request(_request) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Endpoint and global error handling using HTTP status codes. |
|
|
|
|
|
|
|
if _context.response.status_code == 401: |
|
|
|
|
|
|
|
raise ErrorException('Unauthorized – There was an issue with your API credentials.', _context) |
|
|
|
|
|
|
|
elif _context.response.status_code == 404: |
|
|
|
|
|
|
|
raise ErrorException('The specified resource was not found', _context) |
|
|
|
|
|
|
|
self.validate_response(_context) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return APIHelper.json_deserialize(_context.response.raw_body) |
|
|
|
return self.handle_request_and_response(_request) |
|
|
|
|
|
|
|
|
|
|
|
def validate_address(self, |
|
|
|
def validate_address(self, |
|
|
|
label, |
|
|
|
label, |
|
|
@ -149,19 +130,22 @@ class E911sController(BaseController): |
|
|
|
the request. |
|
|
|
the request. |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
body = dict() |
|
|
|
body = { |
|
|
|
body['data'] = dict() |
|
|
|
'data': { |
|
|
|
body['data']['type'] = 'e911' |
|
|
|
'type': 'e911', |
|
|
|
body['data']['attributes'] = {} |
|
|
|
'attributes': { |
|
|
|
body['data']['attributes']['label'] = label |
|
|
|
'label': label, |
|
|
|
body['data']['attributes']['first_name'] = first_name |
|
|
|
'first_name': first_name, |
|
|
|
body['data']['attributes']['last_name'] = last_name |
|
|
|
'last_name': last_name, |
|
|
|
body['data']['attributes']['street_name'] = street_name |
|
|
|
'street_name': street_name, |
|
|
|
body['data']['attributes']['street_number'] = street_number |
|
|
|
'street_number': street_number, |
|
|
|
body['data']['attributes']['city'] = city |
|
|
|
'city': city, |
|
|
|
body['data']['attributes']['state'] = state |
|
|
|
'state': state, |
|
|
|
body['data']['attributes']['country'] = country |
|
|
|
'country': country, |
|
|
|
body['data']['attributes']['zip'] = zipcode |
|
|
|
'zip': zipcode |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# Prepare query URL |
|
|
|
# Prepare query URL |
|
|
|
_query_builder = Configuration.base_uri |
|
|
|
_query_builder = Configuration.base_uri |
|
|
@ -177,19 +161,10 @@ class E911sController(BaseController): |
|
|
|
|
|
|
|
|
|
|
|
# Prepare and execute request |
|
|
|
# Prepare and execute request |
|
|
|
_request = self.http_client.post(_query_url, headers=_headers, |
|
|
|
_request = self.http_client.post(_query_url, headers=_headers, |
|
|
|
parameters=APIHelper.json_serialize(body)) |
|
|
|
parameters=APIHelper.json_serialize( |
|
|
|
BasicAuth.apply(_request) |
|
|
|
body)) |
|
|
|
_context = self.execute_request(_request) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Endpoint and global error handling using HTTP status codes. |
|
|
|
return self.handle_request_and_response(_request) |
|
|
|
if _context.response.status_code == 401: |
|
|
|
|
|
|
|
raise ErrorException('Unauthorized – There was an issue with your API credentials.', _context) |
|
|
|
|
|
|
|
elif _context.response.status_code == 404: |
|
|
|
|
|
|
|
raise ErrorException('The specified resource was not found', _context) |
|
|
|
|
|
|
|
self.validate_response(_context) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Return appropriate type |
|
|
|
|
|
|
|
return APIHelper.json_deserialize(_context.response.raw_body) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_address(self, |
|
|
|
def create_address(self, |
|
|
|
label, |
|
|
|
label, |
|
|
@ -203,7 +178,8 @@ class E911sController(BaseController): |
|
|
|
zipcode): |
|
|
|
zipcode): |
|
|
|
"""Does a POST request to /v2/e911s. |
|
|
|
"""Does a POST request to /v2/e911s. |
|
|
|
|
|
|
|
|
|
|
|
Creates an address record that can then be associated with 1 or more DIDs |
|
|
|
Creates an address record that can then be associated |
|
|
|
|
|
|
|
with 1 or more DIDs |
|
|
|
|
|
|
|
|
|
|
|
Args: |
|
|
|
Args: |
|
|
|
label (string): the alias or friendly name of your entry |
|
|
|
label (string): the alias or friendly name of your entry |
|
|
@ -214,10 +190,11 @@ class E911sController(BaseController): |
|
|
|
city (string): |
|
|
|
city (string): |
|
|
|
state (2 character string): |
|
|
|
state (2 character string): |
|
|
|
country (string USA or Canada): |
|
|
|
country (string USA or Canada): |
|
|
|
zip (string postal code) |
|
|
|
zipcode (string postal code) |
|
|
|
|
|
|
|
|
|
|
|
Returns: |
|
|
|
Returns: |
|
|
|
mixed: Response from the API. A JSON object containing the new record information. |
|
|
|
mixed: Response from the API. A JSON object containing the new |
|
|
|
|
|
|
|
record information. |
|
|
|
|
|
|
|
|
|
|
|
Raises: |
|
|
|
Raises: |
|
|
|
APIException: When an error occurs while fetching the data from |
|
|
|
APIException: When an error occurs while fetching the data from |
|
|
@ -226,20 +203,22 @@ class E911sController(BaseController): |
|
|
|
the request. |
|
|
|
the request. |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
body = dict() |
|
|
|
body = { |
|
|
|
body['data'] = dict() |
|
|
|
'data': { |
|
|
|
body['data']['type'] = 'e911' |
|
|
|
'type': 'e911', |
|
|
|
body['data']['attributes'] = {} |
|
|
|
'attributes': { |
|
|
|
body['data']['attributes']['label'] = label |
|
|
|
'label': label, |
|
|
|
body['data']['attributes']['first_name'] = first_name |
|
|
|
'first_name': first_name, |
|
|
|
body['data']['attributes']['last_name'] = last_name |
|
|
|
'last_name': last_name, |
|
|
|
body['data']['attributes']['street_name'] = street_name |
|
|
|
'street_name': street_name, |
|
|
|
body['data']['attributes']['street_number'] = street_number |
|
|
|
'street_number': street_number, |
|
|
|
body['data']['attributes']['city'] = city |
|
|
|
'city': city, |
|
|
|
body['data']['attributes']['state'] = state |
|
|
|
'state': state, |
|
|
|
body['data']['attributes']['country'] = country |
|
|
|
'country': country, |
|
|
|
body['data']['attributes']['zip'] = zipcode |
|
|
|
'zip': zipcode |
|
|
|
print(body) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# Prepare query URL |
|
|
|
# Prepare query URL |
|
|
|
_query_builder = Configuration.base_uri |
|
|
|
_query_builder = Configuration.base_uri |
|
|
@ -255,19 +234,10 @@ class E911sController(BaseController): |
|
|
|
|
|
|
|
|
|
|
|
# Prepare and execute request |
|
|
|
# Prepare and execute request |
|
|
|
_request = self.http_client.post(_query_url, headers=_headers, |
|
|
|
_request = self.http_client.post(_query_url, headers=_headers, |
|
|
|
parameters=APIHelper.json_serialize(body)) |
|
|
|
parameters=APIHelper.json_serialize( |
|
|
|
BasicAuth.apply(_request) |
|
|
|
body)) |
|
|
|
_context = self.execute_request(_request) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Endpoint and global error handling using HTTP status codes. |
|
|
|
return self.handle_request_and_response(_request) |
|
|
|
if _context.response.status_code == 401: |
|
|
|
|
|
|
|
raise ErrorException('Unauthorized – There was an issue with your API credentials.', _context) |
|
|
|
|
|
|
|
elif _context.response.status_code == 404: |
|
|
|
|
|
|
|
raise ErrorException('The specified resource was not found', _context) |
|
|
|
|
|
|
|
self.validate_response(_context) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Return appropriate type |
|
|
|
|
|
|
|
return APIHelper.json_deserialize(_context.response.raw_body) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_address(self, |
|
|
|
def update_address(self, |
|
|
|
e911_id, |
|
|
|
e911_id, |
|
|
@ -298,7 +268,8 @@ class E911sController(BaseController): |
|
|
|
zipcode (string postal code, optional) |
|
|
|
zipcode (string postal code, optional) |
|
|
|
|
|
|
|
|
|
|
|
Returns: |
|
|
|
Returns: |
|
|
|
mixed: Response from the API. A JSON object containing the new record information. |
|
|
|
mixed: Response from the API. A JSON object containing the |
|
|
|
|
|
|
|
new record information. |
|
|
|
|
|
|
|
|
|
|
|
Raises: |
|
|
|
Raises: |
|
|
|
APIException: When an error occurs while fetching the data from |
|
|
|
APIException: When an error occurs while fetching the data from |
|
|
@ -310,9 +281,7 @@ class E911sController(BaseController): |
|
|
|
cur_record = self.get_e911(e911_id) |
|
|
|
cur_record = self.get_e911(e911_id) |
|
|
|
record_data = cur_record |
|
|
|
record_data = cur_record |
|
|
|
|
|
|
|
|
|
|
|
record_data['data']['attributes']['zip_code'] = str(record_data['data']['attributes']['zip']) |
|
|
|
# Only update the fields specified |
|
|
|
record_data['data']['attributes']['house_number'] = str(record_data['data']['attributes']['street_number']) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if label is not None: |
|
|
|
if label is not None: |
|
|
|
record_data['data']['attributes']['label'] = label |
|
|
|
record_data['data']['attributes']['label'] = label |
|
|
|
if first_name is not None: |
|
|
|
if first_name is not None: |
|
|
@ -322,8 +291,8 @@ class E911sController(BaseController): |
|
|
|
if street_name is not None: |
|
|
|
if street_name is not None: |
|
|
|
record_data['data']['attributes']['street_name'] = street_name |
|
|
|
record_data['data']['attributes']['street_name'] = street_name |
|
|
|
if street_number is not None: |
|
|
|
if street_number is not None: |
|
|
|
record_data['data']['attributes']['street_number'] = str(street_number) |
|
|
|
record_data['data']['attributes']['street_number'] = \ |
|
|
|
record_data['data']['attributes']['house_number'] = str(street_number) |
|
|
|
str(street_number) |
|
|
|
if city is not None: |
|
|
|
if city is not None: |
|
|
|
record_data['data']['attributes']['city'] = city |
|
|
|
record_data['data']['attributes']['city'] = city |
|
|
|
if state is not None: |
|
|
|
if state is not None: |
|
|
@ -340,8 +309,6 @@ class E911sController(BaseController): |
|
|
|
record_data['data']['attributes'].pop('address_type', None) |
|
|
|
record_data['data']['attributes'].pop('address_type', None) |
|
|
|
record_data['data']['attributes'].pop('address_type_number', None) |
|
|
|
record_data['data']['attributes'].pop('address_type_number', None) |
|
|
|
|
|
|
|
|
|
|
|
print(record_data) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Prepare query URL |
|
|
|
# Prepare query URL |
|
|
|
_query_builder = Configuration.base_uri |
|
|
|
_query_builder = Configuration.base_uri |
|
|
|
_query_builder += '/v2/e911s/{}'.format(e911_id) |
|
|
|
_query_builder += '/v2/e911s/{}'.format(e911_id) |
|
|
@ -353,25 +320,16 @@ class E911sController(BaseController): |
|
|
|
_headers = { |
|
|
|
_headers = { |
|
|
|
'accept': 'application/json' |
|
|
|
'accept': 'application/json' |
|
|
|
} |
|
|
|
} |
|
|
|
print("Calling {}".format(_query_url)) |
|
|
|
|
|
|
|
# Prepare and execute request |
|
|
|
# Prepare and execute request |
|
|
|
_request = self.http_client.patch(_query_url, headers=_headers, |
|
|
|
_request = self.http_client.patch(_query_url, headers=_headers, |
|
|
|
parameters=APIHelper.json_serialize(record_data)) |
|
|
|
parameters=APIHelper.json_serialize( |
|
|
|
BasicAuth.apply(_request) |
|
|
|
record_data)) |
|
|
|
_context = self.execute_request(_request) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Endpoint and global error handling using HTTP status codes. |
|
|
|
return self.handle_request_and_response(_request) |
|
|
|
if _context.response.status_code == 401: |
|
|
|
|
|
|
|
raise ErrorException('Unauthorized – There was an issue with your API credentials.', _context) |
|
|
|
|
|
|
|
elif _context.response.status_code == 404: |
|
|
|
|
|
|
|
raise ErrorException('The specified resource was not found', _context) |
|
|
|
|
|
|
|
self.validate_response(_context) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Return appropriate type |
|
|
|
|
|
|
|
return APIHelper.json_deserialize(_context.response.raw_body) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def delete_address(self, e911_id): |
|
|
|
def delete_address(self, e911_id): |
|
|
|
"""Does a DELETE request to /v2/e911s/<e911_id>. |
|
|
|
"""Performs a DELETE request to /v2/e911s/<e911_id>. |
|
|
|
|
|
|
|
|
|
|
|
Removes the existing address record and any associations it may have |
|
|
|
Removes the existing address record and any associations it may have |
|
|
|
|
|
|
|
|
|
|
@ -395,7 +353,6 @@ class E911sController(BaseController): |
|
|
|
|
|
|
|
|
|
|
|
# Return appropriate type |
|
|
|
# Return appropriate type |
|
|
|
_query_url = APIHelper.clean_url(_query_builder) |
|
|
|
_query_url = APIHelper.clean_url(_query_builder) |
|
|
|
print("Calling {}".format(_query_url)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Prepare headers |
|
|
|
# Prepare headers |
|
|
|
_headers = { |
|
|
|
_headers = { |
|
|
@ -404,18 +361,8 @@ class E911sController(BaseController): |
|
|
|
|
|
|
|
|
|
|
|
# Prepare and execute request |
|
|
|
# Prepare and execute request |
|
|
|
_request = self.http_client.delete(_query_url, headers=_headers) |
|
|
|
_request = self.http_client.delete(_query_url, headers=_headers) |
|
|
|
BasicAuth.apply(_request) |
|
|
|
|
|
|
|
_context = self.execute_request(_request) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Endpoint and global error handling using HTTP status codes. |
|
|
|
|
|
|
|
if _context.response.status_code == 401: |
|
|
|
|
|
|
|
raise ErrorException('Unauthorized – There was an issue with your API credentials.', _context) |
|
|
|
|
|
|
|
elif _context.response.status_code == 404: |
|
|
|
|
|
|
|
raise ErrorException('The specified resource was not found', _context) |
|
|
|
|
|
|
|
self.validate_response(_context) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Return appropriate type |
|
|
|
return self.handle_request_and_response(_request) |
|
|
|
return APIHelper.json_deserialize(_context.response.raw_body) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def associate(self, e911_id, did): |
|
|
|
def associate(self, e911_id, did): |
|
|
|
"""Does a PATCH request to /v2/numbers/<did>/relationships/e911s/<e911_id>. |
|
|
|
"""Does a PATCH request to /v2/numbers/<did>/relationships/e911s/<e911_id>. |
|
|
@ -439,7 +386,8 @@ class E911sController(BaseController): |
|
|
|
""" |
|
|
|
""" |
|
|
|
# Prepare query URL |
|
|
|
# Prepare query URL |
|
|
|
_query_builder = Configuration.base_uri |
|
|
|
_query_builder = Configuration.base_uri |
|
|
|
_query_builder += '/v2/numbers/{}/relationships/e911s/{}'.format(did, e911_id) |
|
|
|
_query_builder += '/v2/numbers/{}/relationships/e911s/{}'.format(did, |
|
|
|
|
|
|
|
e911_id) |
|
|
|
|
|
|
|
|
|
|
|
# Return appropriate type |
|
|
|
# Return appropriate type |
|
|
|
_query_url = APIHelper.clean_url(_query_builder) |
|
|
|
_query_url = APIHelper.clean_url(_query_builder) |
|
|
@ -448,22 +396,11 @@ class E911sController(BaseController): |
|
|
|
_headers = { |
|
|
|
_headers = { |
|
|
|
'accept': 'application/json' |
|
|
|
'accept': 'application/json' |
|
|
|
} |
|
|
|
} |
|
|
|
print("Calling {}".format(_query_url)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Prepare and execute request |
|
|
|
# Prepare and execute request |
|
|
|
_request = self.http_client.patch(_query_url, headers=_headers) |
|
|
|
_request = self.http_client.patch(_query_url, headers=_headers) |
|
|
|
BasicAuth.apply(_request) |
|
|
|
|
|
|
|
_context = self.execute_request(_request) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Endpoint and global error handling using HTTP status codes. |
|
|
|
|
|
|
|
if _context.response.status_code == 401: |
|
|
|
|
|
|
|
raise ErrorException('Unauthorized – There was an issue with your API credentials.', _context) |
|
|
|
|
|
|
|
elif _context.response.status_code == 404: |
|
|
|
|
|
|
|
raise ErrorException('The specified resource was not found', _context) |
|
|
|
|
|
|
|
self.validate_response(_context) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Return appropriate type |
|
|
|
return self.handle_request_and_response(_request) |
|
|
|
return APIHelper.json_deserialize(_context.response.raw_body) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def disconnect(self, did): |
|
|
|
def disconnect(self, did): |
|
|
|
"""Does a DELETE request to /v2/numbers/<did>/relationships/e911s. |
|
|
|
"""Does a DELETE request to /v2/numbers/<did>/relationships/e911s. |
|
|
@ -490,7 +427,6 @@ class E911sController(BaseController): |
|
|
|
|
|
|
|
|
|
|
|
# Return appropriate type |
|
|
|
# Return appropriate type |
|
|
|
_query_url = APIHelper.clean_url(_query_builder) |
|
|
|
_query_url = APIHelper.clean_url(_query_builder) |
|
|
|
print("Calling {}".format(_query_url)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Prepare headers |
|
|
|
# Prepare headers |
|
|
|
_headers = { |
|
|
|
_headers = { |
|
|
@ -499,18 +435,8 @@ class E911sController(BaseController): |
|
|
|
|
|
|
|
|
|
|
|
# Prepare and execute request |
|
|
|
# Prepare and execute request |
|
|
|
_request = self.http_client.delete(_query_url, headers=_headers) |
|
|
|
_request = self.http_client.delete(_query_url, headers=_headers) |
|
|
|
BasicAuth.apply(_request) |
|
|
|
|
|
|
|
_context = self.execute_request(_request) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Endpoint and global error handling using HTTP status codes. |
|
|
|
return self.handle_request_and_response(_request) |
|
|
|
if _context.response.status_code == 401: |
|
|
|
|
|
|
|
raise ErrorException('Unauthorized – There was an issue with your API credentials.', _context) |
|
|
|
|
|
|
|
elif _context.response.status_code == 404: |
|
|
|
|
|
|
|
raise ErrorException('The specified resource was not found', _context) |
|
|
|
|
|
|
|
self.validate_response(_context) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Return appropriate type |
|
|
|
|
|
|
|
return APIHelper.json_deserialize(_context.response.raw_body) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def list_dids_for_e911(self, e911_id): |
|
|
|
def list_dids_for_e911(self, e911_id): |
|
|
|
"""Does a GET request to /v2/e911s/<e911_id>/relationships/numbers |
|
|
|
"""Does a GET request to /v2/e911s/<e911_id>/relationships/numbers |
|
|
@ -537,14 +463,6 @@ class E911sController(BaseController): |
|
|
|
|
|
|
|
|
|
|
|
# Prepare and execute request |
|
|
|
# Prepare and execute request |
|
|
|
_request = self.http_client.get(_query_url) |
|
|
|
_request = self.http_client.get(_query_url) |
|
|
|
BasicAuth.apply(_request) |
|
|
|
|
|
|
|
_context = self.execute_request(_request) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Endpoint and global error handling using HTTP status codes. |
|
|
|
return self.handle_request_and_response(_request) |
|
|
|
if _context.response.status_code == 401: |
|
|
|
|
|
|
|
raise ErrorException('Unauthorized – There was an issue with your API credentials.', _context) |
|
|
|
|
|
|
|
elif _context.response.status_code == 404: |
|
|
|
|
|
|
|
raise ErrorException('The specified resource was not found', _context) |
|
|
|
|
|
|
|
self.validate_response(_context) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return APIHelper.json_deserialize(_context.response.raw_body) |
|
|
|
|
|
|
|