Class: Accession::Submission::Payload
- Inherits:
-
Object
- Object
- Accession::Submission::Payload
- Includes:
- Enumerable
- Defined in:
- lib/accession/accession/submission.rb
Overview
Accessioning requires a submission and sample file Payload consists of a hash of relevant files These files can be opened when the request is sent
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
Instance Method Summary collapse
- #close! ⇒ Object
- #each ⇒ Object
-
#initialize(accessionables) ⇒ Payload
constructor
A new instance of Payload.
- #open ⇒ Object
Constructor Details
#initialize(accessionables) ⇒ Payload
Returns a new instance of Payload.
69 70 71 72 73 74 |
# File 'lib/accession/accession/submission.rb', line 69 def initialize(accessionables) @files = {}.tap do |f| accessionables.each { |accessionable| f[accessionable.schema_type.upcase] = accessionable.to_file } end end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
67 68 69 |
# File 'lib/accession/accession/submission.rb', line 67 def files @files end |
Instance Method Details
#close! ⇒ Object
84 85 86 |
# File 'lib/accession/accession/submission.rb', line 84 def close! files.values.each(&:close!) # rubocop:todo Style/HashEachMethods end |
#each ⇒ Object
76 77 78 |
# File 'lib/accession/accession/submission.rb', line 76 def each(&) files.each(&) end |
#open ⇒ Object
80 81 82 |
# File 'lib/accession/accession/submission.rb', line 80 def open files.transform_values(&:open) end |