btrz-api-client 7.32.0 → 7.33.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 +25 -10
- package/package.json +1 -1
- package/src/endpoints/inventory/routes.js +15 -6
- package/test/endpoints/inventory/routes.test.js +55 -6
- package/types/client.d.ts +9 -3
- package/types/endpoints/inventory/routes.d.ts +9 -3
- package/types/initializedClient.d.ts +9 -3
|
@@ -354,32 +354,47 @@ function routesFactory(_ref) {
|
|
|
354
354
|
}
|
|
355
355
|
};
|
|
356
356
|
|
|
357
|
-
var
|
|
358
|
-
|
|
357
|
+
var prorationTables = {
|
|
358
|
+
all: function all(_ref23) {
|
|
359
359
|
var token = _ref23.token,
|
|
360
360
|
jwtToken = _ref23.jwtToken,
|
|
361
|
-
|
|
362
|
-
|
|
361
|
+
_ref23$query = _ref23.query,
|
|
362
|
+
query = _ref23$query === undefined ? {} : _ref23$query,
|
|
363
363
|
headers = _ref23.headers;
|
|
364
364
|
|
|
365
|
-
var query = productId ? { productId: productId } : {};
|
|
366
365
|
return client({
|
|
367
|
-
url: "/routes/
|
|
366
|
+
url: "/routes/proration-tables",
|
|
368
367
|
params: query,
|
|
369
368
|
headers: authorizationHeaders({
|
|
370
369
|
token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
|
|
371
370
|
})
|
|
372
371
|
});
|
|
373
372
|
},
|
|
374
|
-
|
|
373
|
+
getByRouteId: function getByRouteId(_ref24) {
|
|
375
374
|
var token = _ref24.token,
|
|
376
375
|
jwtToken = _ref24.jwtToken,
|
|
377
376
|
routeId = _ref24.routeId,
|
|
378
|
-
|
|
377
|
+
productId = _ref24.productId,
|
|
379
378
|
headers = _ref24.headers;
|
|
380
379
|
|
|
380
|
+
var query = productId ? { productId: productId } : {};
|
|
381
|
+
return client({
|
|
382
|
+
url: "/routes/" + routeId + "/proration-tables",
|
|
383
|
+
params: query,
|
|
384
|
+
headers: authorizationHeaders({
|
|
385
|
+
token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
|
|
386
|
+
})
|
|
387
|
+
});
|
|
388
|
+
},
|
|
389
|
+
updateByRouteId: function updateByRouteId(_ref25) {
|
|
390
|
+
var token = _ref25.token,
|
|
391
|
+
jwtToken = _ref25.jwtToken,
|
|
392
|
+
routeId = _ref25.routeId,
|
|
393
|
+
prorationTableData = _ref25.prorationTable,
|
|
394
|
+
headers = _ref25.headers;
|
|
395
|
+
|
|
381
396
|
return client({
|
|
382
|
-
url: "/routes/" + routeId + "/proration-
|
|
397
|
+
url: "/routes/" + routeId + "/proration-tables",
|
|
383
398
|
method: "put",
|
|
384
399
|
headers: authorizationHeaders({
|
|
385
400
|
token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
|
|
@@ -404,7 +419,7 @@ function routesFactory(_ref) {
|
|
|
404
419
|
fareRules: fareRules,
|
|
405
420
|
priceBuckets: priceBuckets,
|
|
406
421
|
crossBorderDistances: crossBorderDistances,
|
|
407
|
-
|
|
422
|
+
prorationTables: prorationTables
|
|
408
423
|
};
|
|
409
424
|
}
|
|
410
425
|
|
package/package.json
CHANGED
|
@@ -231,20 +231,29 @@ function routesFactory({client, internalAuthTokenProvider}) {
|
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
233
|
|
|
234
|
-
const
|
|
235
|
-
|
|
234
|
+
const prorationTables = {
|
|
235
|
+
all({token, jwtToken, query = {}, headers}) {
|
|
236
|
+
return client({
|
|
237
|
+
url: "/routes/proration-tables",
|
|
238
|
+
params: query,
|
|
239
|
+
headers: authorizationHeaders({
|
|
240
|
+
token, jwtToken, internalAuthTokenProvider, headers
|
|
241
|
+
})
|
|
242
|
+
});
|
|
243
|
+
},
|
|
244
|
+
getByRouteId({token, jwtToken, routeId, productId, headers}) {
|
|
236
245
|
const query = productId ? {productId} : {};
|
|
237
246
|
return client({
|
|
238
|
-
url: `/routes/${routeId}/proration-
|
|
247
|
+
url: `/routes/${routeId}/proration-tables`,
|
|
239
248
|
params: query,
|
|
240
249
|
headers: authorizationHeaders({
|
|
241
250
|
token, jwtToken, internalAuthTokenProvider, headers
|
|
242
251
|
})
|
|
243
252
|
});
|
|
244
253
|
},
|
|
245
|
-
|
|
254
|
+
updateByRouteId({token, jwtToken, routeId, prorationTable: prorationTableData, headers}) {
|
|
246
255
|
return client({
|
|
247
|
-
url: `/routes/${routeId}/proration-
|
|
256
|
+
url: `/routes/${routeId}/proration-tables`,
|
|
248
257
|
method: "put",
|
|
249
258
|
headers: authorizationHeaders({
|
|
250
259
|
token, jwtToken, internalAuthTokenProvider, headers
|
|
@@ -269,7 +278,7 @@ function routesFactory({client, internalAuthTokenProvider}) {
|
|
|
269
278
|
fareRules,
|
|
270
279
|
priceBuckets,
|
|
271
280
|
crossBorderDistances,
|
|
272
|
-
|
|
281
|
+
prorationTables
|
|
273
282
|
};
|
|
274
283
|
}
|
|
275
284
|
|
|
@@ -107,6 +107,16 @@ describe("inventory/route", () => {
|
|
|
107
107
|
});
|
|
108
108
|
});
|
|
109
109
|
|
|
110
|
+
it("should get fare-rules", () => {
|
|
111
|
+
const routeId = "507f1f77bcf86cd799439011";
|
|
112
|
+
axiosMock.onGet(`/routes/${routeId}/fare-rules`).reply(expectRequest({
|
|
113
|
+
statusCode: 200, token, jwtToken
|
|
114
|
+
}));
|
|
115
|
+
return api.inventory.routes.fareRules.get({
|
|
116
|
+
jwtToken, token, routeId
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
|
|
110
120
|
it("should create a fare-rule", () => {
|
|
111
121
|
const routeId = "507f1f77bcf86cd799439011";
|
|
112
122
|
const fareRule = {
|
|
@@ -161,6 +171,16 @@ describe("inventory/route", () => {
|
|
|
161
171
|
});
|
|
162
172
|
});
|
|
163
173
|
|
|
174
|
+
it("should get price-buckets", () => {
|
|
175
|
+
const routeId = "507f1f77bcf86cd799439011";
|
|
176
|
+
axiosMock.onGet(`/routes/${routeId}/price-buckets`).reply(expectRequest({
|
|
177
|
+
statusCode: 200, token, jwtToken
|
|
178
|
+
}));
|
|
179
|
+
return api.inventory.routes.priceBuckets.get({
|
|
180
|
+
jwtToken, token, routeId
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
|
|
164
184
|
it("should create a price-bucket", () => {
|
|
165
185
|
const routeId = "507f1f77bcf86cd799439011";
|
|
166
186
|
const bucket = {
|
|
@@ -226,12 +246,41 @@ describe("inventory/route", () => {
|
|
|
226
246
|
});
|
|
227
247
|
});
|
|
228
248
|
|
|
249
|
+
it("should get all the proration-tables", () => {
|
|
250
|
+
axiosMock.onGet("/routes/proration-tables").reply(expectRequest({
|
|
251
|
+
statusCode: 200, token, jwtToken
|
|
252
|
+
}));
|
|
253
|
+
return api.inventory.routes.prorationTables.all({
|
|
254
|
+
jwtToken, token
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
it("should get a proration-table by routeId", () => {
|
|
259
|
+
const routeId = "507f1f77bcf86cd799439011";
|
|
260
|
+
axiosMock.onGet("/routes/proration-tables", {params: {routeId}}).reply(expectRequest({
|
|
261
|
+
statusCode: 200, token, jwtToken
|
|
262
|
+
}));
|
|
263
|
+
return api.inventory.routes.prorationTables.all({
|
|
264
|
+
jwtToken, token, query: {routeId}
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
it("should get a proration-table by productId", () => {
|
|
269
|
+
const productId = "507f1f77bcf86cd799439012";
|
|
270
|
+
axiosMock.onGet("/routes/proration-tables", {params: {productId}}).reply(expectRequest({
|
|
271
|
+
statusCode: 200, token, jwtToken, query: {productId}
|
|
272
|
+
}));
|
|
273
|
+
return api.inventory.routes.prorationTables.all({
|
|
274
|
+
jwtToken, token, query: {productId}
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
|
|
229
278
|
it("should get a proration-table without productId", () => {
|
|
230
279
|
const routeId = "507f1f77bcf86cd799439011";
|
|
231
|
-
axiosMock.onGet(`/routes/${routeId}/proration-
|
|
280
|
+
axiosMock.onGet(`/routes/${routeId}/proration-tables`).reply(expectRequest({
|
|
232
281
|
statusCode: 200, token, jwtToken
|
|
233
282
|
}));
|
|
234
|
-
return api.inventory.routes.
|
|
283
|
+
return api.inventory.routes.prorationTables.getByRouteId({
|
|
235
284
|
jwtToken, token, routeId
|
|
236
285
|
});
|
|
237
286
|
});
|
|
@@ -239,10 +288,10 @@ describe("inventory/route", () => {
|
|
|
239
288
|
it("should get a proration-table with productId", () => {
|
|
240
289
|
const routeId = "507f1f77bcf86cd799439011";
|
|
241
290
|
const productId = "507f1f77bcf86cd799439012";
|
|
242
|
-
axiosMock.onGet(`/routes/${routeId}/proration-
|
|
291
|
+
axiosMock.onGet(`/routes/${routeId}/proration-tables`, {params: {productId}}).reply(expectRequest({
|
|
243
292
|
statusCode: 200, token, jwtToken, query: {productId}
|
|
244
293
|
}));
|
|
245
|
-
return api.inventory.routes.
|
|
294
|
+
return api.inventory.routes.prorationTables.getByRouteId({
|
|
246
295
|
jwtToken, token, routeId, productId
|
|
247
296
|
});
|
|
248
297
|
});
|
|
@@ -258,10 +307,10 @@ describe("inventory/route", () => {
|
|
|
258
307
|
}
|
|
259
308
|
}
|
|
260
309
|
};
|
|
261
|
-
axiosMock.onPut(`/routes/${routeId}/proration-
|
|
310
|
+
axiosMock.onPut(`/routes/${routeId}/proration-tables`).reply(expectRequest({
|
|
262
311
|
statusCode: 200, token, jwtToken
|
|
263
312
|
}));
|
|
264
|
-
return api.inventory.routes.
|
|
313
|
+
return api.inventory.routes.prorationTables.updateByRouteId({
|
|
265
314
|
jwtToken, token, routeId, prorationTable
|
|
266
315
|
});
|
|
267
316
|
});
|
package/types/client.d.ts
CHANGED
|
@@ -1434,15 +1434,21 @@ export function createApiClient(options: {
|
|
|
1434
1434
|
headers: any;
|
|
1435
1435
|
}): any;
|
|
1436
1436
|
};
|
|
1437
|
-
|
|
1438
|
-
|
|
1437
|
+
prorationTables: {
|
|
1438
|
+
all({ token, jwtToken, query, headers }: {
|
|
1439
|
+
token: any;
|
|
1440
|
+
jwtToken: any;
|
|
1441
|
+
query?: {};
|
|
1442
|
+
headers: any;
|
|
1443
|
+
}): any;
|
|
1444
|
+
getByRouteId({ token, jwtToken, routeId, productId, headers }: {
|
|
1439
1445
|
token: any;
|
|
1440
1446
|
jwtToken: any;
|
|
1441
1447
|
routeId: any;
|
|
1442
1448
|
productId: any;
|
|
1443
1449
|
headers: any;
|
|
1444
1450
|
}): any;
|
|
1445
|
-
|
|
1451
|
+
updateByRouteId({ token, jwtToken, routeId, prorationTable: prorationTableData, headers }: {
|
|
1446
1452
|
token: any;
|
|
1447
1453
|
jwtToken: any;
|
|
1448
1454
|
routeId: any;
|
|
@@ -153,15 +153,21 @@ declare function routesFactory({ client, internalAuthTokenProvider }: {
|
|
|
153
153
|
headers: any;
|
|
154
154
|
}): any;
|
|
155
155
|
};
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
prorationTables: {
|
|
157
|
+
all({ token, jwtToken, query, headers }: {
|
|
158
|
+
token: any;
|
|
159
|
+
jwtToken: any;
|
|
160
|
+
query?: {};
|
|
161
|
+
headers: any;
|
|
162
|
+
}): any;
|
|
163
|
+
getByRouteId({ token, jwtToken, routeId, productId, headers }: {
|
|
158
164
|
token: any;
|
|
159
165
|
jwtToken: any;
|
|
160
166
|
routeId: any;
|
|
161
167
|
productId: any;
|
|
162
168
|
headers: any;
|
|
163
169
|
}): any;
|
|
164
|
-
|
|
170
|
+
updateByRouteId({ token, jwtToken, routeId, prorationTable: prorationTableData, headers }: {
|
|
165
171
|
token: any;
|
|
166
172
|
jwtToken: any;
|
|
167
173
|
routeId: any;
|
|
@@ -1388,15 +1388,21 @@ declare const _exports: {
|
|
|
1388
1388
|
headers: any;
|
|
1389
1389
|
}): any;
|
|
1390
1390
|
};
|
|
1391
|
-
|
|
1392
|
-
|
|
1391
|
+
prorationTables: {
|
|
1392
|
+
all({ token, jwtToken, query, headers }: {
|
|
1393
|
+
token: any;
|
|
1394
|
+
jwtToken: any;
|
|
1395
|
+
query?: {};
|
|
1396
|
+
headers: any;
|
|
1397
|
+
}): any;
|
|
1398
|
+
getByRouteId({ token, jwtToken, routeId, productId, headers }: {
|
|
1393
1399
|
token: any;
|
|
1394
1400
|
jwtToken: any;
|
|
1395
1401
|
routeId: any;
|
|
1396
1402
|
productId: any;
|
|
1397
1403
|
headers: any;
|
|
1398
1404
|
}): any;
|
|
1399
|
-
|
|
1405
|
+
updateByRouteId({ token, jwtToken, routeId, prorationTable: prorationTableData, headers }: {
|
|
1400
1406
|
token: any;
|
|
1401
1407
|
jwtToken: any;
|
|
1402
1408
|
routeId: any;
|