sdr-client 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/sdr +13 -0
- data/lib/sdr_client/deposit/request.rb +11 -6
- data/lib/sdr_client/deposit.rb +3 -1
- data/lib/sdr_client/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da8833861db66f174c8be37bcdeac6ae21d55ae7eccc8c82d92a741a2950dbd3
|
4
|
+
data.tar.gz: d90a46cb7a0f82f0809c0dfb56717108c86b6dde2ab631ba6301a33054078636
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac2413e98d00015668123809d2a4a5a912caecfe9f841cae1be63f708757dc7af54dfe15680b658c7832140d87a96da20c66ecae2982f6a4fad348b1cdb24c05
|
7
|
+
data.tar.gz: f730e48203102415570b8915a2e6866dcc483b8ebd265e4f3f6d466b38b8542d0e14cbf1540fb5ad0ca505ff3790f9bda804994a82064acee2f036e5981f9132
|
data/exe/sdr
CHANGED
@@ -50,6 +50,14 @@ subcommands = {
|
|
50
50
|
options[:apo] = apo
|
51
51
|
end
|
52
52
|
|
53
|
+
opts.on('--type TYPE', 'The object type to create. ' \
|
54
|
+
'One of: "image", "book", "document", "map", "manuscript", "media", ' \
|
55
|
+
'"three_dimensional", "collection", or "admin_policy"') do |type|
|
56
|
+
if %w[image book document map manuscript media three_dimensional collection admin_policy].include?(type)
|
57
|
+
options[:type] = "http://cocina.sul.stanford.edu/models/#{type}.jsonld"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
53
61
|
opts.on('--collection COLLECTION', 'The druid identifier of the collection object') do |collection|
|
54
62
|
options[:collection] = collection
|
55
63
|
end
|
@@ -62,6 +70,11 @@ subcommands = {
|
|
62
70
|
options[:source_id] = source_id
|
63
71
|
end
|
64
72
|
|
73
|
+
opts.on('--viewing-direction DIRECTION', 'The viewing direction (if a book). ' \
|
74
|
+
'Either "left-to-right" or "right-to-left"') do |viewing_direction|
|
75
|
+
options[:viewing_direction] = viewing_direction if %w[left-to-right right-to-left].include?(viewing_direction)
|
76
|
+
end
|
77
|
+
|
65
78
|
opts.on('--files-metadata FILES_METADATA', 'A JSON object representing per-file metadata') do |files_metadata|
|
66
79
|
options[:files_metadata] = JSON.parse(files_metadata)
|
67
80
|
end
|
@@ -14,12 +14,13 @@ module SdrClient
|
|
14
14
|
# rubocop:disable Metrics/ParameterLists
|
15
15
|
def initialize(label: nil,
|
16
16
|
apo:,
|
17
|
-
collection
|
17
|
+
collection: nil,
|
18
18
|
source_id:,
|
19
19
|
catkey: nil,
|
20
20
|
embargo_release_date: nil,
|
21
21
|
embargo_access: 'world',
|
22
22
|
type: 'http://cocina.sul.stanford.edu/models/object.jsonld',
|
23
|
+
viewing_direction: nil,
|
23
24
|
file_sets: [],
|
24
25
|
files_metadata: {})
|
25
26
|
@label = label
|
@@ -32,6 +33,7 @@ module SdrClient
|
|
32
33
|
@apo = apo
|
33
34
|
@file_sets = file_sets
|
34
35
|
@files_metadata = files_metadata
|
36
|
+
@viewing_direction = viewing_direction
|
35
37
|
end
|
36
38
|
# rubocop:enable Metrics/ParameterLists
|
37
39
|
|
@@ -57,6 +59,7 @@ module SdrClient
|
|
57
59
|
embargo_release_date: embargo_release_date,
|
58
60
|
embargo_access: embargo_access,
|
59
61
|
type: type,
|
62
|
+
viewing_direction: viewing_direction,
|
60
63
|
file_sets: file_sets,
|
61
64
|
files_metadata: files_metadata)
|
62
65
|
end
|
@@ -70,7 +73,8 @@ module SdrClient
|
|
70
73
|
private
|
71
74
|
|
72
75
|
attr_reader :label, :file_sets, :source_id, :catkey, :apo, :collection,
|
73
|
-
:type, :files_metadata, :embargo_release_date, :embargo_access
|
76
|
+
:type, :files_metadata, :embargo_release_date, :embargo_access,
|
77
|
+
:viewing_direction
|
74
78
|
|
75
79
|
def administrative
|
76
80
|
{
|
@@ -85,10 +89,11 @@ module SdrClient
|
|
85
89
|
end
|
86
90
|
|
87
91
|
def structural
|
88
|
-
{
|
89
|
-
isMemberOf
|
90
|
-
contains
|
91
|
-
|
92
|
+
{}.tap do |json|
|
93
|
+
json[:isMemberOf] = collection if collection
|
94
|
+
json[:contains] = file_sets.map(&:as_json) unless file_sets.empty?
|
95
|
+
json[:hasMemberOrders] = [{ viewing_direction: viewing_direction }] if viewing_direction
|
96
|
+
end
|
92
97
|
end
|
93
98
|
|
94
99
|
def access
|
data/lib/sdr_client/deposit.rb
CHANGED
@@ -8,8 +8,9 @@ module SdrClient
|
|
8
8
|
# rubocop:disable Metrics/ParameterLists
|
9
9
|
def self.run(label: nil,
|
10
10
|
type: 'http://cocina.sul.stanford.edu/models/book.jsonld',
|
11
|
+
viewing_direction: nil,
|
11
12
|
apo:,
|
12
|
-
collection
|
13
|
+
collection: nil,
|
13
14
|
catkey: nil,
|
14
15
|
embargo_release_date: nil,
|
15
16
|
embargo_access: 'world',
|
@@ -29,6 +30,7 @@ module SdrClient
|
|
29
30
|
catkey: catkey,
|
30
31
|
embargo_release_date: embargo_release_date,
|
31
32
|
embargo_access: embargo_access,
|
33
|
+
viewing_direction: viewing_direction,
|
32
34
|
files_metadata: files_metadata)
|
33
35
|
Process.new(metadata: metadata, url: url, token: token, files: files,
|
34
36
|
grouping_strategy: grouping_strategy, logger: logger).run
|
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.12.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-02-
|
11
|
+
date: 2020-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-monads
|
@@ -198,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
198
198
|
- !ruby/object:Gem::Version
|
199
199
|
version: '0'
|
200
200
|
requirements: []
|
201
|
-
rubygems_version: 3.
|
201
|
+
rubygems_version: 3.0.3
|
202
202
|
signing_key:
|
203
203
|
specification_version: 4
|
204
204
|
summary: The CLI for https://github.com/sul-dlss/sdr-api
|