sdr-client 0.13.2 → 0.14.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: 99655b642622c2a87d9021fb1a30b4ffad6cf50eafded596239a1e6a4c9e835e
4
- data.tar.gz: 240394c4ccb55140a986abd586a052f6e64ea3900b1df1da6b18e0a08fb93acb
3
+ metadata.gz: 88c890262f2a757ff94a2d69978b70efb65dee59a66dd55b3dca60d0ce15aa14
4
+ data.tar.gz: 2f345dc020bd50f60098061034c128393d65d53df0303e9a1d632dbf5d5b35f8
5
5
  SHA512:
6
- metadata.gz: 6970ec37d84de3ec38011c5a84e1b5c18d0fa333435203d63f5624331e7f1fc8c6129766c81e66c90e320adb150782c7edc218c54ed9f55345a312b490cfc1d1
7
- data.tar.gz: 47b286e6ec4ebdcce13306ed2627fcb0f661447528b80bfafe371bb960cacb3018aaa6d565470be31254caffa9ff17e3cd0fd50e375f89725f842ccc2676c19b
6
+ metadata.gz: b7c8407114bb7b6054735a1bff35115da421ce9ab8fb616c5193a257639b682f32124e05d4a16b5fd332c843eae9fc90bd3b7a0205434dda702927054346e217
7
+ data.tar.gz: 984521677d0314c1d4801d7a5616d4170c03cb4c7218fb61c689c52bc6adc1a255026d91505ece960df6ba988198d436177e96b79c0c2a19f25cf7dfc01d8c0a
data/exe/sdr CHANGED
@@ -75,6 +75,11 @@ subcommands = {
75
75
  options[:viewing_direction] = viewing_direction if %w[left-to-right right-to-left].include?(viewing_direction)
76
76
  end
77
77
 
78
+ opts.on('--access LEVEL', 'The access level for this object. ' \
79
+ 'Either "world", "stanford", "location-based", "citation-only" or "dark"') do |level|
80
+ options[:access] = level if %w[world stanford location-based citation-only dark].include?(level)
81
+ end
82
+
78
83
  opts.on('--files-metadata FILES_METADATA', 'A JSON object representing per-file metadata') do |files_metadata|
79
84
  options[:files_metadata] = JSON.parse(files_metadata)
80
85
  end
@@ -6,9 +6,11 @@ module SdrClient
6
6
  # The namespace for the "deposit" command
7
7
  module Deposit
8
8
  # rubocop:disable Metrics/ParameterLists
9
+ # rubocop:disable Metrics/MethodLength
9
10
  def self.run(label: nil,
10
11
  type: 'http://cocina.sul.stanford.edu/models/book.jsonld',
11
12
  viewing_direction: nil,
13
+ access: 'dark',
12
14
  apo:,
13
15
  collection: nil,
14
16
  catkey: nil,
@@ -24,6 +26,7 @@ module SdrClient
24
26
 
25
27
  metadata = Request.new(label: label,
26
28
  type: type,
29
+ access: access,
27
30
  apo: apo,
28
31
  collection: collection,
29
32
  source_id: source_id,
@@ -35,6 +38,7 @@ module SdrClient
35
38
  Process.new(metadata: metadata, url: url, token: token, files: files,
36
39
  grouping_strategy: grouping_strategy, logger: logger).run
37
40
  end
41
+ # rubocop:enable Metrics/MethodLength
38
42
  # rubocop:enable Metrics/ParameterLists
39
43
  end
40
44
  end
@@ -13,6 +13,7 @@ module SdrClient
13
13
  # Additional metadata includes access, preserve, shelve, md5, sha1
14
14
  # rubocop:disable Metrics/ParameterLists
15
15
  def initialize(label: nil,
16
+ access: 'dark',
16
17
  apo:,
17
18
  collection: nil,
18
19
  source_id:,
@@ -30,6 +31,7 @@ module SdrClient
30
31
  @catkey = catkey
31
32
  @embargo_release_date = embargo_release_date
32
33
  @embargo_access = embargo_access
34
+ @access = access
33
35
  @apo = apo
34
36
  @file_sets = file_sets
35
37
  @files_metadata = files_metadata
@@ -39,7 +41,7 @@ module SdrClient
39
41
 
40
42
  def as_json
41
43
  {
42
- access: access,
44
+ access: access_struct,
43
45
  type: type,
44
46
  administrative: administrative,
45
47
  identification: identification,
@@ -52,6 +54,7 @@ module SdrClient
52
54
  # @return [Request] a clone of this request with the file_sets added
53
55
  def with_file_sets(file_sets)
54
56
  Request.new(label: label,
57
+ access: access,
55
58
  apo: apo,
56
59
  collection: collection,
57
60
  source_id: source_id,
@@ -72,7 +75,7 @@ module SdrClient
72
75
 
73
76
  private
74
77
 
75
- attr_reader :label, :file_sets, :source_id, :catkey, :apo, :collection,
78
+ attr_reader :access, :label, :file_sets, :source_id, :catkey, :apo, :collection,
76
79
  :type, :files_metadata, :embargo_release_date, :embargo_access,
77
80
  :viewing_direction
78
81
 
@@ -96,8 +99,8 @@ module SdrClient
96
99
  end
97
100
  end
98
101
 
99
- def access
100
- {}.tap do |json|
102
+ def access_struct
103
+ { access: access }.tap do |json|
101
104
  if embargo_release_date
102
105
  json[:embargo] = {
103
106
  releaseDate: embargo_release_date.strftime('%FT%T%:z'),
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SdrClient
4
- VERSION = '0.13.2'
4
+ VERSION = '0.14.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.13.2
4
+ version: 0.14.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-20 00:00:00.000000000 Z
11
+ date: 2020-02-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-monads