Class: Accession::Submission::Payload

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#filesObject (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!)
end

#each(&block) ⇒ Object


76
77
78
# File 'lib/accession/accession/submission.rb', line 76

def each(&block)
  files.each(&block)
end

#openObject


80
81
82
# File 'lib/accession/accession/submission.rb', line 80

def open
  files.transform_values(&:open)
end