Class: SdrClient::RedesignedClient::StructuralGrouper
- Inherits:
-
Object
- Object
- SdrClient::RedesignedClient::StructuralGrouper
- Defined in:
- lib/sdr_client/redesigned_client/structural_grouper.rb
Overview
Builds and constructs the structural metadata given upload responses (file IDs, file set grouping strategies, etc.)
Class Method Summary collapse
Instance Method Summary collapse
- #group ⇒ Object
-
#initialize(request_builder:, upload_responses:, grouping_strategy:, file_set_strategy: nil) ⇒ StructuralGrouper
constructor
A new instance of StructuralGrouper.
Constructor Details
#initialize(request_builder:, upload_responses:, grouping_strategy:, file_set_strategy: nil) ⇒ StructuralGrouper
Returns a new instance of StructuralGrouper.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/sdr_client/redesigned_client/structural_grouper.rb', line 16 def initialize(request_builder:, upload_responses:, grouping_strategy:, file_set_strategy: nil) # rubocop:disable Metrics/MethodLength @request_builder = request_builder @upload_responses = upload_responses @grouping_strategy = if grouping_strategy == 'filename' SdrClient::RedesignedClient::MatchingFileGroupingStrategy else SdrClient::RedesignedClient::SingleFileGroupingStrategy end @file_set_strategy = if file_set_strategy == 'image' SdrClient::RedesignedClient::ImageFileSetStrategy else SdrClient::RedesignedClient::FileTypeFileSetStrategy end end |
Class Method Details
.group ⇒ Object
8 9 10 |
# File 'lib/sdr_client/redesigned_client/structural_grouper.rb', line 8 def self.group(...) new(...).group end |
Instance Method Details
#group ⇒ Object
31 32 33 34 35 |
# File 'lib/sdr_client/redesigned_client/structural_grouper.rb', line 31 def group request_builder .tap { |request| request.file_sets = build_filesets(uploads: upload_responses) } .to_cocina end |