seatsio 65.2.0 → 65.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seatsio",
3
- "version": "65.2.0",
3
+ "version": "65.3.0",
4
4
  "main": "index.js",
5
5
  "description": "Official JavaScript and Node.JS client library for the Seats.io REST API",
6
6
  "license": "MIT",
@@ -25,11 +25,11 @@ class ChartReports {
25
25
 
26
26
  /**
27
27
  * @param {string} chartKey
28
+ * @param {string} bookWholeTables
28
29
  * @returns {Object} JSON response from the server
29
30
  */
30
- summaryByObjectType (chartKey) {
31
- return this.client.get(ChartReports.summaryReportUrl('byObjectType', chartKey))
32
- .then((res) => res.data)
31
+ summaryByObjectType (chartKey, bookWholeTables = undefined) {
32
+ return this.fetchSummaryReport('byObjectType', chartKey, bookWholeTables)
33
33
  }
34
34
 
35
35
  /**
@@ -43,11 +43,11 @@ class ChartReports {
43
43
 
44
44
  /**
45
45
  * @param {string} chartKey
46
+ * @param {string} bookWholeTables
46
47
  * @returns {Object} JSON response from the server
47
48
  */
48
- summaryByCategoryLabel (chartKey) {
49
- return this.client.get(ChartReports.summaryReportUrl('byCategoryLabel', chartKey))
50
- .then((res) => res.data)
49
+ summaryByCategoryLabel (chartKey, bookWholeTables = undefined) {
50
+ return this.fetchSummaryReport('byCategoryLabel', chartKey, bookWholeTables)
51
51
  }
52
52
 
53
53
  /**
@@ -61,11 +61,11 @@ class ChartReports {
61
61
 
62
62
  /**
63
63
  * @param {string} chartKey
64
+ * @param {string} bookWholeTables
64
65
  * @returns {Object} JSON response from the server
65
66
  */
66
- summaryByCategoryKey (chartKey) {
67
- return this.client.get(ChartReports.summaryReportUrl('byCategoryKey', chartKey))
68
- .then((res) => res.data)
67
+ summaryByCategoryKey (chartKey, bookWholeTables = undefined) {
68
+ return this.fetchSummaryReport('byCategoryKey', chartKey, bookWholeTables)
69
69
  }
70
70
 
71
71
  /**
@@ -79,20 +79,21 @@ class ChartReports {
79
79
 
80
80
  /**
81
81
  * @param {string} chartKey
82
+ * @param {string} bookWholeTables
82
83
  * @returns {Object} JSON response from the server
83
84
  */
84
- summaryBySection (chartKey) {
85
- return this.client.get(ChartReports.summaryReportUrl('bySection', chartKey))
86
- .then((res) => res.data)
85
+ summaryBySection (chartKey, bookWholeTables = undefined) {
86
+ return this.fetchSummaryReport('bySection', chartKey, bookWholeTables)
87
87
  }
88
88
 
89
- fetchReport (reportType, eventKey, bookWholeTables) {
90
- return this.client.get(`/reports/charts/${encodeURIComponent(eventKey)}/${reportType}`, { params: { bookWholeTables } })
89
+ fetchReport (reportType, chartKey, bookWholeTables) {
90
+ return this.client.get(`/reports/charts/${encodeURIComponent(chartKey)}/${reportType}`, { params: { bookWholeTables } })
91
91
  .then((res) => utilities.createChartReport(res.data))
92
92
  }
93
93
 
94
- static summaryReportUrl (reportType, eventKey) {
95
- return `/reports/charts/${encodeURIComponent(eventKey)}/${reportType}/summary`
94
+ fetchSummaryReport (reportType, chartKey, bookWholeTables) {
95
+ return this.client.get(`/reports/charts/${encodeURIComponent(chartKey)}/${reportType}/summary`, { params: { bookWholeTables } })
96
+ .then((res) => res.data)
96
97
  }
97
98
  }
98
99
 
@@ -35,6 +35,41 @@ test('summaryByObjectType', async () => {
35
35
  })
36
36
  })
37
37
 
38
+ test('summaryByObjectType_bookWholeTablesTrue', async () => {
39
+ const { client, user } = await testUtils.createTestUserAndClient()
40
+ const chartKey = testUtils.getChartKey()
41
+ await testUtils.createTestChartWithTables(chartKey, user.secretKey)
42
+
43
+ const report = await client.chartReports.summaryByObjectType(chartKey, 'true')
44
+
45
+ expect(report).toEqual({
46
+ seat: {
47
+ count: 0,
48
+ bySection: {},
49
+ byCategoryKey: {},
50
+ byCategoryLabel: {}
51
+ },
52
+ generalAdmission: {
53
+ count: 0,
54
+ bySection: {},
55
+ byCategoryKey: {},
56
+ byCategoryLabel: {}
57
+ },
58
+ table: {
59
+ count: 2,
60
+ bySection: { NO_SECTION: 2 },
61
+ byCategoryKey: { 9: 2 },
62
+ byCategoryLabel: { Cat1: 2 }
63
+ },
64
+ booth: {
65
+ count: 0,
66
+ bySection: {},
67
+ byCategoryKey: {},
68
+ byCategoryLabel: {}
69
+ }
70
+ })
71
+ })
72
+
38
73
  test('summaryByCategoryKey', async () => {
39
74
  const { client, user } = await testUtils.createTestUserAndClient()
40
75
  const chartKey = testUtils.getChartKey()