Skip to content

Commit

Permalink
Extra season properties on events (#66)
Browse files Browse the repository at this point in the history
* Expose more season data on events

* Version bump
  • Loading branch information
mroloux authored Feb 24, 2022
1 parent 2e56bb7 commit f63a4c9
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ Then you can refer to seatsio-java as a regular package:
```
// build.gradle
dependencies {
compile 'com.github.seatsio:seatsio-java:69.0.0'
compile 'com.github.seatsio:seatsio-java:69.1.0'
}
// pom.xml
<dependency>
<groupId>com.github.seatsio</groupId>
<artifactId>seatsio-java</artifactId>
<version>69.0.0</version>
<version>69.1.0</version>
</dependency>
```

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/seatsio/events/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public class Event extends ValueObject {
public TableBookingConfig tableBookingConfig;
public Channel[] channels;
public String socialDistancingRulesetKey;
public String topLevelSeasonKey;
public boolean isTopLevelSeason;
public boolean isPartialSeason;
public boolean isEventInSeason;

public boolean isSeason() {
return false;
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/seatsio/events/RetrieveEventTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public void test() {
Event retrievedEvent = client.events.retrieve(event.key);

assertThat(retrievedEvent.id).isNotZero();
assertThat(retrievedEvent.isEventInSeason).isFalse();
assertThat(retrievedEvent.key).isNotNull();
assertThat(retrievedEvent.chartKey).isEqualTo(chartKey);
assertThat(retrievedEvent.tableBookingConfig).isEqualTo(TableBookingConfig.inherit());
Expand All @@ -41,6 +42,7 @@ public void retrieveSeason() {
Season retrievedSeason = (Season) client.events.retrieve(season.key);

assertThat(retrievedSeason.id).isNotZero();
assertThat(retrievedSeason.isTopLevelSeason).isTrue();
assertThat(retrievedSeason.key).isEqualTo(season.key);
assertThat(retrievedSeason.chartKey).isEqualTo(chartKey);
assertThat(retrievedSeason.tableBookingConfig).isEqualTo(TableBookingConfig.inherit());
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/seatsio/seasons/CreateEventsInSeasonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public void eventKeys() {
assertThat(updatedSeason.events)
.extracting(s -> s.key)
.containsExactly("event1", "event2");
assertThat(updatedSeason.events.get(0).isEventInSeason).isTrue();
assertThat(updatedSeason.events.get(0).topLevelSeasonKey).isEqualTo(season.key);
}

@Test
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/seatsio/seasons/CreatePartialSeasonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public void keyCanBePassedIn() {
Season partialSeason = client.seasons.createPartialSeason(topLevelSeason.key, "aPartialSeason", null);

assertThat(partialSeason.key).isEqualTo("aPartialSeason");
assertThat(partialSeason.isPartialSeason).isTrue();
assertThat(partialSeason.topLevelSeasonKey).isEqualTo(topLevelSeason.key);
}

@Test
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/seatsio/seasons/CreateSeasonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public void chartKeyIsRequired() {
Season season = client.seasons.create(chartKey);

assertThat(season.id).isNotZero();
assertThat(season.isTopLevelSeason).isTrue();
assertThat(season.topLevelSeasonKey).isNull();
assertThat(season.key).isNotNull();
assertThat(season.partialSeasonKeys).isEmpty();
assertThat(season.id).isNotZero();
Expand Down

0 comments on commit f63a4c9

Please sign in to comment.