Skip to content

Commit

Permalink
Entire response back to the actor
Browse files Browse the repository at this point in the history
- ApiActor After successful connection respond with entire extracted response model to be able to read by implemented actor.
  • Loading branch information
marioosh committed Jun 24, 2015
1 parent 128d9c7 commit 5330fea
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/scala/io/scalac/slack/api/ApiActor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package io.scalac.slack.api
import akka.actor.{Actor, ActorLogging}
import io.scalac.slack.api.ResponseObject._
import io.scalac.slack.common.JsonProtocols._
import io.scalac.slack.common.{Attachment, RichOutboundMessage}
import io.scalac.slack.common.RichOutboundMessage
import io.scalac.slack.{ApiTestError, Config, SlackError}
import spray.json._

Expand All @@ -19,7 +19,7 @@ class ApiActor extends Actor with ActorLogging {
case ApiTest(param, error) =>
log.debug("api.test requested")
val send = sender()
val params = Map("param" -> param, "error" -> error).collect { case (key, Some(value)) => key -> value}
val params = Map("param" -> param, "error" -> error).collect { case (key, Some(value)) => key -> value }

SlackApiClient.get[ApiTestResponse]("api.test", params) onComplete {
case Success(res) =>
Expand Down Expand Up @@ -56,9 +56,11 @@ class ApiActor extends Actor with ActorLogging {
SlackApiClient.get[RtmStartResponse]("rtm.start", Map("token" -> token.key)) onComplete {

case Success(res) =>
if (res.ok)
if (res.ok) {
send ! RtmData(res.url)
send ! res.self
send ! res.self
send ! res
}
case Failure(ex) =>
send ! ex
}
Expand Down

0 comments on commit 5330fea

Please sign in to comment.