sdr-client 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 04b34e821d56af3fb15c920c9955df147ac75ed028d111a37fac03612f9cc556
4
- data.tar.gz: ed5c6b78582aa9c61b4fce2e191556508b9d467fbd3a3c615c09c5ac02cea43a
3
+ metadata.gz: bb3f20e21233ef1ef0f4d72f4d7dcd0e4bb52968b955152e62259e023b730b7b
4
+ data.tar.gz: ecbb08752fcd3c71b4868404bc48871eaba138c852304678a466cd85de3fe4bd
5
5
  SHA512:
6
- metadata.gz: 6112ce1e149109355702197254a126ca340d35f45de00574d765d455daae52ff9fdc7214cc1716cf46020315482c9a39e0bd82b18433e5b803e7275f81e4d965
7
- data.tar.gz: 9b242e5439bcb5e55c7272d2238b41c0284b29f482fbfe53205e2c7b9f5daab0bffc23f515d7785d4d18c654c3bf949356c3a36968c22f2d56c4017fd16cdc68
6
+ metadata.gz: '08307c141dd01737019f40e1a999b8fd9aa41abca57379f655a9ac5773eba55f974c4d3c34c804e44cd7c8a8792c292e84f5d8c7bf62dd2021b32dd87832420b'
7
+ data.tar.gz: 928ba2d1377cf11bc1e1cfaff2891748ac916d3a3d9e83fca0ac07e0efdbd450ceb895a066bcc3c3a7a4355f186717efb4f5c4d6540867336a21095064f02cb2
@@ -12,6 +12,7 @@ module SdrClient
12
12
  source_id:,
13
13
  url:,
14
14
  files: [],
15
+ files_metadata: {},
15
16
  grouping_strategy: SingleFileGroupingStrategy)
16
17
  token = Credentials.read
17
18
 
@@ -21,7 +22,8 @@ module SdrClient
21
22
  collection: collection,
22
23
  source_id: source_id,
23
24
  catkey: catkey)
24
- Process.new(metadata: metadata, url: url, token: token, files: files, grouping_strategy: grouping_strategy).run
25
+ Process.new(metadata: metadata, url: url, token: token,
26
+ files: files, files_metadata: files_metadata, grouping_strategy: grouping_strategy).run
25
27
  end
26
28
  # rubocop:enable Metrics/ParameterLists
27
29
  end
@@ -7,7 +7,10 @@ module SdrClient
7
7
  # @param [Array<SdrClient::Deposit::Files::DirectUploadResponse>] uploads the uploaded files to attach.
8
8
  # @return [Array<Array<SdrClient::Deposit::Files::DirectUploadResponse>>] uploads the grouped uploaded files.
9
9
  def self.run(uploads: [])
10
- uploads.group_by { |ul| ::File.basename(ul.filename, '.*') }
10
+ # Call `#values` on the result of the grouping operation because 1)
11
+ # `Process#build_filesets` expects an array of arrays, not an array of
12
+ # hashes, and 2) the keys aren't used anywhere
13
+ uploads.group_by { |ul| ::File.basename(ul.filename, '.*') }.values
11
14
  end
12
15
  end
13
16
  end
@@ -126,10 +126,10 @@ module SdrClient
126
126
  # @return [Array<SdrClient::Deposit::FileSet>] the uploads transformed to filesets
127
127
  def build_filesets(uploads:, files_metadata:)
128
128
  grouped_uploads = grouping_strategy.run(uploads: uploads)
129
- grouped_uploads.each_with_index.map do |upload_group, i|
129
+ grouped_uploads.map.with_index(1) do |upload_group, i|
130
130
  metadata_group = {}
131
131
  upload_group.each { |upload| metadata_group[upload.filename] = files_metadata.fetch(upload.filename, {}) }
132
- FileSet.new(uploads: upload_group, uploads_metadata: metadata_group, label: "Object #{i + 1}")
132
+ FileSet.new(uploads: upload_group, uploads_metadata: metadata_group, label: "Object #{i}")
133
133
  end
134
134
  end
135
135
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SdrClient
4
- VERSION = '0.6.0'
4
+ VERSION = '0.7.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sdr-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-29 00:00:00.000000000 Z
11
+ date: 2020-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-monads
@@ -196,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
196
  - !ruby/object:Gem::Version
197
197
  version: '0'
198
198
  requirements: []
199
- rubygems_version: 3.0.3
199
+ rubygems_version: 3.1.2
200
200
  signing_key:
201
201
  specification_version: 4
202
202
  summary: The CLI for https://github.com/sul-dlss/sdr-api