mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 16:24:08 -04:00
Merge branch 'master' into celery-jobs
Conflicts: app/main/views/sms.py
This commit is contained in:
@@ -19,13 +19,14 @@ class JobApiClient(BaseAPIClient):
|
||||
else:
|
||||
return self.get(url='/service/{}/job'.format(service_id))
|
||||
|
||||
def create_job(self, job_id, service_id, template_id, original_file_name):
|
||||
def create_job(self, job_id, service_id, template_id, original_file_name, notification_count):
|
||||
data = {
|
||||
"id": job_id,
|
||||
"template": template_id,
|
||||
"original_file_name": original_file_name,
|
||||
"bucket_name": "service-{}-notify".format(service_id),
|
||||
"file_name": "{}.csv".format(job_id)
|
||||
"file_name": "{}.csv".format(job_id),
|
||||
"notification_count": notification_count
|
||||
}
|
||||
|
||||
resp = self.post(url='/service/{}/job'.format(service_id), data=data)
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
from notifications_python_client.notifications import BaseAPIClient
|
||||
from notifications_python_client.errors import (
|
||||
HTTPError,
|
||||
InvalidResponse
|
||||
)
|
||||
from notifications_python_client.errors import HTTPError
|
||||
|
||||
from flask.ext.login import UserMixin
|
||||
|
||||
@@ -34,6 +31,11 @@ class UserApiClient(BaseAPIClient):
|
||||
user_data = self.get(url)
|
||||
return User(user_data['data'], max_failed_login_count=self.max_failed_login_count)
|
||||
|
||||
def get_user_by_email(self, email_address):
|
||||
params = {'email': email_address}
|
||||
user_data = self.get('/user/email', params=params)
|
||||
return User(user_data['data'], max_failed_login_count=self.max_failed_login_count)
|
||||
|
||||
def get_users(self):
|
||||
users_data = self.get("/user")['data']
|
||||
users = []
|
||||
@@ -57,13 +59,6 @@ class UserApiClient(BaseAPIClient):
|
||||
if e.status_code == 400 or e.status_code == 404:
|
||||
return False
|
||||
|
||||
def get_user_by_email(self, email_address):
|
||||
users = self.get_users()
|
||||
user = [u for u in users if u.email_address == email_address]
|
||||
if len(user) == 1:
|
||||
return user[0]
|
||||
return None
|
||||
|
||||
def send_verify_code(self, user_id, code_type, to):
|
||||
data = {'to': to}
|
||||
endpoint = '/user/{0}/{1}-code'.format(user_id, code_type)
|
||||
|
||||
Reference in New Issue
Block a user