diff --git a/lib/seatsio/events.rb b/lib/seatsio/events.rb index cf3b139..6c9cd48 100644 --- a/lib/seatsio/events.rb +++ b/lib/seatsio/events.rb @@ -81,7 +81,7 @@ def put_up_for_resale(event_key_or_keys, object_or_objects) end def change_object_status(event_key_or_keys, object_or_objects, status, hold_token: nil, order_id: nil, keep_extra_data: nil, ignore_channels: nil, channel_keys: nil, allowed_previous_statuses: nil, rejected_previous_statuses: nil) - request = create_change_object_status_request(CHANGE_STATUS_TO, object_or_objects, status, hold_token, order_id, event_key_or_keys, keep_extra_data, ignore_channels, channel_keys, allowed_previous_statuses, rejected_previous_statuses) + request = create_change_object_status_request(Seatsio::StatusChangeType::CHANGE_STATUS_TO, object_or_objects, status, hold_token, order_id, event_key_or_keys, keep_extra_data, ignore_channels, channel_keys, allowed_previous_statuses, rejected_previous_statuses) request[:params] = { :expand => 'objects' } @@ -117,7 +117,7 @@ def hold_best_available(key, number, hold_token, categories: nil, order_id: nil, end def release(event_key_or_keys, object_or_objects, hold_token: nil, order_id: nil, keep_extra_data: nil, ignore_channels: nil, channel_keys: nil) - request = create_change_object_status_request(RELEASE, object_or_objects, nil, hold_token, order_id, event_key_or_keys, keep_extra_data, ignore_channels, channel_keys, nil, nil) + request = create_change_object_status_request(Seatsio::StatusChangeType::RELEASE, object_or_objects, nil, hold_token, order_id, event_key_or_keys, keep_extra_data, ignore_channels, channel_keys, nil, nil) request[:params] = { :expand => 'objects' } diff --git a/lib/seatsio/events/change_object_status_request.rb b/lib/seatsio/events/change_object_status_request.rb index 0bad7a3..a6bfd0e 100644 --- a/lib/seatsio/events/change_object_status_request.rb +++ b/lib/seatsio/events/change_object_status_request.rb @@ -3,7 +3,7 @@ def create_change_object_status_request(type, object_or_objects, status, hold_to result[:type] = type result[:objects] = normalize(object_or_objects) result[:type] = type - result[:status] = status if type != RELEASE + result[:status] = status if type != Seatsio::StatusChangeType::RELEASE result[:holdToken] = hold_token if hold_token != nil result[:orderId] = order_id if order_id != nil if event_key_or_keys.is_a? Array diff --git a/test/events/change_object_status_in_batch_test.rb b/test/events/change_object_status_in_batch_test.rb index 2d30531..88bf78b 100644 --- a/test/events/change_object_status_in_batch_test.rb +++ b/test/events/change_object_status_in_batch_test.rb @@ -9,7 +9,11 @@ def test_change_object_status_in_batch chart_key2 = create_test_chart event2 = @seatsio.events.create chart_key: chart_key2 - res = @seatsio.events.change_object_status_in_batch([{ :event => event1.key, :objects => ['A-1'], :status => 'foo' }, { :event => event2.key, :objects => ['A-2'], :status => 'fa' }]) + res = @seatsio.events.change_object_status_in_batch( + [ + { :type => Seatsio::StatusChangeType::CHANGE_STATUS_TO, :event => event1.key, :objects => ['A-1'], :status => 'foo' }, + { :event => event2.key, :objects => ['A-2'], :status => 'fa' } + ]) assert_equal('foo', res[0].objects['A-1'].status) assert_equal('foo', @seatsio.events.retrieve_object_info(key: event1.key, label: 'A-1').status) @@ -85,7 +89,7 @@ def release_in_batch event = @seatsio.events.create chart_key: chart_key @seatsio.events.book(event.key, ['A-1']) - res = @seatsio.events.change_object_status_in_batch([{ :type => RELEASE, :event => event.key, :objects => ['A-1'] }]) + res = @seatsio.events.change_object_status_in_batch([{ :type => Seatsio::StatusChangeType::RELEASE, :event => event.key, :objects => ['A-1'] }]) assert_equal(Seatsio::EventObjectInfo::FREE, res[0].objects['A-1'].status) assert_equal(Seatsio::EventObjectInfo::FREE, @seatsio.events.retrieve_object_info(key: event.key, label: 'A-1').status)