btrz-api-client 7.31.1 → 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.
@@ -354,6 +354,58 @@ function routesFactory(_ref) {
354
354
  }
355
355
  };
356
356
 
357
+ var prorationTables = {
358
+ all: function all(_ref23) {
359
+ var token = _ref23.token,
360
+ jwtToken = _ref23.jwtToken,
361
+ _ref23$query = _ref23.query,
362
+ query = _ref23$query === undefined ? {} : _ref23$query,
363
+ headers = _ref23.headers;
364
+
365
+ return client({
366
+ url: "/routes/proration-tables",
367
+ params: query,
368
+ headers: authorizationHeaders({
369
+ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
370
+ })
371
+ });
372
+ },
373
+ getByRouteId: function getByRouteId(_ref24) {
374
+ var token = _ref24.token,
375
+ jwtToken = _ref24.jwtToken,
376
+ routeId = _ref24.routeId,
377
+ productId = _ref24.productId,
378
+ headers = _ref24.headers;
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
+
396
+ return client({
397
+ url: "/routes/" + routeId + "/proration-tables",
398
+ method: "put",
399
+ headers: authorizationHeaders({
400
+ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
401
+ }),
402
+ data: {
403
+ prorationTable: prorationTableData
404
+ }
405
+ });
406
+ }
407
+ };
408
+
357
409
  return {
358
410
  get: get,
359
411
  prices: prices,
@@ -366,7 +418,8 @@ function routesFactory(_ref) {
366
418
  stops: stops,
367
419
  fareRules: fareRules,
368
420
  priceBuckets: priceBuckets,
369
- crossBorderDistances: crossBorderDistances
421
+ crossBorderDistances: crossBorderDistances,
422
+ prorationTables: prorationTables
370
423
  };
371
424
  }
372
425
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "7.31.1",
3
+ "version": "7.33.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -231,6 +231,40 @@ function routesFactory({client, internalAuthTokenProvider}) {
231
231
  }
232
232
  };
233
233
 
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}) {
245
+ const query = productId ? {productId} : {};
246
+ return client({
247
+ url: `/routes/${routeId}/proration-tables`,
248
+ params: query,
249
+ headers: authorizationHeaders({
250
+ token, jwtToken, internalAuthTokenProvider, headers
251
+ })
252
+ });
253
+ },
254
+ updateByRouteId({token, jwtToken, routeId, prorationTable: prorationTableData, headers}) {
255
+ return client({
256
+ url: `/routes/${routeId}/proration-tables`,
257
+ method: "put",
258
+ headers: authorizationHeaders({
259
+ token, jwtToken, internalAuthTokenProvider, headers
260
+ }),
261
+ data: {
262
+ prorationTable: prorationTableData
263
+ }
264
+ });
265
+ }
266
+ };
267
+
234
268
  return {
235
269
  get,
236
270
  prices,
@@ -243,7 +277,8 @@ function routesFactory({client, internalAuthTokenProvider}) {
243
277
  stops,
244
278
  fareRules,
245
279
  priceBuckets,
246
- crossBorderDistances
280
+ crossBorderDistances,
281
+ prorationTables
247
282
  };
248
283
  }
249
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 = {
@@ -225,4 +245,73 @@ describe("inventory/route", () => {
225
245
  jwtToken, token, routeId, crossBorderDistances
226
246
  });
227
247
  });
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
+
278
+ it("should get a proration-table without productId", () => {
279
+ const routeId = "507f1f77bcf86cd799439011";
280
+ axiosMock.onGet(`/routes/${routeId}/proration-tables`).reply(expectRequest({
281
+ statusCode: 200, token, jwtToken
282
+ }));
283
+ return api.inventory.routes.prorationTables.getByRouteId({
284
+ jwtToken, token, routeId
285
+ });
286
+ });
287
+
288
+ it("should get a proration-table with productId", () => {
289
+ const routeId = "507f1f77bcf86cd799439011";
290
+ const productId = "507f1f77bcf86cd799439012";
291
+ axiosMock.onGet(`/routes/${routeId}/proration-tables`, {params: {productId}}).reply(expectRequest({
292
+ statusCode: 200, token, jwtToken, query: {productId}
293
+ }));
294
+ return api.inventory.routes.prorationTables.getByRouteId({
295
+ jwtToken, token, routeId, productId
296
+ });
297
+ });
298
+
299
+ it("should update a proration-table", () => {
300
+ const routeId = "507f1f77bcf86cd799439011";
301
+ const prorationTable = {
302
+ productId: "507f1f77bcf86cd799439012",
303
+ faresById: {
304
+ "stop-1": {
305
+ "stop-2": 100,
306
+ "stop-3": 150
307
+ }
308
+ }
309
+ };
310
+ axiosMock.onPut(`/routes/${routeId}/proration-tables`).reply(expectRequest({
311
+ statusCode: 200, token, jwtToken
312
+ }));
313
+ return api.inventory.routes.prorationTables.updateByRouteId({
314
+ jwtToken, token, routeId, prorationTable
315
+ });
316
+ });
228
317
  });
package/types/client.d.ts CHANGED
@@ -1434,6 +1434,28 @@ export function createApiClient(options: {
1434
1434
  headers: any;
1435
1435
  }): any;
1436
1436
  };
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 }: {
1445
+ token: any;
1446
+ jwtToken: any;
1447
+ routeId: any;
1448
+ productId: any;
1449
+ headers: any;
1450
+ }): any;
1451
+ updateByRouteId({ token, jwtToken, routeId, prorationTable: prorationTableData, headers }: {
1452
+ token: any;
1453
+ jwtToken: any;
1454
+ routeId: any;
1455
+ prorationTable: any;
1456
+ headers: any;
1457
+ }): any;
1458
+ };
1437
1459
  };
1438
1460
  scheduleGroups: {
1439
1461
  all: ({ token, jwtToken, query, headers }: {
@@ -153,4 +153,26 @@ declare function routesFactory({ client, internalAuthTokenProvider }: {
153
153
  headers: any;
154
154
  }): any;
155
155
  };
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 }: {
164
+ token: any;
165
+ jwtToken: any;
166
+ routeId: any;
167
+ productId: any;
168
+ headers: any;
169
+ }): any;
170
+ updateByRouteId({ token, jwtToken, routeId, prorationTable: prorationTableData, headers }: {
171
+ token: any;
172
+ jwtToken: any;
173
+ routeId: any;
174
+ prorationTable: any;
175
+ headers: any;
176
+ }): any;
177
+ };
156
178
  };
@@ -1388,6 +1388,28 @@ declare const _exports: {
1388
1388
  headers: any;
1389
1389
  }): any;
1390
1390
  };
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 }: {
1399
+ token: any;
1400
+ jwtToken: any;
1401
+ routeId: any;
1402
+ productId: any;
1403
+ headers: any;
1404
+ }): any;
1405
+ updateByRouteId({ token, jwtToken, routeId, prorationTable: prorationTableData, headers }: {
1406
+ token: any;
1407
+ jwtToken: any;
1408
+ routeId: any;
1409
+ prorationTable: any;
1410
+ headers: any;
1411
+ }): any;
1412
+ };
1391
1413
  };
1392
1414
  scheduleGroups: {
1393
1415
  all: ({ token, jwtToken, query, headers }: {