Class: SampleManifest::Uploader
- Inherits:
-
Object
- Object
- SampleManifest::Uploader
- Includes:
- ActiveModel::Validations
- Defined in:
- app/models/sample_manifest/uploader.rb
Overview
Class SampleManifest::Uploader provides an interface for uploading sample manifests from a controller
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#override ⇒ Object
readonly
Returns the value of attribute override.
-
#tag_group ⇒ Object
readonly
Returns the value of attribute tag_group.
-
#upload ⇒ Object
readonly
Returns the value of attribute upload.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(file, configuration, user, override) ⇒ Uploader
constructor
A new instance of Uploader.
- #run! ⇒ Object
Constructor Details
#initialize(file, configuration, user, override) ⇒ Uploader
Returns a new instance of Uploader.
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/models/sample_manifest/uploader.rb', line 20 def initialize(file, configuration, user, override) @file = file @configuration = configuration || SequencescapeExcel::NullObjects::NullConfiguration.new @user = user @override = override @tag_group = create_tag_group @upload = SampleManifestExcel::Upload::Base.new( file: file, column_list: self.configuration.columns.all, override: override ) end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration
12 13 14 |
# File 'app/models/sample_manifest/uploader.rb', line 12 def configuration @configuration end |
#file ⇒ Object (readonly)
Returns the value of attribute file
12 13 14 |
# File 'app/models/sample_manifest/uploader.rb', line 12 def file @file end |
#override ⇒ Object (readonly)
Returns the value of attribute override
12 13 14 |
# File 'app/models/sample_manifest/uploader.rb', line 12 def override @override end |
#tag_group ⇒ Object (readonly)
Returns the value of attribute tag_group
12 13 14 |
# File 'app/models/sample_manifest/uploader.rb', line 12 def tag_group @tag_group end |
#upload ⇒ Object (readonly)
Returns the value of attribute upload
12 13 14 |
# File 'app/models/sample_manifest/uploader.rb', line 12 def upload @upload end |
#user ⇒ Object (readonly)
Returns the value of attribute user
12 13 14 |
# File 'app/models/sample_manifest/uploader.rb', line 12 def user @user end |
Instance Method Details
#run! ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/models/sample_manifest/uploader.rb', line 33 def run! return false unless valid? if upload.process(tag_group) upload.complete upload.broadcast_sample_manifest_updated_event(user) true else extract_errors upload.fail false end end |