btrz-api-client 7.31.1 → 7.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client-standalone-min.js +1 -1
- package/lib/endpoints/inventory/routes.js +39 -1
- package/package.json +1 -1
- package/src/endpoints/inventory/routes.js +27 -1
- package/test/endpoints/inventory/routes.test.js +40 -0
- package/types/client.d.ts +16 -0
- package/types/endpoints/inventory/routes.d.ts +16 -0
- package/types/initializedClient.d.ts +16 -0
|
@@ -354,6 +354,43 @@ function routesFactory(_ref) {
|
|
|
354
354
|
}
|
|
355
355
|
};
|
|
356
356
|
|
|
357
|
+
var prorationTable = {
|
|
358
|
+
get: function get(_ref23) {
|
|
359
|
+
var token = _ref23.token,
|
|
360
|
+
jwtToken = _ref23.jwtToken,
|
|
361
|
+
routeId = _ref23.routeId,
|
|
362
|
+
productId = _ref23.productId,
|
|
363
|
+
headers = _ref23.headers;
|
|
364
|
+
|
|
365
|
+
var query = productId ? { productId: productId } : {};
|
|
366
|
+
return client({
|
|
367
|
+
url: "/routes/" + routeId + "/proration-table",
|
|
368
|
+
params: query,
|
|
369
|
+
headers: authorizationHeaders({
|
|
370
|
+
token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
|
|
371
|
+
})
|
|
372
|
+
});
|
|
373
|
+
},
|
|
374
|
+
update: function update(_ref24) {
|
|
375
|
+
var token = _ref24.token,
|
|
376
|
+
jwtToken = _ref24.jwtToken,
|
|
377
|
+
routeId = _ref24.routeId,
|
|
378
|
+
prorationTableData = _ref24.prorationTable,
|
|
379
|
+
headers = _ref24.headers;
|
|
380
|
+
|
|
381
|
+
return client({
|
|
382
|
+
url: "/routes/" + routeId + "/proration-table",
|
|
383
|
+
method: "put",
|
|
384
|
+
headers: authorizationHeaders({
|
|
385
|
+
token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
|
|
386
|
+
}),
|
|
387
|
+
data: {
|
|
388
|
+
prorationTable: prorationTableData
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
|
|
357
394
|
return {
|
|
358
395
|
get: get,
|
|
359
396
|
prices: prices,
|
|
@@ -366,7 +403,8 @@ function routesFactory(_ref) {
|
|
|
366
403
|
stops: stops,
|
|
367
404
|
fareRules: fareRules,
|
|
368
405
|
priceBuckets: priceBuckets,
|
|
369
|
-
crossBorderDistances: crossBorderDistances
|
|
406
|
+
crossBorderDistances: crossBorderDistances,
|
|
407
|
+
prorationTable: prorationTable
|
|
370
408
|
};
|
|
371
409
|
}
|
|
372
410
|
|
package/package.json
CHANGED
|
@@ -231,6 +231,31 @@ function routesFactory({client, internalAuthTokenProvider}) {
|
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
233
|
|
|
234
|
+
const prorationTable = {
|
|
235
|
+
get({token, jwtToken, routeId, productId, headers}) {
|
|
236
|
+
const query = productId ? {productId} : {};
|
|
237
|
+
return client({
|
|
238
|
+
url: `/routes/${routeId}/proration-table`,
|
|
239
|
+
params: query,
|
|
240
|
+
headers: authorizationHeaders({
|
|
241
|
+
token, jwtToken, internalAuthTokenProvider, headers
|
|
242
|
+
})
|
|
243
|
+
});
|
|
244
|
+
},
|
|
245
|
+
update({token, jwtToken, routeId, prorationTable: prorationTableData, headers}) {
|
|
246
|
+
return client({
|
|
247
|
+
url: `/routes/${routeId}/proration-table`,
|
|
248
|
+
method: "put",
|
|
249
|
+
headers: authorizationHeaders({
|
|
250
|
+
token, jwtToken, internalAuthTokenProvider, headers
|
|
251
|
+
}),
|
|
252
|
+
data: {
|
|
253
|
+
prorationTable: prorationTableData
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
|
|
234
259
|
return {
|
|
235
260
|
get,
|
|
236
261
|
prices,
|
|
@@ -243,7 +268,8 @@ function routesFactory({client, internalAuthTokenProvider}) {
|
|
|
243
268
|
stops,
|
|
244
269
|
fareRules,
|
|
245
270
|
priceBuckets,
|
|
246
|
-
crossBorderDistances
|
|
271
|
+
crossBorderDistances,
|
|
272
|
+
prorationTable
|
|
247
273
|
};
|
|
248
274
|
}
|
|
249
275
|
|
|
@@ -225,4 +225,44 @@ describe("inventory/route", () => {
|
|
|
225
225
|
jwtToken, token, routeId, crossBorderDistances
|
|
226
226
|
});
|
|
227
227
|
});
|
|
228
|
+
|
|
229
|
+
it("should get a proration-table without productId", () => {
|
|
230
|
+
const routeId = "507f1f77bcf86cd799439011";
|
|
231
|
+
axiosMock.onGet(`/routes/${routeId}/proration-table`).reply(expectRequest({
|
|
232
|
+
statusCode: 200, token, jwtToken
|
|
233
|
+
}));
|
|
234
|
+
return api.inventory.routes.prorationTable.get({
|
|
235
|
+
jwtToken, token, routeId
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
it("should get a proration-table with productId", () => {
|
|
240
|
+
const routeId = "507f1f77bcf86cd799439011";
|
|
241
|
+
const productId = "507f1f77bcf86cd799439012";
|
|
242
|
+
axiosMock.onGet(`/routes/${routeId}/proration-table`, {params: {productId}}).reply(expectRequest({
|
|
243
|
+
statusCode: 200, token, jwtToken, query: {productId}
|
|
244
|
+
}));
|
|
245
|
+
return api.inventory.routes.prorationTable.get({
|
|
246
|
+
jwtToken, token, routeId, productId
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
it("should update a proration-table", () => {
|
|
251
|
+
const routeId = "507f1f77bcf86cd799439011";
|
|
252
|
+
const prorationTable = {
|
|
253
|
+
productId: "507f1f77bcf86cd799439012",
|
|
254
|
+
faresById: {
|
|
255
|
+
"stop-1": {
|
|
256
|
+
"stop-2": 100,
|
|
257
|
+
"stop-3": 150
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
axiosMock.onPut(`/routes/${routeId}/proration-table`).reply(expectRequest({
|
|
262
|
+
statusCode: 200, token, jwtToken
|
|
263
|
+
}));
|
|
264
|
+
return api.inventory.routes.prorationTable.update({
|
|
265
|
+
jwtToken, token, routeId, prorationTable
|
|
266
|
+
});
|
|
267
|
+
});
|
|
228
268
|
});
|
package/types/client.d.ts
CHANGED
|
@@ -1434,6 +1434,22 @@ export function createApiClient(options: {
|
|
|
1434
1434
|
headers: any;
|
|
1435
1435
|
}): any;
|
|
1436
1436
|
};
|
|
1437
|
+
prorationTable: {
|
|
1438
|
+
get({ token, jwtToken, routeId, productId, headers }: {
|
|
1439
|
+
token: any;
|
|
1440
|
+
jwtToken: any;
|
|
1441
|
+
routeId: any;
|
|
1442
|
+
productId: any;
|
|
1443
|
+
headers: any;
|
|
1444
|
+
}): any;
|
|
1445
|
+
update({ token, jwtToken, routeId, prorationTable: prorationTableData, headers }: {
|
|
1446
|
+
token: any;
|
|
1447
|
+
jwtToken: any;
|
|
1448
|
+
routeId: any;
|
|
1449
|
+
prorationTable: any;
|
|
1450
|
+
headers: any;
|
|
1451
|
+
}): any;
|
|
1452
|
+
};
|
|
1437
1453
|
};
|
|
1438
1454
|
scheduleGroups: {
|
|
1439
1455
|
all: ({ token, jwtToken, query, headers }: {
|
|
@@ -153,4 +153,20 @@ declare function routesFactory({ client, internalAuthTokenProvider }: {
|
|
|
153
153
|
headers: any;
|
|
154
154
|
}): any;
|
|
155
155
|
};
|
|
156
|
+
prorationTable: {
|
|
157
|
+
get({ token, jwtToken, routeId, productId, headers }: {
|
|
158
|
+
token: any;
|
|
159
|
+
jwtToken: any;
|
|
160
|
+
routeId: any;
|
|
161
|
+
productId: any;
|
|
162
|
+
headers: any;
|
|
163
|
+
}): any;
|
|
164
|
+
update({ token, jwtToken, routeId, prorationTable: prorationTableData, headers }: {
|
|
165
|
+
token: any;
|
|
166
|
+
jwtToken: any;
|
|
167
|
+
routeId: any;
|
|
168
|
+
prorationTable: any;
|
|
169
|
+
headers: any;
|
|
170
|
+
}): any;
|
|
171
|
+
};
|
|
156
172
|
};
|
|
@@ -1388,6 +1388,22 @@ declare const _exports: {
|
|
|
1388
1388
|
headers: any;
|
|
1389
1389
|
}): any;
|
|
1390
1390
|
};
|
|
1391
|
+
prorationTable: {
|
|
1392
|
+
get({ token, jwtToken, routeId, productId, headers }: {
|
|
1393
|
+
token: any;
|
|
1394
|
+
jwtToken: any;
|
|
1395
|
+
routeId: any;
|
|
1396
|
+
productId: any;
|
|
1397
|
+
headers: any;
|
|
1398
|
+
}): any;
|
|
1399
|
+
update({ token, jwtToken, routeId, prorationTable: prorationTableData, headers }: {
|
|
1400
|
+
token: any;
|
|
1401
|
+
jwtToken: any;
|
|
1402
|
+
routeId: any;
|
|
1403
|
+
prorationTable: any;
|
|
1404
|
+
headers: any;
|
|
1405
|
+
}): any;
|
|
1406
|
+
};
|
|
1391
1407
|
};
|
|
1392
1408
|
scheduleGroups: {
|
|
1393
1409
|
all: ({ token, jwtToken, query, headers }: {
|