Class: SpreeCmCommissioner::Export
- Inherits:
-
Base
- Object
- Spree::Base
- Base
- SpreeCmCommissioner::Export
show all
- Includes:
- StoreMetadata
- Defined in:
- app/models/spree_cm_commissioner/export.rb
Instance Method Summary
collapse
Instance Method Details
#enqueue_export ⇒ Object
50
51
52
|
# File 'app/models/spree_cm_commissioner/export.rb', line 50
def enqueue_export
SpreeCmCommissioner::ExportJob.perform_later(export_id: id)
end
|
#export ⇒ Object
54
55
56
|
# File 'app/models/spree_cm_commissioner/export.rb', line 54
def export
raise NotImplementedError, 'Subclasses must implement the export method'
end
|
#exported_file_name ⇒ Object
32
33
34
35
36
|
# File 'app/models/spree_cm_commissioner/export.rb', line 32
def exported_file_name
return nil if exported_file.blank?
exported_file.filename.to_s
end
|
#exported_file_url(expires_in: 15.minutes) ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
|
# File 'app/models/spree_cm_commissioner/export.rb', line 38
def exported_file_url(expires_in: 15.minutes)
return nil if ActiveStorage::Current.url_options.nil?
return nil if exported_file.blank?
exported_file.url(
expires_in: expires_in,
disposition: 'attachment'
)
end
|
#set_uuid ⇒ Object
28
29
30
|
# File 'app/models/spree_cm_commissioner/export.rb', line 28
def set_uuid
self.uuid = SecureRandom.uuid
end
|