Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
bverbeken committed Oct 2, 2024
1 parent 8efeae2 commit c8aa694
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 33 deletions.
1 change: 0 additions & 1 deletion lib/seatsio/events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
require "json"
require "cgi"
require "seatsio/events/change_object_status_request"
require "seatsio/events/release_objects_request"
require "seatsio/events/change_best_available_object_status_request"
require 'seatsio/channels'

Expand Down
19 changes: 19 additions & 0 deletions lib/seatsio/events/change_object_status_request.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
def create_change_object_status_request(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)
result = {}
result[:objects] = normalize(object_or_objects)
result[:type] = 'CHANGE_STATUS_TO'
result[:status] = status
result[:holdToken] = hold_token if hold_token != nil
result[:orderId] = order_id if order_id != nil
Expand All @@ -17,6 +18,24 @@ def create_change_object_status_request(object_or_objects, status, hold_token, o
result
end

def create_release_objects_request(object_or_objects, hold_token, order_id, event_key_or_keys, keep_extra_data, ignore_channels, channel_keys)
result = {}
result[:objects] = normalize(object_or_objects)
result[:type] = "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
result[:events] = event_key_or_keys
else
result[:events] = [event_key_or_keys]
end
result[:keepExtraData] = keep_extra_data if keep_extra_data != nil
result[:ignoreChannels] = ignore_channels if ignore_channels != nil
result[:channelKeys] = channel_keys if channel_keys != nil
result
end


def normalize(object_or_objects)
if object_or_objects.is_a? Array
if object_or_objects.length == 0
Expand Down
32 changes: 0 additions & 32 deletions lib/seatsio/events/release_objects_request.rb

This file was deleted.

0 comments on commit c8aa694

Please sign in to comment.