Class: SpreeCmCommissioner::GuestSearcherQuery

Inherits:
Object
  • Object
show all
Defined in:
app/queries/spree_cm_commissioner/guest_searcher_query.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ GuestSearcherQuery



5
6
7
# File 'app/queries/spree_cm_commissioner/guest_searcher_query.rb', line 5

def initialize(params)
  @params = params
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



3
4
5
# File 'app/queries/spree_cm_commissioner/guest_searcher_query.rb', line 3

def params
  @params
end

Instance Method Details

#callObject

rubocop:disable Metrics/PerceivedComplexity



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/queries/spree_cm_commissioner/guest_searcher_query.rb', line 11

def call # rubocop:disable Metrics/PerceivedComplexity
  return SpreeCmCommissioner::Guest.none if event_id.blank?

  if params[:qr_data].present? && order_qr_data?
    search_by_order_qr
  elsif params[:qr_data].present? && line_item_qr_data?
    
  elsif params[:qr_data].present? && guest_qr_data?
    search_by_guest_qr
  elsif params[:term].present?
    search_by_term
  elsif params[:ids].present?
    SpreeCmCommissioner::Guest.complete_or_canceled.where(event_id: event_id, id: params[:ids])
  else
    SpreeCmCommissioner::Guest.complete_or_canceled.where(event_id: event_id)
  end
end

#event_idObject



9
# File 'app/queries/spree_cm_commissioner/guest_searcher_query.rb', line 9

def event_id = params[:event_id]