seatsio 67.2.0 → 67.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": "67.2.0",
3
+ "version": "67.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",
@@ -16,20 +16,15 @@ class Event {
16
16
  this.updatedOn = event.updatedOn ? new Date(event.updatedOn) : null
17
17
  this.channels = event.channels ? event.channels.map(c => new Channel(c)) : null
18
18
  this.socialDistancingRulesetKey = event.socialDistancingRulesetKey
19
- this.seasonKey = event.season ? event.season.key : null
19
+ this.topLevelSeasonKey = event.topLevelSeasonKey
20
+ this.isTopLevelSeason = event.isTopLevelSeason
21
+ this.isPartialSeason = event.isPartialSeason
22
+ this.isEventInSeason = event.isEventInSeason
20
23
  }
21
24
 
22
25
  isSeason () {
23
26
  return false
24
27
  }
25
-
26
- isTopLevelSeason () {
27
- return false
28
- }
29
-
30
- isPartialSeason () {
31
- return false
32
- }
33
28
  }
34
29
 
35
30
  module.exports = Event
@@ -8,22 +8,11 @@ class Season extends Event {
8
8
  super(season)
9
9
  this.partialSeasonKeys = season.partialSeasonKeys
10
10
  this.events = season.events ? season.events.map(e => new Event(e)) : undefined
11
- if (this.isTopLevelSeason()) {
12
- this.seasonKey = undefined
13
- }
14
11
  }
15
12
 
16
13
  isSeason () {
17
14
  return true
18
15
  }
19
-
20
- isTopLevelSeason () {
21
- return this.partialSeasonKeys !== undefined
22
- }
23
-
24
- isPartialSeason () {
25
- return !this.isTopLevelSeason()
26
- }
27
16
  }
28
17
 
29
18
  module.exports = Season
@@ -20,7 +20,7 @@ test('should retrieve event', async () => {
20
20
  expect(retrievedEvent.createdOn.getTime()).toBeLessThanOrEqual(now.getTime() + 5000)
21
21
  expect(retrievedEvent.forSaleConfig).toBeFalsy()
22
22
  expect(retrievedEvent.updatedOn).toBeNull()
23
- expect(retrievedEvent.seasonKey).toBeNull()
23
+ expect(retrievedEvent.topLevelSeasonKey).toBe(undefined)
24
24
  })
25
25
 
26
26
  test('retrieve season', async () => {
@@ -34,7 +34,9 @@ test('retrieve season', async () => {
34
34
  const retrievedSeason = await client.events.retrieve(season.key)
35
35
 
36
36
  expect(retrievedSeason.isSeason()).toBe(true)
37
- expect(retrievedSeason.isTopLevelSeason()).toBe(true)
37
+ expect(retrievedSeason.isTopLevelSeason).toBe(true)
38
+ expect(retrievedSeason.isPartialSeason).toBe(false)
39
+ expect(retrievedSeason.isEventInSeason).toBe(false)
38
40
  expect(retrievedSeason.key).toBeTruthy()
39
41
  expect(retrievedSeason.id).toBeTruthy()
40
42
  expect(retrievedSeason.partialSeasonKeys).toEqual([partialSeason1.key, partialSeason2.key])
@@ -45,7 +47,7 @@ test('retrieve season', async () => {
45
47
  expect(retrievedSeason.createdOn).toBeInstanceOf(Date)
46
48
  expect(retrievedSeason.forSaleConfig).toBeFalsy()
47
49
  expect(retrievedSeason.updatedOn).toBeFalsy()
48
- expect(retrievedSeason.seasonKey).toBe(undefined)
50
+ expect(retrievedSeason.topLevelSeasonKey).toBe(undefined)
49
51
  })
50
52
 
51
53
  test('retrieve partial season', async () => {
@@ -59,7 +61,9 @@ test('retrieve partial season', async () => {
59
61
  const retrievedSeason = await client.events.retrieve(partialSeason1.key)
60
62
 
61
63
  expect(retrievedSeason.isSeason()).toBe(true)
62
- expect(retrievedSeason.isPartialSeason()).toBe(true)
64
+ expect(retrievedSeason.isTopLevelSeason).toBe(false)
65
+ expect(retrievedSeason.isPartialSeason).toBe(true)
66
+ expect(retrievedSeason.isEventInSeason).toBe(false)
63
67
  expect(retrievedSeason.key).toBeTruthy()
64
68
  expect(retrievedSeason.id).toBeTruthy()
65
69
  expect(retrievedSeason.partialSeasonKeys).toBe(undefined)
@@ -70,7 +74,7 @@ test('retrieve partial season', async () => {
70
74
  expect(retrievedSeason.createdOn).toBeInstanceOf(Date)
71
75
  expect(retrievedSeason.forSaleConfig).toBeFalsy()
72
76
  expect(retrievedSeason.updatedOn).toBeFalsy()
73
- expect(retrievedSeason.seasonKey).toBe(season.key)
77
+ expect(retrievedSeason.topLevelSeasonKey).toBe(season.key)
74
78
  })
75
79
 
76
80
  test('retrieve event in season', async () => {
@@ -82,5 +86,8 @@ test('retrieve event in season', async () => {
82
86
  const retrievedEvent = await client.events.retrieve('event1')
83
87
 
84
88
  expect(retrievedEvent.isSeason()).toBe(false)
85
- expect(retrievedEvent.seasonKey).toBe(season.key)
89
+ expect(retrievedEvent.isTopLevelSeason).toBe(false)
90
+ expect(retrievedEvent.isPartialSeason).toBe(false)
91
+ expect(retrievedEvent.isEventInSeason).toBe(true)
92
+ expect(retrievedEvent.topLevelSeasonKey).toBe(season.key)
86
93
  })