Class: QueueIt::Api::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/queue_it/api/event.rb

Constant Summary collapse

InvalidEventIdFormat =
Class.new(StandardError)

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Event

Returns a new instance of Event.



10
11
12
# File 'lib/queue_it/api/event.rb', line 10

def initialize(client)
  self.client = client
end

Instance Method Details

#create_or_update(event_id:, display_name:, start_time:, pre_queue_start_time: nil, know_user_secret_key: nil, redirect_url:, end_time: nil, description: "", event_culture_name: "en-US", time_zone: "UTC", queue_number_validity_in_minutes: 30, max_no_of_redirects: 1, custom_layout: "Default layout by Queue-it", domain_alias: "") ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/queue_it/api/event.rb', line 14

def create_or_update(event_id:, display_name:, start_time:, pre_queue_start_time:nil, know_user_secret_key: nil, redirect_url:, end_time: nil, description: "", event_culture_name: "en-US", time_zone: "UTC", queue_number_validity_in_minutes: 30, max_no_of_redirects: 1, custom_layout: "Default layout by Queue-it", domain_alias: "")
  raise InvalidEventIdFormat unless valid_event_id_format?(event_id)

  attributes = queue_attributes(
    pre_queue_start_time:             pre_queue_start_time,
    start_time:                       start_time,
    end_time:                         end_time,
    know_user_secret_key:             know_user_secret_key,
    redirect_url:                     redirect_url,
    description:                      description,
    display_name:                     display_name,
    event_culture_name:               event_culture_name,
    queue_number_validity_in_minutes: queue_number_validity_in_minutes,
    time_zone:                        time_zone,
    max_no_of_redirects:              max_no_of_redirects,
    domain_alias:                     domain_alias,
    custom_layout:                    custom_layout
    )

  perform_request(:put, event_id, attributes)
end

#set_speed(event_id:, max_redirects_per_minute:) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/queue_it/api/event.rb', line 36

def set_speed(event_id:, max_redirects_per_minute:)
  raise InvalidEventIdFormat unless valid_event_id_format?(event_id)

  number_of_redirects = [max_redirects_per_minute.to_i, QUEUE_IT_MINIMAL_NUMBER_OF_REDIRECTS_PER_MINUTE].max
  attributes          = { "MaxRedirectsPerMinute" => "#{number_of_redirects}" }

  perform_request(:put, "#{event_id}/queue/speed", attributes)
end