sdr-client 0.56.0 → 0.60.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: 335b17d92fb6fc1987038e7837b751ca4c918b4bfb3510e6738e763191416aa4
4
- data.tar.gz: db5ef06226d88fdab05db520a5402ce3606e119147386d7fcc1e52027bb0f1b0
3
+ metadata.gz: 827537801986b42218654f8edb47fe460c1bb9cf802ed11b1f9bd22fe6c419f0
4
+ data.tar.gz: c60c836e2822365cead36f7dfec7984bbe903b331b7eccf1483810a1598e8188
5
5
  SHA512:
6
- metadata.gz: da2726c5a061d58185d32ba50d7a17073a8ad35cb4db9469875895a60374fbab96d07df007c684078589ba3efb85d2b6590a60de6cd3164fd41d26746e71392c
7
- data.tar.gz: e1a60e9dec9cb2d6b32788f87da85f9667b00cb4b2a6ec592c83acff1508eb6f6842ed8befc2915714e822e8d8190320a85e397c50f751a114db546cfb640eff
6
+ metadata.gz: 818ea7f4c057215f2160375043cf58569256448159eda5d71863558cd9d55fdbe3cab21ac729769940251a582e31878ce1d5f3a2f3d2a130902f57718178c453
7
+ data.tar.gz: 17aafa6c32f3f95792f0cfa08c31ffb5acddd0158b1fa36c7c1bfbefd97b097e144d8faab4e899ee0cd6bdeaf07d03a85d84442c48f6a4ca4e6a6d65b29caf80
@@ -6,15 +6,21 @@ module SdrClient
6
6
  class CreateResource
7
7
  DRO_PATH = '/v1/resources'
8
8
 
9
- def self.run(accession:, metadata:, logger:, connection:)
10
- new(accession: accession, metadata: metadata, logger: logger, connection: connection).run
9
+ def self.run(accession:, assign_doi: false, metadata:, logger:, connection:)
10
+ new(accession: accession,
11
+ assign_doi: assign_doi,
12
+ metadata: metadata,
13
+ logger: logger,
14
+ connection: connection).run
11
15
  end
12
16
 
13
17
  # @param [Boolean] accession should the accessionWF be started
18
+ # @param [Boolean] assign_doi should a DOI be assigned to this item
14
19
  # @param [Cocina::Models::RequestDRO, Cocina::Models::RequestCollection] metadata
15
20
  # @param [Hash<Symbol,String>] the result of the metadata call
16
- def initialize(accession:, metadata:, logger:, connection:)
21
+ def initialize(accession:, assign_doi:, metadata:, logger:, connection:)
17
22
  @accession = accession
23
+ @assign_doi = assign_doi
18
24
  @metadata = metadata
19
25
  @logger = logger
20
26
  @connection = connection
@@ -48,8 +54,14 @@ module SdrClient
48
54
  @accession
49
55
  end
50
56
 
57
+ def assign_doi?
58
+ @assign_doi
59
+ end
60
+
51
61
  def path
52
- "#{DRO_PATH}?accession=#{accession?}"
62
+ params = { accession: accession? }
63
+ params[:assign_doi] = true if assign_doi? # false is default
64
+ DRO_PATH + '?' + params.map { |k, v| "#{k}=#{v}" }.join('&')
53
65
  end
54
66
  end
55
67
  end
@@ -15,7 +15,7 @@ module SdrClient
15
15
  @access = access
16
16
  @download = download
17
17
  @preserve = preserve
18
- @shelve = shelve
18
+ @shelve = access == 'dark' ? false : shelve
19
19
  @publish = publish
20
20
  @mime_type = mime_type
21
21
  @md5 = md5
@@ -5,7 +5,7 @@ module SdrClient
5
5
  # This represents the FileSet metadata that we send to the server for doing a deposit
6
6
  class FileSet
7
7
  # @param [Array] uploads
8
- # @param [Hash<String,Hash<String,String>>] the file level metadata
8
+ # @param [Hash<String,Hash<String,String>>] uploads_metadata the file level metadata
9
9
  # @param [Array] files
10
10
  # @param [String] label
