Created
June 7, 2017 16:32
-
-
Save EdgeCaseBerg/7022ccc53f4df242c366b8ac5db6a96b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import com.typesafe.config.ConfigFactory | |
val c = ConfigFactory.load().getConfig("gs") | |
import com.mcl.recipesearch.service._ | |
val gsConf = GroceryServerConf(true, new java.net.URI(c.getString("endpoint")), c.getString("clientId"), c.getString("clientApiKey")) | |
import play.api.libs.ws.WSClientConfig | |
import play.api.libs.ws.DefaultWSClientConfig | |
import play.api.libs.ws.ssl.SSLConfig | |
import play.api.libs.ws.ning.NingAsyncHttpClientConfigBuilder | |
val clientConfig = new DefaultWSClientConfig() | |
val secureDefaults:com.ning.http.client.AsyncHttpClientConfig = new NingAsyncHttpClientConfigBuilder(clientConfig).build() | |
val builder = new com.ning.http.client.AsyncHttpClientConfig.Builder(secureDefaults) | |
builder.setCompressionEnabled(true) | |
val secureDefaultsWithSpecificOptions:com.ning.http.client.AsyncHttpClientConfig = builder.build() | |
implicit val implicitClient = new play.api.libs.ws.ning.NingWSClient(secureDefaultsWithSpecificOptions) | |
import play.api.libs.ws._ | |
val wsClient: WSClient = implicitClient | |
import scala.concurrent.ExecutionContext.global | |
import concurrent._ | |
import concurrent.duration._ | |
val newConf = gsConf.copy(endpoint = new java.net.URI("http://meredith.groceryserver.com/")) | |
val gss = new GroceryServiceService(wsClient, newConf, global) | |
val res = gss.getLocalOffersForRecipe("1057", "64.25.209.197") | |
Await.result(res, 2.seconds) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment