Class: QueueIt::UrlBuilder

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

Class Method Summary collapse

Class Method Details

.build_cancel_url(customer_id, event_id, queue_id = nil) ⇒ Object



9
10
11
# File 'lib/queue_it/url_builder.rb', line 9

def self.build_cancel_url(customer_id, event_id, queue_id = nil)
  "https://#{customer_id}.queue-it.net/cancel.aspx?c=#{customer_id}&e=#{event_id}&q=#{queue_id}"
end

.build_queue_url(customer_id, event_id, redirect_url) ⇒ Object



5
6
7
# File 'lib/queue_it/url_builder.rb', line 5

def self.build_queue_url(customer_id, event_id, redirect_url)
  "https://#{customer_id}.queue-it.net/?c=#{customer_id}&e=#{event_id}&t=#{CGI.escape(redirect_url)}"
end

.clean_url(request_url) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/queue_it/url_builder.rb', line 18

def self.clean_url(request_url)
  uri = Addressable::URI.parse(request_url)

  params = uri.query_values
  queue_it_params.each do |param|
    params.delete(param)
  end

  uri.query_values = params
  uri.to_s
end

.contains_queue_params?(request_url) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
33
34
35
36
# File 'lib/queue_it/url_builder.rb', line 30

def self.contains_queue_params?(request_url)
  uri = Addressable::URI.parse(request_url)
  request_params = uri.query_values

  # Check if request_params contains any queue_it_params
  !(queue_it_params & request_params.keys).empty?
end