From 4a73e9315c3d66e38e4b2cbd16f7a4e0c0c55c00 Mon Sep 17 00:00:00 2001 From: Nicholas Staples Date: Wed, 20 Jan 2016 09:46:48 +0000 Subject: [PATCH] Implemented send_sms from client. --- app/notify_client/api_client.py | 18 ++++++++++++++++-- requirements.txt | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/notify_client/api_client.py b/app/notify_client/api_client.py index 50217721b..df33884c5 100644 --- a/app/notify_client/api_client.py +++ b/app/notify_client/api_client.py @@ -12,7 +12,7 @@ class NotificationsAdminAPIClient(NotificationsAPIClient): "secret") def init_app(self, application): - self.base_url = application.config['NOTIFY_API_URL'] + self.base_url = application.config['API_HOST_NAME'] self.client_id = application.config['NOTIFY_API_CLIENT'] self.secret = application.config['NOTIFY_API_SECRET'] @@ -83,6 +83,20 @@ class NotificationsAdminAPIClient(NotificationsAPIClient): endpoint = "/service/{0}/template".format(service_id) return self.post(endpoint, data) + def update_service_template(self, id_, name, type_, content, service_id): + """ + Update a service template. + """ + data = { + 'id': id_, + 'name': name, + 'template_type': type_, + 'content': content, + 'service': service_id + } + endpoint = "/service/{0}/template/{1}".format(service_id, id_) + return self.put(endpoint, data) + def get_service_template(self, service_id, template_id, *params): """ Retrieve a service template. @@ -114,7 +128,7 @@ class NotificationsAdminAPIClient(NotificationsAPIClient): message, job_id=None, description=None): - pass + self.send_sms_notification(mobile_number, message) def send_email(self, email_address, diff --git a/requirements.txt b/requirements.txt index 0201307fc..b3657eab5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,6 +11,6 @@ Flask-Bcrypt==0.6.2 credstash==1.8.0 boto3==1.2.3 -git+https://github.com/alphagov/notifications-python-client.git@0.1.7#egg=notifications-python-client==0.1.7 +git+https://github.com/alphagov/notifications-python-client.git@0.1.8#egg=notifications-python-client==0.1.8 git+https://github.com/alphagov/notifications-utils.git@0.0.3#egg=notifications-utils==0.0.3