Skip to content

Commit

Permalink
Add class for Imprint API
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfinus committed Dec 27, 2018
1 parent e2634a4 commit 94cc1cb
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/org/camunda/latera/bss/apis/Imprint.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package org.camunda.latera.bss.apis

import org.camunda.latera.bss.http.HTTPRestProcessor
import org.camunda.latera.bss.logging.SimpleLogger
import org.camunda.latera.bss.utils.IO
import org.camunda.bpm.engine.delegate.DelegateExecution

class Imprint {
HTTPRestProcessor processor
LinkedHashMap headers
DelegateExecution execution
SimpleLogger logger

Imprint(DelegateExecution execution) {
this.execution = execution
this.logger = new SimpleLogger(execution)

def url = execution.getVariable("imprintUrl")
def version = execution.getVariable("imprintVersion")
def token = execution.getVariable("imprintToken")
this.headers = [
'X_IMPRINT_API_VERSION': version,
'X_IMPRINT_API_TOKEN': token
]
this.processor = new HTTPRestProcessor(baseUrl: url, user: user, password: password, execution: execution)
}

def print(LinkedHashMap json) {
this.logger.info("Printing begin...")
def result = this.processor.sendRequest(path: '/api/print', body: json, headers: this.headers, requestContentType: 'application/json', 'post')
def file = IO.getBytes(result)
return file
}
}

0 comments on commit 94cc1cb

Please sign in to comment.