sdr-client 0.58.0 → 0.59.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc628ea7480d2ef9102b3fa37f37fe23b0fa9ee11d7a883251b465b3f7518112
|
4
|
+
data.tar.gz: 8d0e09c1a92f0ee87be08efbbd359fd4499f671a0a3de9c7edde4afeaca70942
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 560557769b5867a0dbcb5c5f7ba9f5bb4ccb3b6e93637fc35df4e5a8f389dc9d4ab06bdacbb220d06d5a4f0af30761836740febe7be516a72355854fd834f581
|
7
|
+
data.tar.gz: 38a5f18f6f4bb293731058f08407dc42790ab2932c0d8ff0d9bcdaeedfb79cb880ae065756953411a2f9a7839539310fdb40982ac212a643fc0c08d789b38f46
|
@@ -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,
|
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
|
-
|
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
|
@@ -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:,
|
15
|
-
|
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:,
|
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)
|
data/lib/sdr_client/version.rb
CHANGED
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.
|
4
|
+
version: 0.59.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-07-
|
11
|
+
date: 2021-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|