From d9286b036f53c8b2ac5446c20d67be491cf293ed Mon Sep 17 00:00:00 2001 From: Ken Tsang Date: Tue, 20 Jun 2017 13:06:46 +0100 Subject: [PATCH] Add get and update service inbound api --- app/notify_client/service_api_client.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/notify_client/service_api_client.py b/app/notify_client/service_api_client.py index 6c30c3e8a..70ee891ac 100644 --- a/app/notify_client/service_api_client.py +++ b/app/notify_client/service_api_client.py @@ -266,13 +266,21 @@ class ServiceAPIClient(NotifyAdminAPIClient): '/service/{}/inbound-sms/summary'.format(service_id) ) - def update_service_inbound_api(self, service_id, url, bearer_token, user_id): + def update_service_inbound_api(self, service_id, url, bearer_token, user_id, inbound_api_id): data = { - "url":url, + "url": url, "bearer_token": bearer_token, "updated_by_id": user_id } - return self.post("/service/{}/inbound-api".format(service_id), data) + update_inbound_api_path = '/{}'.format(inbound_api_id) if inbound_api_id else '' + return self.post("/service/{}/inbound-api{}".format(service_id, update_inbound_api_path), data) + + def get_service_inbound_api(self, service_id, inbound_sms_api_id): + return self.get( + "/service/{}/inbound-api/{}".format( + service_id, inbound_sms_api_id + ) + )['data'] class ServicesBrowsableItem(BrowsableItem):