diff --git a/flowroutenumbersandmessaging/controllers/routes_controller.py b/flowroutenumbersandmessaging/controllers/routes_controller.py index e6a5506..be6a3cb 100644 --- a/flowroutenumbersandmessaging/controllers/routes_controller.py +++ b/flowroutenumbersandmessaging/controllers/routes_controller.py @@ -47,7 +47,7 @@ class RoutesController(BaseController): # Prepare headers _headers = { - 'content-type': 'application/json; charset=utf-8' + 'content-type': 'application/vnd.api+json; charset=utf-8' } # Prepare and execute request @@ -112,23 +112,26 @@ class RoutesController(BaseController): raise APIException('Unauthorized', _context) elif _context.response.status_code == 404: raise APIException('Not Found', _context) + elif _context.response.status_code <> 200: + raise ErrorException('Unspecified error occurred', _context) self.validate_response(_context) - def update_failover_voice_route_for_a_phone_number(self, - number_id, - body): - """Does a PATCH request to /v2/numbers/{number_id}/relationships/failover_route. + return APIHelper.json_deserialize(_context.response.raw_body) - Use this endpoint to update the failover voice route for a phone + def update_primary_voice_route(self, + number_id, + body): + """Does a PATCH request to /v2/numbers/{number_id}/relationships/primary_route. + + Use this endpoint to update the primary voice route for a phone number. You must create the route first by following "Create an Inbound Route". You can then assign the created route by specifying its value in a PATCH request. Args: number_id (int): The phone number in E.164 11-digit North American - format to which the failover route for voice will be - assigned. - body (void): The failover route to be assigned. + format to which the primary route for voice will be assigned. + body (void): The primary route to be assigned. Returns: void: Response from the API. NO CONTENT @@ -143,7 +146,7 @@ class RoutesController(BaseController): # Prepare query URL _query_builder = Configuration.base_uri - _query_builder += '/v2/numbers/{number_id}/relationships/failover_route' + _query_builder += '/v2/numbers/{number_id}/relationships/primary_route' _query_builder = APIHelper.append_url_with_template_parameters(_query_builder, { 'number_id': number_id }) @@ -161,20 +164,21 @@ class RoutesController(BaseController): raise ErrorException('The specified resource was not found', _context) self.validate_response(_context) - def update_primary_voice_route_for_a_phone_number(self, - number_id, - body): - """Does a PATCH request to /v2/numbers/{number_id}/relationships/primary_route. + def update_failover_voice_route(self, + number_id, + body): + """Does a PATCH request to /v2/numbers/{number_id}/relationships/failover_route. - Use this endpoint to update the primary voice route for a phone + Use this endpoint to update the failover voice route for a phone number. You must create the route first by following "Create an Inbound Route". You can then assign the created route by specifying its value in a PATCH request. Args: number_id (int): The phone number in E.164 11-digit North American - format to which the primary route for voice will be assigned. - body (void): The primary route to be assigned. + format to which the failover route for voice will be + assigned. + body (void): The failover route to be assigned. Returns: void: Response from the API. NO CONTENT @@ -189,7 +193,7 @@ class RoutesController(BaseController): # Prepare query URL _query_builder = Configuration.base_uri - _query_builder += '/v2/numbers/{number_id}/relationships/primary_route' + _query_builder += '/v2/numbers/{number_id}/relationships/failover_route' _query_builder = APIHelper.append_url_with_template_parameters(_query_builder, { 'number_id': number_id })