sdr-client 0.66.0 → 0.67.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37e3a32139e72d8eb278fb0039c959971faad4d88534acfc941169170cdc8e87
4
- data.tar.gz: d9fc1fa3ffd7355744f4b455a4b7dc5d7b8569e0081b81f94ca3aa66a99c6a61
3
+ metadata.gz: a6f0cbe88719cea674e5568bc60da33b77819904cc062995161c5eb6443a4f07
4
+ data.tar.gz: d4dc7e51ac117cc54e0c9d988f0d482c836d090bad2c5c46c4941150eb845478
5
5
  SHA512:
6
- metadata.gz: a0a1e0e97ad35ef638116a7e6f209ee4649718b2d0c315989ed9bc1eb1144a9ec7d351f3f895afeeb573085f3c089460b4b2dc833f77fc469b2b09dbb05cadde
7
- data.tar.gz: 212ea2fcdc6fec50ae48a6776f1b827d4790796a73445a0c3c354e843fd6248f90f56df61f79c00fd34e4ea439288b3c0dc26756ba26db28c854cc7def511bc2
6
+ metadata.gz: cb349532c8a777f077e2f8bf22430b0777938447f60862a273e10b5cb09430ef6dabaa17b2c5f46a792ac8ea5a3671ec0d977c3c4e8dab0820181d9b9f3245d6
7
+ data.tar.gz: e846f06d0202c1272e4d82e2622bd02d8fee61f2df40d7c5d5477bd0f373e92fc2828053bede2b391b558bb00b1941cb5ebd55cfdbaa18256facb130d099a4c2
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config --auto-gen-only-exclude`
3
- # on 2022-01-14 01:45:54 UTC using RuboCop version 1.24.1.
3
+ # on 2022-02-15 02:08:38 UTC using RuboCop version 1.25.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -18,6 +18,14 @@ Lint/NoReturnInBeginEndBlocks:
18
18
  Exclude:
19
19
  - 'lib/sdr_client/deposit/model_process.rb'
20
20
 
21
+ # Offense count: 2
22
+ # Cop supports --auto-correct.
23
+ # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
24
+ Lint/UnusedMethodArgument:
25
+ Exclude:
26
+ - 'lib/sdr_client/deposit/file_type_file_set_strategy.rb'
27
+ - 'lib/sdr_client/deposit/image_file_set_strategy.rb'
28
+
21
29
  # Offense count: 10
22
30
  # Configuration parameters: CountComments, Max, CountAsOne, ExcludedMethods, IgnoredMethods.
23
31
  Metrics/MethodLength:
@@ -52,16 +60,17 @@ RSpec/MessageSpies:
52
60
  Exclude:
53
61
  - 'spec/sdr_client/deposit_spec.rb'
54
62
 
55
- # Offense count: 9
63
+ # Offense count: 10
56
64
  # Configuration parameters: Max.
57
65
  RSpec/MultipleExpectations:
58
66
  Exclude:
59
67
  - 'spec/sdr_client/connection_spec.rb'
68
+ - 'spec/sdr_client/deposit/metadata_builder_spec.rb'
60
69
  - 'spec/sdr_client/deposit_spec.rb'
61
70
  - 'spec/sdr_client/login_spec.rb'
62
71
  - 'spec/sdr_client/model_deposit_spec.rb'
63
72
 
64
- # Offense count: 21
73
+ # Offense count: 22
65
74
  # Configuration parameters: AllowSubject, Max.
66
75
  RSpec/MultipleMemoizedHelpers:
67
76
  Exclude:
@@ -81,10 +90,11 @@ RSpec/NamedSubject:
81
90
  - 'spec/sdr_client/deposit/process_spec.rb'
82
91
  - 'spec/sdr_client/login_spec.rb'
83
92
 
84
- # Offense count: 11
93
+ # Offense count: 12
85
94
  # Configuration parameters: Max.
86
95
  RSpec/NestedGroups:
87
96
  Exclude:
97
+ - 'spec/sdr_client/deposit/metadata_builder_spec.rb'
88
98
  - 'spec/sdr_client/deposit/model_process_spec.rb'
89
99
  - 'spec/sdr_client/deposit/process_spec.rb'
90
100
  - 'spec/sdr_client/login_spec.rb'
@@ -97,14 +107,14 @@ Style/KeywordParametersOrder:
97
107
  - 'lib/sdr_client/deposit/request.rb'
98
108
 
99
109
  # Offense count: 2
100
- # Cop supports --auto-correct.
110
+ # Cop supports --auto-correct-all.
101
111
  # Configuration parameters: Mode.
102
112
  Style/StringConcatenation:
103
113
  Exclude:
104
114
  - 'lib/sdr_client/deposit/create_resource.rb'
105
115
  - 'spec/sdr_client/deposit_spec.rb'
106
116
 
107
- # Offense count: 19
117
+ # Offense count: 16
108
118
  # Cop supports --auto-correct.
109
119
  # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
110
120
  # URISchemes: http, https
@@ -8,8 +8,10 @@ module SdrClient
8
8
  # @param [Array] uploads
9
9
  # @param [Hash<String,Hash<String,String>>] uploads_metadata the file level metadata
10
10
  # @param [Array] files
11
- def initialize(label:, uploads: [], uploads_metadata: {}, files: [])
11
+ # @param [Class] type_strategy (FileTypeFileSetStrategy) a class that helps us determine how to type the fileset
12
+ def initialize(label:, uploads: [], uploads_metadata: {}, files: [], type_strategy: FileTypeFileSetStrategy)
12
13
  @label = label
14
+ @type_strategy = type_strategy
13
15
  @files = if uploads.empty?
14
16
  files
15
17
  else
@@ -21,7 +23,7 @@ module SdrClient
21
23
 
22
24
  def as_json
23
25
  {
24
- type: 'http://cocina.sul.stanford.edu/models/resources/file.jsonld',
26
+ type: type_strategy.run(files: files),
25
27
  label: label,
26
28
  structural: {
27
29
  contains: files.map(&:as_json)
@@ -32,7 +34,7 @@ module SdrClient
32
34
 
33
35
  private
34
36
 
35
- attr_reader :files, :label
37
+ attr_reader :files, :label, :type_strategy
36
38
 
37
39
  # This creates the metadata for each file and symbolizes the keys
38
40
  # @return [Hash<Symbol,String>]
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SdrClient
4
+ module Deposit
5
+ # This strategy is for building the type of a fileset
6
+ class FileTypeFileSetStrategy
7
+ # @param [Array<SdrClient::Deposit::Files>] files the files that are part of this strategy
8
+ # @return [String] The URI that represents the type of file_set
9
+ def self.run(files: [])
10
+ Cocina::Models::Vocab::Resources.file
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SdrClient
4
+ module Deposit
5
+ # This strategy is for building the type of a fileset
6
+ class ImageFileSetStrategy
7
+ # @param [Array<SdrClient::Deposit::Files>] files the files that are part of this strategy
8
+ # @return [String] The URI that represents the type of file_set
9
+ def self.run(files: [])
10
+ Cocina::Models::Vocab::Resources.image
11
+ end
12
+ end
13
+ end
14
+ end
@@ -10,10 +10,11 @@ module SdrClient
10
10
  # @param [Class] grouping_strategy class whose run method groups an array of uploads
11
11
  # Additional metadata includes access, preserve, shelve, publish, md5, sha1
12
12
  # @param [Logger] logger the logger to use
13
- def initialize(metadata:, grouping_strategy:, logger:)
13
+ def initialize(metadata:, grouping_strategy:, logger:, file_set_type_strategy: FileTypeFileSetStrategy)
14
14
  @metadata = metadata
15
15
  @logger = logger
16
16
  @grouping_strategy = grouping_strategy
17
+ @file_set_type_strategy = file_set_type_strategy
17
18
  end
18
19
 
19
20
  # @param [UploadFiles] upload_responses the uploaded file information
@@ -34,7 +35,8 @@ module SdrClient
34
35
  grouped_uploads.map.with_index(1) do |upload_group, i|
35
36
  FileSet.new(uploads: upload_group,
36
37
  uploads_metadata: metadata_group(upload_group),
37
- label: label(i))
38
+ label: label(i),
39
+ type_strategy: @file_set_type_strategy)
38
40
  end
39
41
  end
40
42
 
@@ -73,6 +73,8 @@ require 'json'
73
73
  require 'sdr_client/deposit/create_resource'
74
74
  require 'sdr_client/deposit/single_file_grouping_strategy'
75
75
  require 'sdr_client/deposit/matching_file_grouping_strategy'
76
+ require 'sdr_client/deposit/file_type_file_set_strategy'
77
+ require 'sdr_client/deposit/image_file_set_strategy'
76
78
  require 'sdr_client/deposit/files/direct_upload_request'
77
79
  require 'sdr_client/deposit/files/direct_upload_response'
78
80
  require 'sdr_client/deposit/file'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SdrClient
4
- VERSION = '0.66.0'
4
+ VERSION = '0.67.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.66.0
4
+ version: 0.67.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: 2022-02-08 00:00:00.000000000 Z
11
+ date: 2022-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -214,8 +214,10 @@ files:
214
214
  - lib/sdr_client/deposit/file_metadata_builder_operations/mime_type.rb
215
215
  - lib/sdr_client/deposit/file_metadata_builder_operations/sha1.rb
216
216
  - lib/sdr_client/deposit/file_set.rb
217
+ - lib/sdr_client/deposit/file_type_file_set_strategy.rb
217
218
  - lib/sdr_client/deposit/files/direct_upload_request.rb
218
219
  - lib/sdr_client/deposit/files/direct_upload_response.rb
220
+ - lib/sdr_client/deposit/image_file_set_strategy.rb
219
221
  - lib/sdr_client/deposit/matching_file_grouping_strategy.rb
220
222
  - lib/sdr_client/deposit/metadata_builder.rb
221
223
  - lib/sdr_client/deposit/model_process.rb
@@ -254,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
254
256
  - !ruby/object:Gem::Version
255
257
  version: '0'
256
258
  requirements: []
257
- rubygems_version: 3.2.32
259
+ rubygems_version: 3.3.4
258
260
  signing_key:
259
261
  specification_version: 4
260
262
  summary: The CLI for https://github.com/sul-dlss/sdr-api