sdr-client 0.5.0 → 0.6.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: 565e7d34958ad818fcc048440816b0a360fa723ea6e62dc9437c6832ba8877c1
4
- data.tar.gz: 14dfae8ecef2b6d05a256a8bdc7aebebfe801a278546c98bd3066169f7c98899
3
+ metadata.gz: 04b34e821d56af3fb15c920c9955df147ac75ed028d111a37fac03612f9cc556
4
+ data.tar.gz: ed5c6b78582aa9c61b4fce2e191556508b9d467fbd3a3c615c09c5ac02cea43a
5
5
  SHA512:
6
- metadata.gz: bc629b8837567ee95b01ce673a1f1b49596c3665810ab8d59573012b3b9b6a674db12dde7d15461a279f87a4ef88ed23d65d2457bbc7c0479330f45b3f2c1649
7
- data.tar.gz: fe176665dadd92ae291b7dbf5b461bb40606600383ad81c9824a8a4bad83344db5e74b6568a10eced02f4fa14894188122605ac2b7ecd5176d7b25b241963da4
6
+ metadata.gz: 6112ce1e149109355702197254a126ca340d35f45de00574d765d455daae52ff9fdc7214cc1716cf46020315482c9a39e0bd82b18433e5b803e7275f81e4d965
7
+ data.tar.gz: 9b242e5439bcb5e55c7272d2238b41c0284b29f482fbfe53205e2c7b9f5daab0bffc23f515d7785d4d18c654c3bf949356c3a36968c22f2d56c4017fd16cdc68
@@ -15,3 +15,7 @@ Metrics/BlockLength:
15
15
  - 'spec/**/*'
16
16
  ExcludedMethods:
17
17
  - 'OptionParser.new'
18
+
19
+ Naming/FileName:
20
+ Exclude:
21
+ - 'lib/sdr-client.rb'
@@ -14,8 +14,3 @@ Metrics/AbcSize:
14
14
  # Configuration parameters: CountComments, ExcludedMethods.
15
15
  Metrics/MethodLength:
16
16
  Max: 13
17
-
18
- # Offense count: 2
19
- # Configuration parameters: CountKeywordArgs.
20
- Metrics/ParameterLists:
21
- Max: 8
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'sdr_client'
@@ -4,21 +4,25 @@ module SdrClient
4
4
  module Deposit
5
5
  # This represents the File metadata that we send to the server for doing a deposit
6
6
  class File
7
- def initialize(external_identifier:, label:, filename:, access: 'dark', preserve: false, shelve: false,
8
- md5: nil, sha1: nil)
7
+ # rubocop:disable Metrics/ParameterLists
8
+ def initialize(external_identifier:, label:, filename:,
9
+ access: 'dark', preserve: false, shelve: false,
10
+ mime_type: nil, md5: nil, sha1: nil)
9
11
  @external_identifier = external_identifier
10
12
  @label = label
11
13
  @filename = filename
12
14
  @access = access
13
15
  @preserve = preserve
14
16
  @shelve = shelve
17
+ @mime_type = mime_type
15
18
  @md5 = md5
16
19
  @sha1 = sha1
17
20
  end
21
+ # rubocop:enable Metrics/ParameterLists
18
22
 
19
23
  # rubocop:disable Metrics/MethodLength
20
24
  def as_json
21
- json = {
25
+ {
22
26
  "type": 'http://cocina.sul.stanford.edu/models/file.jsonld',
23
27
  label: @label,
24
28
  filename: @filename,
@@ -30,9 +34,10 @@ module SdrClient
30
34
  sdrPreserve: @preserve,
31
35
  shelve: @shelve
32
36
  }
33
- }
34
- json['hasMessageDigests'] = message_digests unless message_digests.empty?
35
- json
37
+ }.tap do |json|
38
+ json['hasMessageDigests'] = message_digests unless message_digests.empty?
39
+ json['hasMimeType'] = @mime_type if @mime_type
40
+ end
36
41
  end
37
42
  # rubocop:enable Metrics/MethodLength
38
43
 
@@ -20,7 +20,7 @@ module SdrClient
20
20
  "type": 'http://cocina.sul.stanford.edu/models/fileset.jsonld',
21
21
  "label": label,
22
22
  structural: {
23
- hasMember: files.map(&:as_json)
23
+ contains: files.map(&:as_json)
24
24
  }
25
25
  }
26
26
  end
@@ -16,6 +16,7 @@ module SdrClient
16
16
  # @param [Hash<String, Hash<String, String>>] files_metadata file name, hash of additional file metadata
17
17
  # Additional metadata includes access, preserve, shelve, md5, sha1
18
18
  # @param [Logger] logger the logger to use
19
+ # rubocop:disable Metrics/ParameterLists
19
20
  def initialize(metadata:, grouping_strategy: SingleFileGroupingStrategy, url:,
20
21
  token:, files: [], files_metadata: {}, logger: Logger.new(STDOUT))
21
22
  @files = files
@@ -26,6 +27,7 @@ module SdrClient
26
27
  @grouping_strategy = grouping_strategy
27
28
  @files_metadata = files_metadata
28
29
  end
30
+ # rubocop:enable Metrics/ParameterLists
29
31
 
30
32
  def run
31
33
  check_files_exist
@@ -7,6 +7,7 @@ module SdrClient
7
7
  # @param [String] label the required object label
8
8
  # @param [String] type (http://cocina.sul.stanford.edu/models/object.jsonld) the required object type.
9
9
  # @param [Array<FileSet>] file_sets the file sets to attach.
10
+ # rubocop:disable Metrics/ParameterLists
10
11
  def initialize(label: nil,
11
12
  apo:,
12
13
  collection:,
@@ -22,6 +23,7 @@ module SdrClient
22
23
  @apo = apo
23
24
  @file_sets = file_sets
24
25
  end
26
+ # rubocop:enable Metrics/ParameterLists
25
27
 
26
28
  def as_json
27
29
  {
@@ -65,7 +67,7 @@ module SdrClient
65
67
  def structural
66
68
  {
67
69
  isMemberOf: collection,
68
- hasMember: file_sets.map(&:as_json)
70
+ contains: file_sets.map(&:as_json)
69
71
  }
70
72
  end
71
73
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SdrClient
4
- VERSION = '0.5.0'
4
+ VERSION = '0.6.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.5.0
4
+ version: 0.6.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-01-27 00:00:00.000000000 Z
11
+ date: 2020-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-monads
@@ -158,6 +158,7 @@ files:
158
158
  - bin/console
159
159
  - bin/setup
160
160
  - exe/sdr
161
+ - lib/sdr-client.rb
161
162
  - lib/sdr_client.rb
162
163
  - lib/sdr_client/cli.rb
163
164
  - lib/sdr_client/credentials.rb