Skip to content

Instantly share code, notes, and snippets.

@karreiro
Created June 4, 2020 23:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karreiro/d15873fe99a11b1088fbeaa799865c82 to your computer and use it in GitHub Desktop.
Save karreiro/d15873fe99a11b1088fbeaa799865c82 to your computer and use it in GitHub Desktop.
require 'httparty'
def execute_dmn_model(speed)
params = {
'model1': {
'Driver': { 'Name': 'Guilherme', 'Points': 15 },
'Violation': { 'Type': 'speed', 'Speed Limit': 60, 'Actual Speed': 65 },
}
}
body = {
'model-namespace' => 'https://kiegroup.org/dmn/_E06BB47C-7B91-4B06-B3B9-E75B3681DAAB',
'model-name' => 'example',
'dmn-context' => params
}
resp = HTTParty.post("http://localhost:8080/kie-server/services/rest/server/containers/wwwwww_1.0.0-SNAPSHOT/dmn",
body: body.to_json,
headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' },
basic_auth: { username: 'kieserver', password: 'kieserver1!' })
puts '===================='
puts resp
puts '===================='
end
execute_dmn_model(65) # NO
execute_dmn_model(100) # YES
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment