sdr-client 0.23.0 → 0.26.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/pull_request_template.md +8 -1
- data/.rubocop_todo.yml +5 -4
- data/lib/sdr_client.rb +1 -0
- data/lib/sdr_client/background_job_results.rb +21 -0
- data/lib/sdr_client/deposit.rb +3 -0
- data/lib/sdr_client/deposit/file.rb +1 -1
- data/lib/sdr_client/deposit/process.rb +1 -0
- data/lib/sdr_client/deposit/request.rb +8 -2
- data/lib/sdr_client/deposit/upload_resource.rb +2 -2
- data/lib/sdr_client/model_deposit.rb +6 -1
- data/lib/sdr_client/version.rb +1 -1
- data/sdr-client.gemspec +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2f9928c696ecb5051e4f6ba708985a2448aaa3189f93df4fcd0b85ab733ea87
|
4
|
+
data.tar.gz: 457989602bdece5c31cbcc95276531721a6c5682c040176de7645c1730be4326
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94ed5ab0d789c3d2669979bb8753bd60d0f1a51f6434f6c8b28e210fc04dc4ffcd2af9125ef3b08e4e49996c5d05c2e53b5e8348794fbad351cc5dc57e4b0b0f
|
7
|
+
data.tar.gz: a816a3c86dccc3f90939a81eecf5cf46ef659b3fcc5d4c97948e41796bf13a1b2d5da8de958c0f58c5a46d0ab16f56fa813ef3d3c796671d7dd4b04fd591168f
|
data/.rubocop_todo.yml
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2020-
|
3
|
+
# on 2020-04-27 08:24:29 -0400 using RuboCop version 0.82.0.
|
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
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
9
|
+
# Offense count: 2
|
10
|
+
# Configuration parameters: IgnoredMethods.
|
10
11
|
Metrics/AbcSize:
|
11
12
|
Max: 16
|
12
13
|
|
13
|
-
# Offense count:
|
14
|
+
# Offense count: 7
|
14
15
|
# Configuration parameters: CountComments, ExcludedMethods.
|
15
16
|
Metrics/MethodLength:
|
16
|
-
Max:
|
17
|
+
Max: 15
|
data/lib/sdr_client.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module SdrClient
|
6
|
+
# API calls around background job results from dor-services-app
|
7
|
+
module BackgroundJobResults
|
8
|
+
# Get status/result of a background job
|
9
|
+
# @param url [String] url for the service
|
10
|
+
# @param job_id [String] required string representing a job identifier
|
11
|
+
# @return [Hash] result of background job
|
12
|
+
def self.show(url:, job_id:)
|
13
|
+
connection = Connection.new(url: "#{url}/v1/background_job_results/#{job_id}").connection
|
14
|
+
resp = connection.get
|
15
|
+
|
16
|
+
raise "unexpected response: #{resp.status} #{resp.body}" unless resp.success?
|
17
|
+
|
18
|
+
JSON.parse(resp.body).with_indifferent_access
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/sdr_client/deposit.rb
CHANGED
@@ -8,10 +8,12 @@ module SdrClient
|
|
8
8
|
BOOK_TYPE = 'http://cocina.sul.stanford.edu/models/book.jsonld'
|
9
9
|
# rubocop:disable Metrics/ParameterLists
|
10
10
|
# rubocop:disable Metrics/MethodLength
|
11
|
+
# @return [String] job id for the background job result
|
11
12
|
def self.run(label: nil,
|
12
13
|
type: BOOK_TYPE,
|
13
14
|
viewing_direction: nil,
|
14
15
|
access: 'dark',
|
16
|
+
download: 'none',
|
15
17
|
use_statement: nil,
|
16
18
|
copyright: nil,
|
17
19
|
apo:,
|
@@ -30,6 +32,7 @@ module SdrClient
|
|
30
32
|
metadata = Request.new(label: label,
|
31
33
|
type: type,
|
32
34
|
access: access,
|
35
|
+
download: download,
|
33
36
|
apo: apo,
|
34
37
|
use_statement: use_statement,
|
35
38
|
copyright: copyright,
|
@@ -6,7 +6,7 @@ module SdrClient
|
|
6
6
|
class File
|
7
7
|
# rubocop:disable Metrics/ParameterLists
|
8
8
|
def initialize(external_identifier:, label:, filename:,
|
9
|
-
access: '
|
9
|
+
access: 'world', preserve: true, shelve: true,
|
10
10
|
mime_type: nil, md5: nil, sha1: nil, use: nil)
|
11
11
|
@external_identifier = external_identifier
|
12
12
|
@label = label
|
@@ -14,6 +14,7 @@ module SdrClient
|
|
14
14
|
# rubocop:disable Metrics/ParameterLists
|
15
15
|
def initialize(label: nil,
|
16
16
|
access: 'dark',
|
17
|
+
download: 'none',
|
17
18
|
use_statement: nil,
|
18
19
|
copyright: nil,
|
19
20
|
apo:,
|
@@ -34,6 +35,7 @@ module SdrClient
|
|
34
35
|
@embargo_release_date = embargo_release_date
|
35
36
|
@embargo_access = embargo_access
|
36
37
|
@access = access
|
38
|
+
@download = download
|
37
39
|
@use_statement = use_statement
|
38
40
|
@copyright = copyright
|
39
41
|
@apo = apo
|
@@ -59,6 +61,7 @@ module SdrClient
|
|
59
61
|
def with_file_sets(file_sets)
|
60
62
|
Request.new(label: label,
|
61
63
|
access: access,
|
64
|
+
download: download,
|
62
65
|
apo: apo,
|
63
66
|
collection: collection,
|
64
67
|
copyright: copyright,
|
@@ -85,7 +88,7 @@ module SdrClient
|
|
85
88
|
|
86
89
|
attr_reader :access, :label, :file_sets, :source_id, :catkey, :apo, :collection,
|
87
90
|
:files_metadata, :embargo_release_date, :embargo_access,
|
88
|
-
:viewing_direction, :use_statement, :copyright
|
91
|
+
:viewing_direction, :use_statement, :copyright, :download
|
89
92
|
|
90
93
|
def administrative
|
91
94
|
{
|
@@ -108,7 +111,10 @@ module SdrClient
|
|
108
111
|
end
|
109
112
|
|
110
113
|
def access_struct
|
111
|
-
{
|
114
|
+
{
|
115
|
+
access: access,
|
116
|
+
download: download
|
117
|
+
}.tap do |json|
|
112
118
|
json[:useAndReproductionStatement] = use_statement if use_statement
|
113
119
|
json[:copyright] = copyright if copyright
|
114
120
|
|
@@ -21,14 +21,14 @@ module SdrClient
|
|
21
21
|
end
|
22
22
|
|
23
23
|
# @param [Hash<Symbol,String>] the result of the metadata call
|
24
|
-
# @return [
|
24
|
+
# @return [String] job id for the background job result
|
25
25
|
def run
|
26
26
|
response = metadata_request
|
27
27
|
unexpected_response(response) unless response.status == 201
|
28
28
|
|
29
29
|
logger.info("Response from server: #{response.body}")
|
30
30
|
|
31
|
-
|
31
|
+
JSON.parse(response.body)['jobId']
|
32
32
|
end
|
33
33
|
|
34
34
|
private
|
@@ -8,9 +8,14 @@ module SdrClient
|
|
8
8
|
def self.model_run(request_dro:,
|
9
9
|
files: [],
|
10
10
|
url:,
|
11
|
+
accession:,
|
11
12
|
logger: Logger.new(STDOUT))
|
12
13
|
connection = Connection.new(url: url)
|
13
|
-
ModelProcess.new(request_dro: request_dro,
|
14
|
+
ModelProcess.new(request_dro: request_dro,
|
15
|
+
connection: connection,
|
16
|
+
files: files,
|
17
|
+
logger: logger,
|
18
|
+
accession: accession).run
|
14
19
|
end
|
15
20
|
end
|
16
21
|
end
|
data/lib/sdr_client/version.rb
CHANGED
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.
|
31
|
+
spec.add_dependency 'cocina-models', '~> 0.32.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.
|
4
|
+
version: 0.26.1
|
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-
|
11
|
+
date: 2020-06-08 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.
|
33
|
+
version: 0.32.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.
|
40
|
+
version: 0.32.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: dry-monads
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -188,6 +188,7 @@ files:
|
|
188
188
|
- exe/sdr
|
189
189
|
- lib/sdr-client.rb
|
190
190
|
- lib/sdr_client.rb
|
191
|
+
- lib/sdr_client/background_job_results.rb
|
191
192
|
- lib/sdr_client/cli.rb
|
192
193
|
- lib/sdr_client/connection.rb
|
193
194
|
- lib/sdr_client/credentials.rb
|
@@ -234,7 +235,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
234
235
|
- !ruby/object:Gem::Version
|
235
236
|
version: '0'
|
236
237
|
requirements: []
|
237
|
-
rubygems_version: 3.
|
238
|
+
rubygems_version: 3.0.3
|
238
239
|
signing_key:
|
239
240
|
specification_version: 4
|
240
241
|
summary: The CLI for https://github.com/sul-dlss/sdr-api
|