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:, force_create: false, options: {}) ⇒ Object



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

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

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