def startAquaJob()

in src/main/scala/com/gu/zuora/fullexport/Impl.scala [113:145]


  def startAquaJob(zoql: String, objectName: String, start: LocalDate): String = {
    val body =
      s"""
         |{
         |	"format" : "gzip",
         |	"version" : "1.1",
         |	"name" : "zuora-full-export",
         |	"encrypted" : "none",
         |	"useQueryLabels" : "true",
         |	"dateTimeUtc" : "true",
         |	"queries" : [
         |		{
         |			"name" : "$objectName-$start",
         |			"query" : "$zoql",
         |			"type" : "zoqlexport"
         |		}
         |	]
         |}
    """.stripMargin

    HttpWithLongTimeout(s"$zuoraApiHost/v1/batch-query/")
      .header("Authorization", s"Bearer ${accessToken()}")
      .header("Content-Type", "application/json")
      .postData(body)
      .method("POST")
      .asString
      .tap(logError)
      .body
      .pipe(read[QueryResponse](_))
      .tap(job => Assert(s"$objectName job should start successfully: $job", jobSuccessfullyStarted(job)))
      .id
      .get
  }