sdr-client 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21747acf342863a0778d124203f23e7857337d67f2e646e24e758d2650ce4da9
4
- data.tar.gz: 80bf83d4511cb5e62bdda45511ec5f0ce970d4846162242ba73d0f4df19afde8
3
+ metadata.gz: da8833861db66f174c8be37bcdeac6ae21d55ae7eccc8c82d92a741a2950dbd3
4
+ data.tar.gz: d90a46cb7a0f82f0809c0dfb56717108c86b6dde2ab631ba6301a33054078636
5
5
  SHA512:
6
- metadata.gz: 732e33520bec07bfbc78af0a0a904396d021be4821bccc1dde7b2bdcd7cf109e38f69cecf99f5ee1d512c02290e832620ae37f0372f358ecdc5533f8377ce022
7
- data.tar.gz: 134d5fa2291686a60122be430df385903a2ac50cca830188d932a6b35fa11b67df8bee692e8b49d9d7c726a083abca7cfce065db52ac4eddcef7b7cda261ecbf
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: collection,
90
- contains: file_sets.map(&:as_json)
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
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SdrClient
4
- VERSION = '0.11.0'
4
+ VERSION = '0.12.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.11.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-16 00:00:00.000000000 Z
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.1.2
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