forked from y-yu/DIwithTaglessFinal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
67 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,8 @@ | ||
import models.DefaultEnvironment | ||
import services.UpdateStatusService._ | ||
|
||
import scala.concurrent.Future | ||
|
||
// import repositories.TwitterRepository._ | ||
// import repositories.TwitterRepositoryDI._ | ||
import scala.concurrent.ExecutionContext.Implicits.global | ||
|
||
object Main { | ||
def main(args: Array[String]): Unit = { | ||
updateStatusIfExist("_yyu_", "ok").run(DefaultEnvironment.defaultEnvironment) | ||
updateStatusIfExist("_yyu_", "good").run(DefaultEnvironment.defaultEnvironment) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
package models | ||
|
||
import play.api.libs.ws.WSResponse | ||
import utils.Reader | ||
|
||
import scala.concurrent.Future | ||
|
||
trait TwitterSYM[R[_]] { | ||
def existUserWithScreenName(screenName: R[String]): R[Future[Boolean]] | ||
def updateStatus(status: R[String]): R[Future[String]] | ||
def condition[A](cond: R[Future[Boolean]], t: R[A], e: R[A]): R[Future[A]] | ||
def existUserWithScreenName(screenName: R[String]): R[Boolean] | ||
def updateStatus(status: R[String]): R[String] | ||
def condition[A](cond: R[Boolean], t: R[A], e: R[A]): R[A] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package models | ||
|
||
import play.api.libs.oauth.OAuthCalculator | ||
|
||
/** | ||
* Created by hikaru_yoshimura on 2015/07/20. | ||
*/ | ||
trait UseOAuthCred { | ||
val cred: OAuthCalculator | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package models | ||
|
||
import play.api.libs.ws.WSClient | ||
|
||
/** | ||
* Created by hikaru_yoshimura on 2015/07/20. | ||
*/ | ||
trait UseWSClient { | ||
val client: WSClient | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,12 @@ | ||
package services | ||
|
||
import models.TwitterEnv | ||
import utils.Reader._ | ||
import repositories.DefaultInterpreter._ | ||
|
||
import scala.concurrent.Future | ||
|
||
/** | ||
* Created by hikaru_yoshimura on 2015/07/20. | ||
*/ | ||
object UpdateStatusService { | ||
def updateStatusIfExist(screenName: String, status: String): Twitter[Future[String]] = | ||
def updateStatusIfExist(screenName: String, status: String): Twitter[String] = | ||
condition( | ||
existUserWithScreenName(pure(screenName)), | ||
updateStatus(pure(status)), | ||
pure[TwitterEnv, Twitter[Future[String]]]({println("ng"); Future.successful("ng")}) | ||
pure("ng") | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
package utils | ||
|
||
|
||
|
||
case class Reader[E, A](g: E => A) { | ||
def apply(e: E) = g(e) | ||
def run: E => A = apply | ||
|