Skip to content

Commit

Permalink
Best available call supports accessible seats (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
mroloux authored Sep 4, 2024
1 parent 520dc1a commit ca101f2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
4 changes: 3 additions & 1 deletion seatsio/events/changeBestAvailableObjectStatusRequest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class ChangeBestAvailableObjectStatusRequest:
def __init__(self, number, categories, zone, extra_data, ticket_types, status, hold_token, order_id, keep_extra_data, ignore_channels, channel_keys, try_to_prevent_orphan_seats):
def __init__(self, number, categories, zone, extra_data, ticket_types, status, hold_token, order_id, keep_extra_data, ignore_channels, channel_keys, try_to_prevent_orphan_seats, accessible_seats):
best_available = {"number": number}
if categories:
best_available["categories"] = categories
Expand All @@ -11,6 +11,8 @@ def __init__(self, number, categories, zone, extra_data, ticket_types, status, h
best_available["ticketTypes"] = ticket_types
if try_to_prevent_orphan_seats is not None:
best_available["tryToPreventOrphanSeats"] = try_to_prevent_orphan_seats
if accessible_seats is not None:
best_available["accessibleSeats"] = accessible_seats
self.bestAvailable = best_available
self.status = status
if hold_token:
Expand Down
4 changes: 2 additions & 2 deletions seatsio/events/eventsClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ def hold_best_available(self, event_key, number, categories=None, hold_token=Non
def change_best_available_object_status(self, event_key, number, status, categories=None, hold_token=None,
extra_data=None, ticket_types=None, order_id=None, keep_extra_data=None,
ignore_channels=None, channel_keys=None, try_to_prevent_orphan_seats=None,
zone=None):
zone=None, accessible_seats=None):
response = self.http_client.url("/events/{key}/actions/change-object-status", key=event_key).post(
ChangeBestAvailableObjectStatusRequest(number, categories, zone, extra_data, ticket_types, status,
hold_token,
order_id, keep_extra_data, ignore_channels, channel_keys,
try_to_prevent_orphan_seats))
try_to_prevent_orphan_seats, accessible_seats))
return BestAvailableObjects(response.json())

def release(self, event_key_or_keys, object_or_objects, hold_token=None, order_id=None, keep_extra_data=None,
Expand Down
7 changes: 7 additions & 0 deletions tests/events/testChangeBestAvailableObjectStatus.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,10 @@ def test_ignoreChannels(self):
result = self.client.events.change_best_available_object_status(event.key, 1, "myStatus", ignore_channels=True)

assert_that(result.objects).contains_exactly("A-5")

def test_accessibleSeats(self):
chart_key = self.create_test_chart()
event = self.client.events.create(chart_key)
result = self.client.events.change_best_available_object_status(event.key, 3, "myStatus", accessible_seats=1)
assert_that(result.next_to_each_other).is_true()
assert_that(result.objects).contains_exactly("A-6", "A-7", "A-8")
2 changes: 1 addition & 1 deletion tests/sampleChart.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
"categoryAccessible": false,
"categoryKey": 9,
"restrictedView": false,
"accessible": false,
"accessible": true,
"companionSeat": false,
"disabledBySocialDistancingRules": false,
"uuid": "uuid294",
Expand Down

0 comments on commit ca101f2

Please sign in to comment.