Skip to content

Commit

Permalink
Remove update chart key for event (#206)
Browse files Browse the repository at this point in the history
Updating the chart key of an event is no longer documented but is still supported by the client libraries. This PR removes the parameter from `UpdateEventParams`.

Co-authored-by: Steve Chaloner <steve@seats.io>
  • Loading branch information
schaloner and Steve Chaloner authored Nov 13, 2024
1 parent cd2e766 commit 814cf28
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 25 deletions.
1 change: 0 additions & 1 deletion src/main/java/seatsio/events/Events.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ public void removeCategories(String eventKey) {

public void update(String key, UpdateEventParams params) {
JsonObjectBuilder request = aJsonObject()
.withPropertyIfNotNull("chartKey", params.chartKey)
.withPropertyIfNotNull("eventKey", params.eventKey)
.withPropertyIfNotNull("name", params.name)
.withPropertyIfNotNull("date", params.date == null ? null : gson().toJsonTree(params.date))
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/seatsio/events/UpdateEventParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,8 @@

public class UpdateEventParams extends EventParams<UpdateEventParams> {

public String chartKey;
public Boolean isInThePast;

public UpdateEventParams withChartKey(String chartKey) {
this.chartKey = chartKey;
return this;
}

public UpdateEventParams withIsInThePast(Boolean isInThePast) {
this.isInThePast = isInThePast;
return this;
Expand Down
19 changes: 1 addition & 18 deletions src/test/java/seatsio/events/UpdateEventTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,18 @@
import seatsio.charts.Category;
import seatsio.charts.CategoryKey;
import seatsio.charts.Chart;
import seatsio.seasons.Season;
import seatsio.seasons.SeasonParams;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

import static java.time.Instant.now;
import static java.time.temporal.ChronoUnit.MINUTES;
import static org.assertj.core.api.Assertions.assertThat;
import static seatsio.events.TableBookingMode.BY_SEAT;
import static seatsio.events.TableBookingMode.BY_TABLE;

public class UpdateEventTest extends SeatsioClientTest {

@Test
public void updateChartKey() {
Chart chart1 = client.charts.create();
Event event = client.events.create(chart1.key);
Chart chart2 = client.charts.create();

client.events.update(event.key, new UpdateEventParams().withChartKey(chart2.key));

Event retrievedEvent = client.events.retrieve(event.key);
assertThat(retrievedEvent.key).isEqualTo(event.key);
assertThat(retrievedEvent.chartKey).isEqualTo(chart2.key);
assertThat(retrievedEvent.updatedOn).isBetween(now().minus(1, MINUTES), now().plus(1, MINUTES));
}

@Test
public void updateEventKey() {
Chart chart = client.charts.create();
Expand Down Expand Up @@ -150,7 +133,7 @@ public void updateDate() {
@Test
public void updateIsInThePast() {
String chartKey = createTestChart();
Season season = client.seasons.create(chartKey, new SeasonParams().eventKeys(List.of("event1")));
client.seasons.create(chartKey, new SeasonParams().eventKeys(List.of("event1")));
Event event = client.events.retrieve("event1");
assertThat(event.isInThePast).isFalse();

Expand Down

0 comments on commit 814cf28

Please sign in to comment.