Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@accordproject/cicero-server
Advanced tools
Cicero Server - wraps the Cicero Engine and exposes it as a RESTful service
Exposes the Cicero Engine as a RESTful service.
Templates are loaded from a the root CICERO_DIR.
Clauses may be instantiated by passing the JSON or MD (i.e. TXT) via the payload Body as, either, request
, data
, state
, options
or sample
objects.
See below CURL examples for details.
npm install -g @accordproject/cicero-server --save
Assuming you cloned the Cicero template library in directory <cicero-template-library-dir>
, you can start the server using:
export CICERO_DIR=<cicero-template-library-dir>/src
cicero-server
The default port for the server is 6001
. You can set a different port as an environment variable CICERO_PORT
.
Once the server is started, you can sent requests as follows:
curl --request POST \
--url http://localhost:6001/parse/latedeliveryandpenalty \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"sample": "## Late Delivery and Penalty.\n\n In case of delayed delivery except for Force Majeure cases,\n\"Dan\" (the Seller) shall pay to \"Steve\" (the Buyer) for every 2 days\nof delay penalty amounting to 10.5% of the total value of the Equipment\nwhose delivery has been delayed. Any fractional part of a days is to be\nconsidered a full days. The total amount of penalty shall not however,\nexceed 55% of the total value of the Equipment involved in late delivery.\nIf the delay is more than 15 days, the Buyer is entitled to terminate this Contract." }
'
curl --request POST \
--url http://localhost:6001/draft/latedeliveryandpenalty \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"data":{
"$class": "org.accordproject.latedeliveryandpenalty.LateDeliveryAndPenaltyContract",
"buyer": "resource:org.accordproject.party.Party#Steve",
"seller": "resource:org.accordproject.party.Party#Dan",
"forceMajeure": true,
"penaltyDuration": {
"$class": "org.accordproject.time.Duration",
"amount": 2,
"unit": "days"
},
"penaltyPercentage": 10.5,
"capPercentage": 55,
"termination": {
"$class": "org.accordproject.time.Duration",
"amount": 15,
"unit": "days"
},
"fractionalPart": "days",
"contractId": "c538755a-6c9e-43ff-8767-f8915d0336a0",
"$identifier": "c538755a-6c9e-43ff-8767-f8915d0336a0"
},
"options": {
"unquoteVariables": true
}
}'
curl --request POST \
--url http://localhost:6001/trigger/latedeliveryandpenalty \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"request": {
"$class": "org.accordproject.latedeliveryandpenalty.LateDeliveryAndPenaltyRequest",
"forceMajeure": false,
"agreedDelivery": "December 17, 2017 03:24:00",
"deliveredAt": null,
"goodsValue": 200.00
},
"state": {
"$class": "org.accordproject.runtime.State",
"$identifier": "81fc1750-a77b-11eb-9770-7ddd576a12c2"
},
"data": {
"$class": "org.accordproject.latedeliveryandpenalty.LateDeliveryAndPenaltyContract",
"buyer": "resource:org.accordproject.party.Party#Steve",
"seller": "resource:org.accordproject.party.Party#Dan",
"forceMajeure": true,
"penaltyDuration": {
"$class": "org.accordproject.time.Duration",
"amount": 2,
"unit": "days"
},
"penaltyPercentage": 10.5,
"capPercentage": 55,
"termination": {
"$class": "org.accordproject.time.Duration",
"amount": 15,
"unit": "days"
},
"fractionalPart": "days",
"contractId": "c538755a-6c9e-43ff-8767-f8915d0336a0",
"$identifier": "c538755a-6c9e-43ff-8767-f8915d0336a0"
}
}'
Only supported for clauses or contracts without references to contract state
If the body contains an object with the properties 'state', then this is used as the contract state. If no 'state' property exists then no contract state is used.
Assuming you cloned the Cicero template library in directory <cicero-template-library-dir>
:
curl --request POST \
--url http://localhost:6001/trigger/latedeliveryandpenalty \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"request": {
"$class": "org.accordproject.latedeliveryandpenalty.LateDeliveryAndPenaltyRequest",
"forceMajeure": false,
"agreedDelivery": "December 17, 2017 03:24:00",
"deliveredAt": null,
"goodsValue": 200.00
},
"data": {
"$class": "org.accordproject.latedeliveryandpenalty.LateDeliveryAndPenaltyContract",
"buyer": "resource:org.accordproject.party.Party#Steve",
"seller": "resource:org.accordproject.party.Party#Dan",
"forceMajeure": true,
"penaltyDuration": {
"$class": "org.accordproject.time.Duration",
"amount": 2,
"unit": "days"
},
"penaltyPercentage": 10.5,
"capPercentage": 55,
"termination": {
"$class": "org.accordproject.time.Duration",
"amount": 15,
"unit": "days"
},
"fractionalPart": "days",
"contractId": "c538755a-6c9e-43ff-8767-f8915d0336a0",
"$identifier": "c538755a-6c9e-43ff-8767-f8915d0336a0"
}
}'
Accord Project source code files are made available under the Apache License, Version 2.0 (Apache-2.0), located in the LICENSE file. Accord Project documentation files are made available under the Creative Commons Attribution 4.0 International License (CC-BY-4.0), available at http://creativecommons.org/licenses/by/4.0/.
© 2017-2019 Clause, Inc.
FAQs
Cicero Server - wraps the Cicero Engine and exposes it as a RESTful service
We found that @accordproject/cicero-server demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.