@@ -43,6 +43,28 @@ def self.vrp_request_service(this)
43
43
end
44
44
this . mutually_exclusive :activity , :activities
45
45
end
46
+
47
+ def self . vrp_request_vehicle ( this )
48
+ this . requires ( :id , type : String , allow_blank : false )
49
+ this . optional ( :cost_time_multiplier , type : Float )
50
+
51
+ this . optional ( :matrix_id , type : String )
52
+ this . optional ( :router_mode , type : String )
53
+ this . exactly_one_of :matrix_id , :router_mode
54
+
55
+ this . optional ( :skills , type : Array [ Array [ String ] ] )
56
+
57
+ this . optional ( :start_point_id , type : String )
58
+ this . optional ( :end_point_id , type : String )
59
+
60
+ this . optional ( :sequence_timewindows , type : Array ) do
61
+ Vrp . vrp_request_timewindow ( self )
62
+ end
63
+ this . optional ( :timewindow , type : Hash ) do
64
+ Vrp . vrp_request_timewindow ( self )
65
+ end
66
+ this . mutually_exclusive :sequence_timewindows , :timewindow
67
+ end
46
68
end
47
69
48
70
namespace :vrp do
@@ -57,6 +79,10 @@ def self.vrp_request_service(this)
57
79
optional ( :services , type : Array ) do
58
80
Vrp . vrp_request_service ( self )
59
81
end
82
+
83
+ optional ( :vehicles , type : Array ) do
84
+ Vrp . vrp_request_vehicle ( self )
85
+ end
60
86
end
61
87
end
62
88
post do
@@ -187,4 +213,72 @@ def self.vrp_request_service(this)
187
213
)
188
214
end
189
215
end
216
+
217
+ describe 'Correctness of vrp Vehicles' do
218
+ let ( :get_points_response ) { subject [ 'definitions' ] [ 'postVrpSubmit' ] [ 'properties' ] [ 'vrp' ] [ 'properties' ] [ 'vehicles' ] }
219
+ specify do
220
+ expect ( get_points_response ) . to eql (
221
+ 'type' => 'array' ,
222
+ 'items' => {
223
+ 'type' => 'object' ,
224
+ 'properties' => {
225
+ 'id' => {
226
+ 'type' => 'string'
227
+ } ,
228
+ 'cost_time_multiplier' => {
229
+ 'type' => 'float' ,
230
+ 'format' => 'number'
231
+ } ,
232
+ 'matrix_id' => {
233
+ 'type' => 'string'
234
+ } ,
235
+ 'router_mode' => {
236
+ 'type' => 'string'
237
+ } ,
238
+ 'skills' => {
239
+ 'type' => 'array' ,
240
+ 'items' => {
241
+ 'type' => 'array' ,
242
+ 'items' => {
243
+ 'type' => 'string'
244
+ }
245
+ }
246
+ } ,
247
+ 'start_point_id' => {
248
+ 'type' => 'string'
249
+ } ,
250
+ 'end_point_id' => {
251
+ 'type' => 'string'
252
+ } ,
253
+ 'timewindow' => {
254
+ 'type' => 'object' ,
255
+ 'properties' => {
256
+ 'start' => {
257
+ 'type' => 'string'
258
+ } ,
259
+ 'end' => {
260
+ 'type' => 'string'
261
+ }
262
+ }
263
+ } ,
264
+ 'sequence_timewindows' => {
265
+ 'type' => 'array' ,
266
+ 'items' => {
267
+ 'type' => 'object' ,
268
+ 'properties' => {
269
+ 'start' => {
270
+ 'type' => 'string'
271
+ } ,
272
+ 'end' => {
273
+ 'type' => 'string'
274
+ }
275
+ }
276
+ }
277
+ }
278
+ } ,
279
+ 'required' => [ 'id' ]
280
+ }
281
+ )
282
+ end
283
+ end
190
284
end
0 commit comments