seatsio 67.8.0 → 68.0.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": "67.8.0",
3
+ "version": "68.0.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",
@@ -14,13 +14,13 @@
14
14
  "url": "https://github.com/seatsio/seatsio-js"
15
15
  },
16
16
  "dependencies": {
17
- "axios": "0.26.0"
17
+ "axios": "0.27.2"
18
18
  },
19
19
  "devDependencies": {
20
20
  "browserify": "latest",
21
21
  "eslint": "7.32.0",
22
22
  "eslint-config-standard": "16.0.3",
23
- "eslint-plugin-import": "2.25.4",
23
+ "eslint-plugin-import": "2.26.0",
24
24
  "eslint-plugin-node": "11.1.0",
25
25
  "eslint-plugin-promise": "6.0.0",
26
26
  "eslint-plugin-standard": "5.0.0",
@@ -30,8 +30,8 @@
30
30
  "gulp-tap": "latest",
31
31
  "gulp-uglify": "latest",
32
32
  "gulp-uglify-es": "latest",
33
- "jest": "27.5.1",
34
- "jest-cli": "27.5.1",
33
+ "jest": "28.0.3",
34
+ "jest-cli": "28.0.3",
35
35
  "uuid": "8.3.2"
36
36
  }
37
37
  }
@@ -46,6 +46,10 @@ class Category {
46
46
  this.accessible = accessible
47
47
  return this
48
48
  }
49
+
50
+ static fromJson (json) {
51
+ return new Category(json.key, json.label, json.color, json.accessible)
52
+ }
49
53
  }
50
54
 
51
55
  module.exports = Category
@@ -1,27 +1,28 @@
1
1
  const ForSaleConfig = require('./ForSaleConfig.js')
2
2
  const Channel = require('./Channel.js')
3
+ const Category = require('../Charts/Category')
3
4
 
4
5
  class Event {
5
6
  /**
6
- * @param {object} event
7
+ * @param {object} json
7
8
  */
8
- constructor (event) {
9
- this.id = event.id
10
- this.key = event.key
11
- this.tableBookingConfig = event.tableBookingConfig
12
- this.supportsBestAvailable = event.supportsBestAvailable
13
- this.forSaleConfig = event.forSaleConfig ? new ForSaleConfig(event.forSaleConfig.forSale, event.forSaleConfig.objects, event.forSaleConfig.categories) : null
14
- this.chartKey = event.chartKey
15
- this.createdOn = event.createdOn ? new Date(event.createdOn) : null
16
- this.updatedOn = event.updatedOn ? new Date(event.updatedOn) : null
17
- this.channels = event.channels ? event.channels.map(c => new Channel(c)) : null
18
- this.socialDistancingRulesetKey = event.socialDistancingRulesetKey
19
- this.topLevelSeasonKey = event.topLevelSeasonKey
20
- this.isTopLevelSeason = event.isTopLevelSeason
21
- this.isPartialSeason = event.isPartialSeason
22
- this.isEventInSeason = event.isEventInSeason
23
- this.objectCategories = event.objectCategories
24
- this.categories = event.categories
9
+ constructor (json) {
10
+ this.id = json.id
11
+ this.key = json.key
12
+ this.tableBookingConfig = json.tableBookingConfig
13
+ this.supportsBestAvailable = json.supportsBestAvailable
14
+ this.forSaleConfig = json.forSaleConfig ? new ForSaleConfig(json.forSaleConfig.forSale, json.forSaleConfig.objects, json.forSaleConfig.categories) : null
15
+ this.chartKey = json.chartKey
16
+ this.createdOn = json.createdOn ? new Date(json.createdOn) : null
17
+ this.updatedOn = json.updatedOn ? new Date(json.updatedOn) : null
18
+ this.channels = json.channels ? json.channels.map(c => new Channel(c)) : null
19
+ this.socialDistancingRulesetKey = json.socialDistancingRulesetKey
20
+ this.topLevelSeasonKey = json.topLevelSeasonKey
21
+ this.isTopLevelSeason = json.isTopLevelSeason
22
+ this.isPartialSeason = json.isPartialSeason
23
+ this.isEventInSeason = json.isEventInSeason
24
+ this.objectCategories = json.objectCategories
25
+ this.categories = json.categories ? json.categories.map(c => Category.fromJson(c)) : null
25
26
  }
26
27
 
27
28
  isSeason () {
@@ -17,6 +17,7 @@ test('should check that only chart key is required', async () => {
17
17
  expect(event.createdOn).toBeInstanceOf(Date)
18
18
  expect(event.forSaleConfig).toBeFalsy()
19
19
  expect(event.updatedOn).toBeFalsy()
20
+ expect(event.categories).toEqual(testUtils.testChartCategories)
20
21
  })
21
22
 
22
23
  test('should pass in event key as a create() param', async () => {
@@ -21,7 +21,7 @@ test('should retrieve event', async () => {
21
21
  expect(retrievedEvent.forSaleConfig).toBeFalsy()
22
22
  expect(retrievedEvent.updatedOn).toBeNull()
23
23
  expect(retrievedEvent.topLevelSeasonKey).toBe(undefined)
24
- expect(retrievedEvent.categories.length).toBe(3)
24
+ expect(retrievedEvent.categories).toEqual(testUtils.testChartCategories)
25
25
  })
26
26
 
27
27
  test('retrieve season', async () => {
@@ -49,6 +49,7 @@ test('retrieve season', async () => {
49
49
  expect(retrievedSeason.forSaleConfig).toBeFalsy()
50
50
  expect(retrievedSeason.updatedOn).toBeFalsy()
51
51
  expect(retrievedSeason.topLevelSeasonKey).toBe(undefined)
52
+ expect(retrievedSeason.categories).toEqual(testUtils.testChartCategories)
52
53
  })
53
54
 
54
55
  test('retrieve partial season', async () => {
@@ -5,6 +5,7 @@ const { v4: uuidv4 } = require('uuid')
5
5
  const LabelClasses = require('../src/Common/Labels.js')
6
6
  const path = require('path')
7
7
  const Region = require('../src/Region')
8
+ const Category = require("../src/Charts/Category");
8
9
 
9
10
  const baseUrl = 'https://api-staging-eu.seatsio.net/'
10
11
 
@@ -104,5 +105,11 @@ module.exports = {
104
105
  reject,
105
106
  resolve
106
107
  }
107
- }
108
+ },
109
+
110
+ testChartCategories: [
111
+ new Category(9, 'Cat1', '#87A9CD', false),
112
+ new Category(10, 'Cat2', '#5E42ED', false),
113
+ new Category('string11', 'Cat3', '#5E42BB', false)
114
+ ]
108
115
  }