11
11
  def initialize(uploads: [], uploads_metadata: {}, files: [], label:)
@@ -10,14 +10,19 @@ module SdrClient
10
10
  # @param [Connection] connection the connection to use
11
11
  # @param [Array<String>] files a list of file names to upload
12
12
  # @param [Boolean] accession should the accessionWF be started
13
+ # @param [Boolean] assign_doi should a DOI be assigned to this item
13
14
  # @param [Logger] logger the logger to use
14
- def initialize(request_dro:, connection:,
15
- files: [], accession:, logger: Logger.new(STDOUT))
15
+ def initialize(request_dro:, # rubocop:disable Metrics/ParameterLists
16
+ connection:,
17
+ files: [], accession:,
18
+ assign_doi: false,
19
+ logger: Logger.new(STDOUT))
16
20
  @files = files
17
21
  @connection = connection
18
22
  @request_dro = request_dro
19
23
  @logger = logger
20
24
  @accession = accession
25
+ @assign_doi = assign_doi
21
26
  end
22
27
 
23
28
  def run
@@ -30,6 +35,7 @@ module SdrClient
30
35
  connection: connection)
31
36
  new_request_dro = UpdateDroWithFileIdentifiers.update(request_dro: request_dro, upload_responses: upload_responses)
32
37
  CreateResource.run(accession: @accession,
38
+ assign_doi: @assign_doi,
33
39
  metadata: new_request_dro,
34
40
  logger: logger,
35
41
  connection: connection)
@@ -10,18 +10,21 @@ module SdrClient
10
10
  # @param [Class] grouping_strategy class whose run method groups an array of uploads
11
11
  # @param [String] connection the server connection to use
12
12
  # @param [Array<String>] files a list of file names to upload
13
+ # @param [Boolean] assign_doi should a DOI be assigned to this item
13
14
  # @param [Boolean] accession should the accessionWF be started
14
15
  # @param [Logger] logger the logger to use
15
16
  #
16
17
  # rubocop:disable Metrics/ParameterLists
17
18
  def initialize(metadata:, grouping_strategy: SingleFileGroupingStrategy,
18
- connection:, files: [], accession:, logger: Logger.new(STDOUT))
19
+ connection:, files: [], accession:, assign_doi: false,
20
+ logger: Logger.new(STDOUT))
19
21
  @files = files
20
22
  @connection = connection
21
23
  @metadata = metadata
22
24
  @logger = logger
23
25
  @grouping_strategy = grouping_strategy
24
26
  @accession = accession
27
+ @assign_doi = assign_doi
25
28
  end
26
29
  # rubocop:enable Metrics/ParameterLists
27
30
 
@@ -40,6 +43,7 @@ module SdrClient
40
43
  request = metadata_builder.with_uploads(upload_responses)
41
44
  model = Cocina::Models.build_request(request.as_json.with_indifferent_access)
42
45
  CreateResource.run(accession: @accession,
46
+ assign_doi: @assign_doi,
43
47
  metadata: model,
44
48
  logger: logger,
45
49
  connection: connection)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SdrClient
4
- VERSION = '0.56.0'
4
+ VERSION = '0.60.0'
5
5
  end
data/sdr-client.gemspec CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ['lib']
29
29
 
30
30
  spec.add_dependency 'activesupport'
31
- spec.add_dependency 'cocina-models', '~> 0.59.0'
31
+ spec.add_dependency 'cocina-models', '~> 0.62.0'
32
32
  spec.add_dependency 'dry-monads'
33
33
  spec.add_dependency 'faraday', '>= 0.16'
34
34
 
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.56.0
4
+ version: 0.60.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: 2021-04-21 00:00:00.000000000 Z
11
+ date: 2021-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.59.0
33
+ version: 0.62.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.59.0
40
+ version: 0.62.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: dry-monads
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -239,7 +239,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
239
239
  - !ruby/object:Gem::Version
240
240
  version: '0'
241
241
  requirements: []
242
- rubygems_version: 3.0.3
242
+ rubygems_version: 3.1.4
243
243
  signing_key:
244
244
  specification_version: 4
245
245
  summary: The CLI for https://github.com/sul-dlss/sdr-api