aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/com/drivergrp/core/rest.scala
diff options
context:
space:
mode:
authorvlad <vlad@drivergrp.com>2016-07-28 13:54:06 -0700
committervlad <vlad@drivergrp.com>2016-07-28 13:54:06 -0700
commit0b3910c99854717282150bd4462c745b4008c7ae (patch)
tree798b42ea693ff2947bc5ea454d4c99c0dc8092f7 /src/main/scala/com/drivergrp/core/rest.scala
parentc6b4c8a713f573dc0bcf729d1b1d2803dad4b98b (diff)
downloaddriver-core-0b3910c99854717282150bd4462c745b4008c7ae.tar.gz
driver-core-0b3910c99854717282150bd4462c745b4008c7ae.tar.bz2
driver-core-0b3910c99854717282150bd4462c745b4008c7ae.zip
Removed monadic directives + Fixed timezones for textual time + Explicit Swagger host provision
Diffstat (limited to 'src/main/scala/com/drivergrp/core/rest.scala')
-rw-r--r--src/main/scala/com/drivergrp/core/rest.scala24
1 files changed, 4 insertions, 20 deletions
diff --git a/src/main/scala/com/drivergrp/core/rest.scala b/src/main/scala/com/drivergrp/core/rest.scala
index 3f3a68e..91e9d3b 100644
--- a/src/main/scala/com/drivergrp/core/rest.scala
+++ b/src/main/scala/com/drivergrp/core/rest.scala
@@ -3,8 +3,6 @@ package com.drivergrp.core
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.{HttpRequest, HttpResponse}
-import akka.http.scaladsl.server.{Directive, _}
-import akka.http.scaladsl.util.FastFuture._
import akka.stream.ActorMaterializer
import akka.util.Timeout
import com.drivergrp.core.logging.Logger
@@ -18,8 +16,8 @@ import com.typesafe.config.Config
import scala.concurrent.duration._
import scala.concurrent.{ExecutionContext, Future}
import scala.language.postfixOps
-import scala.util.{Failure, Success, Try}
-import scalaz.{Failure => _, Success => _, _}
+import scala.util.{Failure, Success}
+import scalaz.{Failure => _, Success => _}
object rest {
@@ -64,29 +62,15 @@ object rest {
}
}
- trait OptionTDirectives {
-
- /**
- * "Unwraps" a `OptionT[Future, T]` and runs the inner route after future
- * completion with the future's value as an extraction of type `Try[T]`.
- * Copied akka-http code with added `.run` call on `OptionT`.
- */
- def onComplete[T](optionT: OptionT[Future, T]): Directive1[Try[Option[T]]] =
- Directive { inner ⇒ ctx ⇒
- optionT.run.fast.transformWith(t ⇒ inner(Tuple1(t))(ctx))(ctx.executionContext)
- }
- }
-
-
import scala.reflect.runtime.universe._
- class Swagger(override val actorSystem: ActorSystem,
+ class Swagger(override val host: String,
+ override val actorSystem: ActorSystem,
override val apiTypes: Seq[Type],
val config: Config) extends SwaggerHttpService with HasActorSystem {
val materializer = ActorMaterializer()(actorSystem)
- override val host = "localhost:8080" // the url of your api, not swagger's json endpoint
override val basePath = config.getString("swagger.basePath")
override val apiDocsPath = config.getString("swagger.docsPath")