Class: SpreeCmCommissioner::OperatorGuestJsonGzips::Create

Inherits:
Object
  • Object
show all
Includes:
Spree::ServiceModule::Base
Defined in:
app/services/spree_cm_commissioner/operator_guest_json_gzips/create.rb

Instance Method Summary collapse

Instance Method Details

#call(exportable:, role: nil, force_create: false, options: {}) ⇒ Object

role: nil = unrestricted (full event); a Spree::Role (check_in type) scopes the file to that role's tickets (see User#check_in_role_for). One role, one export.



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/services/spree_cm_commissioner/operator_guest_json_gzips/create.rb', line 10

def call(exportable:, role: nil, force_create: false, options: {})
  unless force_create
    recent_export = find_recent_export(exportable, role)
    return success(recent_export) if recent_export
  end

  export = build_export(exportable, role, options)
  if export.save
    success(export)
  else
    failure(export, export.errors.full_messages.to_sentence)
  end
end