aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlad <vlad@driver.xyz>2017-07-01 00:57:35 -0700
committervlad <vlad@driver.xyz>2017-07-01 00:57:35 -0700
commitce6973573e67214340fda451ee84171ea98f9a7c (patch)
tree271ef63de4454c6c6ebc720e2f6fedb2c55293fa
parent56187bec9276f51886a01a2752c663f2227d9fc3 (diff)
downloadrest-query-ce6973573e67214340fda451ee84171ea98f9a7c.tar.gz
rest-query-ce6973573e67214340fda451ee84171ea98f9a7c.tar.bz2
rest-query-ce6973573e67214340fda451ee84171ea98f9a7c.zip
Simplifying SendGridMailService + not generate scaladocv0.1.14
-rw-r--r--build.sbt1
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabel.scala2
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidence.scala2
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidenceDocument.scala3
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientWithLabels.scala2
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrial.scala2
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrialArm.scala2
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrialLabelCriterion.scala10
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrialWithLabels.scala2
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/services/rest/SendGridMailService.scala13
10 files changed, 17 insertions, 22 deletions
diff --git a/build.sbt b/build.sbt
index a91c093..7772f5b 100644
--- a/build.sbt
+++ b/build.sbt
@@ -4,6 +4,7 @@ import Keys._
lazy val core = (project in file("."))
.driverLibrary("pds-ui-common")
.settings(scalastyleSettings ++ /* wartRemoverSettings ++ */ formatSettings)
+ .settings(sources in (Compile, doc) := Seq.empty, publishArtifact in (Compile, packageDoc) := false)
.settings(libraryDependencies ++= Seq(
"ch.qos.logback" % "logback-classic" % "1.1.7",
"org.slf4j" % "slf4j-api" % "1.7.21",
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabel.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabel.scala
index 78a73a6..3deccbf 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabel.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabel.scala
@@ -12,7 +12,7 @@ object ApiExportPatientLabel {
(JsPath \ "labelId").format[String] and
(JsPath \ "labelName").format[String] and
(JsPath \ "evidence").format[List[ApiExportPatientLabelEvidence]]
- ) (ApiExportPatientLabel.apply, unlift(ApiExportPatientLabel.unapply))
+ )(ApiExportPatientLabel.apply, unlift(ApiExportPatientLabel.unapply))
def fromDomain(label: ExportPatientLabel) = ApiExportPatientLabel(
id = label.id.toString,
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidence.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidence.scala
index b38c2a0..9ce281e 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidence.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidence.scala
@@ -17,7 +17,7 @@ object ApiExportPatientLabelEvidence {
(JsPath \ "labelValue").format[String](Writes[String](x => JsString(x.toUpperCase))) and
(JsPath \ "evidenceText").format[String] and
(JsPath \ "document").format[ApiExportPatientLabelEvidenceDocument]
- ) (ApiExportPatientLabelEvidence.apply, unlift(ApiExportPatientLabelEvidence.unapply))
+ )(ApiExportPatientLabelEvidence.apply, unlift(ApiExportPatientLabelEvidence.unapply))
def fromDomain(evidence: ExportPatientLabelEvidence) = ApiExportPatientLabelEvidence(
evidenceId = evidence.id.toString,
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidenceDocument.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidenceDocument.scala
index d094014..99bb2cf 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidenceDocument.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidenceDocument.scala
@@ -12,7 +12,6 @@ final case class ApiExportPatientLabelEvidenceDocument(documentId: String,
providerType: String,
date: LocalDate)
-
object ApiExportPatientLabelEvidenceDocument {
implicit val format: Format[ApiExportPatientLabelEvidenceDocument] = (
@@ -21,7 +20,7 @@ object ApiExportPatientLabelEvidenceDocument {
(JsPath \ "documentType").format[String] and
(JsPath \ "providerType").format[String] and
(JsPath \ "date").format[LocalDate]
- ) (ApiExportPatientLabelEvidenceDocument.apply, unlift(ApiExportPatientLabelEvidenceDocument.unapply))
+ )(ApiExportPatientLabelEvidenceDocument.apply, unlift(ApiExportPatientLabelEvidenceDocument.unapply))
def fromDomain(document: ExportPatientLabelEvidenceDocument) =
ApiExportPatientLabelEvidenceDocument(
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientWithLabels.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientWithLabels.scala
index d5b9eb3..8ce970b 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientWithLabels.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientWithLabels.scala
@@ -12,7 +12,7 @@ object ApiExportPatientWithLabels {
(JsPath \ "patientId").format[String] and
(JsPath \ "labelVersion").format[Long] and
(JsPath \ "labels").format[List[ApiExportPatientLabel]]
- ) (ApiExportPatientWithLabels.apply, unlift(ApiExportPatientWithLabels.unapply))
+ )(ApiExportPatientWithLabels.apply, unlift(ApiExportPatientWithLabels.unapply))
def fromDomain(patient: ExportPatientWithLabels) = ApiExportPatientWithLabels(
patientId = patient.patientId.toString,
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrial.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrial.scala
index b12cb93..0c9cb71 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrial.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrial.scala
@@ -15,7 +15,7 @@ object ApiExportTrial {
(JsPath \ "trialId").format[String] and
(JsPath \ "disease").format[String] and
(JsPath \ "lastReviewed").format[Long]
- ) (ApiExportTrial.apply, unlift(ApiExportTrial.unapply))
+ )(ApiExportTrial.apply, unlift(ApiExportTrial.unapply))
def fromDomain(trial: ExportTrial): ApiExportTrial = ApiExportTrial(
nctId = trial.nctId.id,
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrialArm.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrialArm.scala
index 0b77832..b2b02eb 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrialArm.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrialArm.scala
@@ -11,7 +11,7 @@ object ApiExportTrialArm {
implicit val format: Format[ApiExportTrialArm] = (
(JsPath \ "armId").format[String] and
(JsPath \ "armName").format[String]
- ) (ApiExportTrialArm.apply, unlift(ApiExportTrialArm.unapply))
+ )(ApiExportTrialArm.apply, unlift(ApiExportTrialArm.unapply))
def fromDomain(arm: ExportTrialArm) = ApiExportTrialArm(
armId = arm.armId.toString,
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrialLabelCriterion.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrialLabelCriterion.scala
index 09935c0..2564efe 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrialLabelCriterion.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrialLabelCriterion.scala
@@ -23,12 +23,14 @@ object ApiExportTrialLabelCriterion {
(JsPath \ "armIds").format[List[String]] and
(JsPath \ "isCompound").format[Boolean] and
(JsPath \ "isDefining").format[Boolean]
- ) (ApiExportTrialLabelCriterion.apply, unlift(ApiExportTrialLabelCriterion.unapply))
+ )(ApiExportTrialLabelCriterion.apply, unlift(ApiExportTrialLabelCriterion.unapply))
def fromDomain(x: ExportTrialLabelCriterion) = ApiExportTrialLabelCriterion(
- value = x.value.map { x =>
- FuzzyValue.valueToString(FuzzyValue.fromBoolean(x))
- }.getOrElse("Unknown"),
+ value = x.value
+ .map { x =>
+ FuzzyValue.valueToString(FuzzyValue.fromBoolean(x))
+ }
+ .getOrElse("Unknown"),
labelId = x.labelId.toString,
criterionId = x.criterionId.toString,
criterionText = x.criteria,
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrialWithLabels.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrialWithLabels.scala
index dd855f7..de76ac0 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrialWithLabels.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrialWithLabels.scala
@@ -24,7 +24,7 @@ object ApiExportTrialWithLabels {
(JsPath \ "labelVersion").format[Long] and
(JsPath \ "arms").format[List[ApiExportTrialArm]] and
(JsPath \ "criteria").format[List[ApiExportTrialLabelCriterion]]
- ) (ApiExportTrialWithLabels.apply, unlift(ApiExportTrialWithLabels.unapply))
+ )(ApiExportTrialWithLabels.apply, unlift(ApiExportTrialWithLabels.unapply))
def fromDomain(x: ExportTrialWithLabels) = ApiExportTrialWithLabels(
nctId = x.nctId.id,
diff --git a/src/main/scala/xyz/driver/pdsuidomain/services/rest/SendGridMailService.scala b/src/main/scala/xyz/driver/pdsuidomain/services/rest/SendGridMailService.scala
index e308fe6..bb3228e 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/services/rest/SendGridMailService.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/services/rest/SendGridMailService.scala
@@ -4,26 +4,19 @@ import com.sendgrid._
import xyz.driver.pdsuicommon.logging._
import xyz.driver.pdsuidomain.services.MailService
import xyz.driver.pdsuidomain.services.MailService.Template
-import xyz.driver.pdsuidomain.services.rest.SendGridMailService._
import scala.util.control.NonFatal
-object SendGridMailService {
-
+class SendGridMailService(apiKey: String, from: String) extends MailService with PhiLogging {
private val ExpectedHttpCode = 202
- case class Settings(provider: String, frontEndUrl: String, apiKey: String, from: String)
-}
-
-class SendGridMailService(settings: Settings) extends MailService with PhiLogging {
-
def sendTo(email: String, template: Template): Boolean = {
val to = new Email(email)
val content = new Content(template.contentType, template.content)
- val mail = new Mail(new Email(settings.from), template.subject, to, content)
+ val mail = new Mail(new Email(from), template.subject, to, content)
val request = new Request()
- val sendGrid = new SendGrid(settings.apiKey)
+ val sendGrid = new SendGrid(apiKey)
try {
request.method = Method.POST