SoloVim/foo.bru

119 lines
4.6 KiB
Plaintext

meta {
name: create Zaao Task
type: http
seq: 2
}
post {
url: {{baseUrl}}/api/zaao/tasks/
body: json
auth: inherit
}
headers {
Accept: application/json
}
body:json {
[{
"address": "{{address}}",
"coord_x": {{coord_x}},
"coord_y": {{coord_y}},
"date": "{{date}}",
"remote_id": "{{remote_id}}",
"route_number": "{{route_number}}",
"route_type": "{{route_type}}",
"sequence": {{sequence}},
"status": "{{status}}",
"task_type": "{{task_type}}",
"client_name": "{{client_name}}",
"contacts": "{{contacts}}",
"container_number": "{{container_number}}",
"container_type": "{{container_type}}",
"container_volume": {{container_volume}},
"pickup_coord_x": "{{pickup_coord_x}}",
"pickup_coord_y": "{{pickup_coord_y}}",
"contract_id": "{{contract_id}}",
"waste_type": "{{waste_type}}",
"emptied_volume": "{{emptied_volume}}",
"extra_addition_in_prcnt": "{{extra_addition_in_prcnt}}",
"additional_volume": {{additional_volume}},
"container_full_nearby": "{{container_full_nearby}}",
"execution_time": "{{execution_time}}",
"comment": "{{comment}}",
"additional_information": "{{additional_information}}",
"driver_comment": "{{driver_comment}}",
"client_debt": "{{client_debt}}",
"vehicle": {{vehicle}}
},
{
"remote_id": "string",
"date": "2019-08-24",
"route_number": "string",
"sequence": 2147483647,
"address": "string",
"client_name": "string",
"contacts": "string",
"container_number": "string",
"container_volume": {{container_volume}},
"coord_x": {{coord_x}},
"coord_y": {{coord_y}},
"pickup_coord_x": {{pickup_coord_x}},
"pickup_coord_y": {{pickup_coord_y}},
"contract_id": "string",
"waste_type": "string",
"task_type": "string",
"route_type": "string",
"emptied_volume": {{emptied_volume}},
"extra_addition_in_prcnt": {{extra_addition_in_prcnt}},
"additional_volume": {{additional_volume}},
"container_full_nearby": "string",
"execution_time": "2019-08-24T14:15:22Z",
"status": "string",
"comment": "string",
"additional_information": "string",
"driver_comment": "string",
"client_debt": 0.1,
"driver": 3,
"vehicle": {{vehicle}}
}]
}
script:pre-request {
const { faker } = require("@faker-js/faker");
bru.setVar("address", faker.location.streetAddress({ useFullAddress:true }));
bru.setVar("coord_x", faker.location.longitude({ precision: 6 }));
bru.setVar("coord_y", faker.location.latitude({ precision: 6 }));
bru.setVar("date", faker.date.anytime().toISOString().split("T")[0]);
bru.setVar("remote_id", `T-${String(faker.number.int({ min: 1, max: 999 })).padStart(3, '0')}`);
bru.setVar("route_number", `R-${String(faker.number.int({ min: 1, max: 999 })).padStart(3, '0')}`);
bru.setVar("route_type", "Test");
bru.setVar("sequence", faker.number.int({ min: 1, max: 50 }));
bru.setVar("status", faker.helpers.arrayElement(["Pending", "Completed", "Not Completed", "Blocked", "Customer Unavailable"]));
bru.setVar("task_type", faker.helpers.arrayElement(["SA", "NE"]));
bru.setVar("client_name", faker.person.fullName());
bru.setVar("contacts", faker.phone.number({ style: "international" }));
bru.setVar("container_number", `C-${String(faker.number.int({ min: 1, max: 9999 })).padStart(4, '0')}`);
bru.setVar("container_type", faker.helpers.arrayElement(["STD", "BIO", "REC", "45M3"]));
bru.setVar("container_volume", faker.number.float({ multipleOf: 0.25, min: 0.25, max: 50 }));
bru.setVar("pickup_coord_x", faker.location.longitude({ precision: 6 }));
bru.setVar("pickup_coord_y", faker.location.latitude({ precision: 6 }));
bru.setVar("contract_id", `CONTRACT-${String(faker.number.int({ min: 1, max: 999 })).padStart(3, '0')}`);
bru.setVar("waste_type", faker.helpers.arrayElement(["STD", "ELEC", "NON_STD"]));
bru.setVar("emptied_volume", faker.number.int({ min: 0, max: 1000 }));
bru.setVar("extra_addition_in_prcnt", faker.number.float({ min: 0, max: 100, fractionDigits: 3 }));
bru.setVar("additional_volume", faker.number.float({ multipleOf: 0.25, min: 0, max: 10}));
bru.setVar("container_full_nearby", "yes");
bru.setVar("execution_time", faker.date.anytime().toISOString());
bru.setVar("comment", faker.lorem.sentence());
bru.setVar("additional_information", faker.lorem.sentence());
bru.setVar("driver_comment", faker.lorem.sentence());
bru.setVar("client_debt", faker.number.float());
bru.setVar("driver", faker.number.int({ min: 2, max: 11 }));
bru.setVar("vehicle", faker.number.int({ min: 1, max: 20 }));
}
docs {
Handle POST requests to create ZaaoTask objects in bulk.
}