Skip to content

Instantly share code, notes, and snippets.

@karreiro

karreiro/client.rb Secret

Created Jun 4, 2020
Embed
What would you like to do?
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
You can’t perform that action at this time.