sdr-client 0.16.0 → 0.16.1

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: 51cea2d7a34db14a8fbef003f8e02b8db1483344724e2d1201fce2b3075f7fb7
4
- data.tar.gz: 0654575a55dca1ee8bc9764c02a5d512e90cba6ad257780f1938643968e8dd58
3
+ metadata.gz: d6d44bbb8b087e0045328a2b8625654ad9f7eaadf7c968c5ee5402683dc04d26
4
+ data.tar.gz: 9808626f7cad4548ccce883253245c80fc18fac9cd14353dcb008cb8c1cf365a
5
5
  SHA512:
6
- metadata.gz: 6b304533c8b61c34b03a4e40875b2bd3c8d2e50bf5fba6c104327a769248aaaaace4151e5a8033f2b214e87316f8065b63c880057a0a631adb94a74ff779097a
7
- data.tar.gz: b43e02b8160340b06bebf30642f65f885f73c25398d5f5190bd7453f0a99939f1d824535eefe83601b572f7e221b79069459d2959bef7401bd45bf5600ef2fd9
6
+ metadata.gz: e14bf4032db046e886a7ef02cc1183fab23806bf0b450527ad8e33f396d3cac1f2d254644e9f9e2179d38c04d200a4cdf09eb07515aabf0e8a7a2c7ad9367fd1
7
+ data.tar.gz: 39e311b8bb036dd2abff468086103be8e55516b1490d219c4c34e5b68b0c80322af47efd0dcc198ee11e3e24e484d7d206102f20e415ccfa171abd7d61d6fde5
@@ -5,10 +5,11 @@ require 'logger'
5
5
  module SdrClient
6
6
  # The namespace for the "deposit" command
7
7
  module Deposit
8
+ BOOK_TYPE = 'http://cocina.sul.stanford.edu/models/book.jsonld'
8
9
  # rubocop:disable Metrics/ParameterLists
9
10
  # rubocop:disable Metrics/MethodLength
10
11
  def self.run(label: nil,
11
- type: 'http://cocina.sul.stanford.edu/models/book.jsonld',
12
+ type: BOOK_TYPE,
12
13
  viewing_direction: nil,
13
14
  access: 'dark',
14
15
  use_statement: nil,
@@ -16,6 +16,8 @@ module SdrClient
16
16
  @grouping_strategy = grouping_strategy
17
17
  end
18
18
 
19
+ # @param [UploadFiles] upload_responses the uploaded file information
20
+ # @return [Request] the metadata with fileset information added in.
19
21
  def with_uploads(upload_responses)
20
22
  file_sets = build_filesets(uploads: upload_responses)
21
23
  metadata.with_file_sets(file_sets)
@@ -32,7 +34,16 @@ module SdrClient
32
34
  grouped_uploads.map.with_index(1) do |upload_group, i|
33
35
  FileSet.new(uploads: upload_group,
34
36
  uploads_metadata: metadata_group(upload_group),
35
- label: "Object #{i}")
37
+ label: label(i))
38
+ end
39
+ end
40
+
41
+ def label(index)
42
+ case metadata.type
43
+ when BOOK_TYPE
44
+ "Page #{index}"
45
+ else
46
+ "Object #{index}"
36
47
  end
37
48
  end
38
49
 
@@ -79,10 +79,12 @@ module SdrClient
79
79
  files_metadata.fetch(filename, {})
80
80
  end
81
81
 
82
+ attr_reader :type
83
+
82
84
  private
83
85
 
84
86
  attr_reader :access, :label, :file_sets, :source_id, :catkey, :apo, :collection,
85
- :type, :files_metadata, :embargo_release_date, :embargo_access,
87
+ :files_metadata, :embargo_release_date, :embargo_access,
86
88
  :viewing_direction, :use_statement, :copyright
87
89
 
88
90
  def administrative
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SdrClient
4
- VERSION = '0.16.0'
4
+ VERSION = '0.16.1'
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.16.0
4
+ version: 0.16.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-03-05 00:00:00.000000000 Z
11
+ date: 2020-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-monads