sdr-client 0.89.0 → 0.92.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: 0e749426dd330fcaf3d0988f32707bde37010f2f305c6cdc383992c73f16ff3e
4
- data.tar.gz: 1526a4e18c42b5e1ce30ae4283173112cedbe83b24bdb78b928c2e84b5471b1a
3
+ metadata.gz: fee9fbecfa4695a631a2f394c5d1e0e78c03d68f163396c0c0acd8143395e78f
4
+ data.tar.gz: 899126bbd0faf0fee91291aca8e4b525c1e7f5b8e4c0bb83d071ca8d6c0a480e
5
5
  SHA512:
6
- metadata.gz: bc684b73cf7e8d9cbc2d4f0da3c02c1cc0db8277941c8a7888273ed5ed1c98e1eb83d979ec419342d182604dbcbb8231d6a3547e9a5905a88f1db6b53dcdea94
7
- data.tar.gz: 7acff379f70c228a728bfeb7a31119adde73f60703e350a0d413524194578e31c19ee02a4137232ae215b66a96953812294190103aa5de48ca85b26be4f6b6d9
6
+ metadata.gz: 5fe352e6c87e3b219fe5859d5597bf87722513e01099fa3dea27e345f4294a59400a01fbc1b49b3175ac6ee3538e056c792ed79836d862302793e08efdaf150c
7
+ data.tar.gz: 0ecc1e7dc161748587f48c8f2f4ea1a9590d65d89277a1701d89a1cb1042ba447088a976e5f6f43940fa808002fd479a0948770147ee1eea7259b96f60bcc19d
data/.rubocop.yml CHANGED
@@ -175,3 +175,10 @@ RSpec/Capybara/SpecificMatcher: # new in 2.12
175
175
  Enabled: true
176
176
  RSpec/Rails/HaveHttpStatus: # new in 2.12
177
177
  Enabled: true
178
+
179
+ Lint/RequireRangeParentheses: # new in 1.32
180
+ Enabled: true
181
+ Style/EmptyHeredoc: # new in 1.32
182
+ Enabled: true
183
+ Style/MagicCommentFormat: # new in 1.35
184
+ Enabled: true
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sdr-client (0.89.0)
4
+ sdr-client (0.91.0)
5
5
  activesupport
6
- cocina-models (~> 0.83.0)
6
+ cocina-models (~> 0.84.0)
7
7
  dry-monads
8
8
  faraday (>= 0.16)
9
9
 
@@ -15,12 +15,12 @@ GEM
15
15
  i18n (>= 1.6, < 2)
16
16
  minitest (>= 5.1)
17
17
  tzinfo (~> 2.0)
18
- addressable (2.8.0)
19
- public_suffix (>= 2.0.2, < 5.0)
18
+ addressable (2.8.1)
19
+ public_suffix (>= 2.0.2, < 6.0)
20
20
  ast (2.4.2)
21
21
  attr_extras (6.2.5)
22
22
  byebug (11.1.3)
23
- cocina-models (0.83.0)
23
+ cocina-models (0.84.0)
24
24
  activesupport
25
25
  deprecation
26
26
  dry-struct (~> 1.0)
@@ -43,9 +43,9 @@ GEM
43
43
  activesupport
44
44
  diff-lcs (1.5.0)
45
45
  docile (1.4.0)
46
- dry-container (0.10.0)
46
+ dry-container (0.10.1)
47
47
  concurrent-ruby (~> 1.0)
48
- dry-core (0.7.1)
48
+ dry-core (0.8.1)
49
49
  concurrent-ruby (~> 1.0)
50
50
  dry-inflector (0.3.0)
51
51
  dry-logic (1.2.0)
@@ -68,35 +68,33 @@ GEM
68
68
  activesupport (>= 3.0, < 8.0)
69
69
  equivalent-xml (0.6.0)
70
70
  nokogiri (>= 1.4.3)
71
- faraday (2.3.0)
72
- faraday-net_http (~> 2.0)
71
+ faraday (2.5.2)
72
+ faraday-net_http (>= 2.0, < 3.1)
73
73
  ruby2_keywords (>= 0.0.4)
74
- faraday-net_http (2.0.3)
74
+ faraday-net_http (3.0.0)
75
75
  hashdiff (1.0.1)
76
- i18n (1.11.0)
76
+ i18n (1.12.0)
77
77
  concurrent-ruby (~> 1.0)
78
78
  ice_nine (0.11.2)
79
79
  json (2.6.2)
80
80
  jsonpath (1.1.2)
81
81
  multi_json
82
- mini_portile2 (2.8.0)
83
- minitest (5.16.2)
82
+ minitest (5.16.3)
84
83
  multi_json (1.15.0)
85
- nokogiri (1.13.6)
86
- mini_portile2 (~> 2.8.0)
84
+ nokogiri (1.13.8-x86_64-darwin)
87
85
  racc (~> 1.4)
88
- nokogiri (1.13.6-x86_64-darwin)
86
+ nokogiri (1.13.8-x86_64-linux)
89
87
  racc (~> 1.4)
90
88
  openapi3_parser (0.9.2)
91
89
  commonmarker (~> 0.17)
92
90
  openapi_parser (0.15.0)
93
91
  optimist (3.0.1)
94
92
  parallel (1.22.1)
95
- parser (3.1.2.0)
93
+ parser (3.1.2.1)
96
94
  ast (~> 2.4.1)
97
95
  patience_diff (1.2.0)
98
96
  optimist (~> 3.0)
99
- public_suffix (4.0.7)
97
+ public_suffix (5.0.0)
100
98
  racc (1.6.0)
101
99
  rainbow (3.1.1)
102
100
  rake (13.0.6)
@@ -119,17 +117,17 @@ GEM
119
117
  rspec-core (>= 2, < 4, != 2.12.0)
120
118
  rss (0.2.9)
121
119
  rexml
122
- rubocop (1.31.2)
120
+ rubocop (1.35.1)
123
121
  json (~> 2.3)
124
122
  parallel (~> 1.10)
125
- parser (>= 3.1.0.0)
123
+ parser (>= 3.1.2.1)
126
124
  rainbow (>= 2.2.2, < 4.0)
127
125
  regexp_parser (>= 1.8, < 3.0)
128
126
  rexml (>= 3.2.5, < 4.0)
129
- rubocop-ast (>= 1.18.0, < 2.0)
127
+ rubocop-ast (>= 1.20.1, < 2.0)
130
128
  ruby-progressbar (~> 1.7)
131
129
  unicode-display_width (>= 1.4.0, < 3.0)
132
- rubocop-ast (1.19.1)
130
+ rubocop-ast (1.21.0)
133
131
  parser (>= 3.1.1.0)
134
132
  rubocop-rake (0.6.0)
135
133
  rubocop (~> 1.0)
@@ -148,16 +146,17 @@ GEM
148
146
  diff-lcs
149
147
  patience_diff
150
148
  thor (1.2.1)
151
- tzinfo (2.0.4)
149
+ tzinfo (2.0.5)
152
150
  concurrent-ruby (~> 1.0)
153
151
  unicode-display_width (2.2.0)
154
- webmock (3.14.0)
152
+ webmock (3.18.1)
155
153
  addressable (>= 2.8.0)
156
154
  crack (>= 0.3.2)
157
155
  hashdiff (>= 0.4.0, < 2.0.0)
158
156
  zeitwerk (2.6.0)
159
157
 
160
158
  PLATFORMS
159
+ x86_64-darwin-19
161
160
  x86_64-darwin-21
162
161
  x86_64-linux
163
162
 
@@ -5,14 +5,8 @@ module SdrClient
5
5
  # Creates a resource (metadata) in SDR
6
6
  class CreateResource
7
7
  DRO_PATH = '/v1/resources'
8
- # rubocop:disable Metrics/ParameterLists
9
- def self.run(accession:, metadata:, logger:, connection:, assign_doi: false, priority: nil)
10
- new(accession: accession,
11
- priority: priority,
12
- assign_doi: assign_doi,
13
- metadata: metadata,
14
- logger: logger,
15
- connection: connection).run
8
+ def self.run(**args)
9
+ new(**args).run
16
10
  end
17
11
 
18
12
  # @param [Boolean] accession should the accessionWF be started
@@ -21,7 +15,8 @@ module SdrClient
21
15
  # @param [Hash<Symbol,String>] the result of the metadata call
22
16
  # @param [String] priority what processing priority should be used
23
17
  # either 'low' or 'default'
24
- def initialize(accession:, assign_doi:, metadata:, logger:, connection:, priority: nil)
18
+ # rubocop:disable Metrics/ParameterLists
19
+ def initialize(accession:, metadata:, logger:, connection:, assign_doi: false, priority: nil)
25
20
  @accession = accession
26
21
  @priority = priority
27
22
  @assign_doi = assign_doi
@@ -9,12 +9,15 @@ module SdrClient
9
9
  # @param [Cocina::Model::RequestDRO] request_dro for depositing
10
10
  # @param [Connection] connection the connection to use
11
11
  # @param [Boolean] accession should the accessionWF be started
12
+ # @param [String] priority (nil) what processing priority should be used
13
+ # either 'low' or 'default'
12
14
  # @param [Array<String>] files a list of file names to upload
13
15
  # @param [Boolean] assign_doi should a DOI be assigned to this item
14
16
  # @param [Logger] logger the logger to use
15
17
  def initialize(request_dro:, # rubocop:disable Metrics/ParameterLists
16
18
  connection:,
17
19
  accession:,
20
+ priority: nil,
18
21
  files: [],
19
22
  assign_doi: false,
20
23
  logger: Logger.new($stdout))
@@ -23,6 +26,7 @@ module SdrClient
23
26
  @request_dro = request_dro
24
27
  @logger = logger
25
28
  @accession = accession
29
+ @priority = priority
26
30
  @assign_doi = assign_doi
27
31
  end
28
32
 
@@ -36,6 +40,7 @@ module SdrClient
36
40
  connection: connection)
37
41
  new_request_dro = UpdateDroWithFileIdentifiers.update(request_dro: request_dro, upload_responses: upload_responses)
38
42
  CreateResource.run(accession: @accession,
43
+ priority: @priority,
39
44
  assign_doi: @assign_doi,
40
45
  metadata: new_request_dro,
41
46
  logger: logger,
@@ -6,16 +6,18 @@ module SdrClient
6
6
  class UpdateResource
7
7
  DRO_PATH = '/v1/resources/%<id>s'
8
8
 
9
- def self.run(metadata:, logger:, connection:)
10
- new(metadata: metadata, logger: logger, connection: connection).run
9
+ def self.run(metadata:, logger:, connection:, version_description: nil)
10
+ new(metadata: metadata, logger: logger, connection: connection, version_description: version_description).run
11
11
  end
12
12
 
13
13
  # @param [Cocina::Models::DRO] metadata
14
14
  # @param [Hash<Symbol,String>] the result of the metadata call
15
- def initialize(metadata:, logger:, connection:)
15
+ # @param [String] version_description
16
+ def initialize(metadata:, logger:, connection:, version_description: nil)
16
17
  @metadata = metadata
17
18
  @logger = logger
18
19
  @connection = connection
20
+ @version_description = version_description
19
21
  end
20
22
 
21
23
  # @param [Hash<Symbol,String>] the result of the metadata call
@@ -31,7 +33,7 @@ module SdrClient
31
33
 
32
34
  private
33
35
 
34
- attr_reader :metadata, :logger, :connection
36
+ attr_reader :metadata, :logger, :connection, :version_description
35
37
 
36
38
  def metadata_request
37
39
  json = metadata.to_json
@@ -39,7 +41,9 @@ module SdrClient
39
41
 
40
42
  connection.put(path(metadata), json,
41
43
  'Content-Type' => 'application/json',
42
- 'X-Cocina-Models-Version' => Cocina::Models::VERSION)
44
+ 'X-Cocina-Models-Version' => Cocina::Models::VERSION) do |req|
45
+ req.params['versionDescription'] = version_description if version_description
46
+ end
43
47
  end
44
48
 
45
49
  def path(metadata)
@@ -56,21 +56,23 @@ module SdrClient
56
56
  logger: logger).run
57
57
  end
58
58
  # rubocop:enable Metrics/MethodLength
59
- # rubocop:enable Metrics/ParameterLists
60
59
 
61
60
  # @param [Array<String>] files absolute paths to files
62
61
  def self.model_run(request_dro:,
63
62
  files: [],
64
63
  url:,
65
64
  accession:,
65
+ priority: nil,
66
66
  logger: Logger.new($stdout))
67
67
  connection = Connection.new(url: url)
68
68
  ModelProcess.new(request_dro: request_dro,
69
69
  connection: connection,
70
70
  files: files,
71
71
  logger: logger,
72
- accession: accession).run
72
+ accession: accession,
73
+ priority: priority).run
73
74
  end
75
+ # rubocop:enable Metrics/ParameterLists
74
76
  end
75
77
  end
76
78
  require 'json'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SdrClient
4
- VERSION = '0.89.0'
4
+ VERSION = '0.92.0'
5
5
  end
data/sdr-client.gemspec CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ['lib']
29
29
 
30
30
  spec.add_dependency 'activesupport'
31
- spec.add_dependency 'cocina-models', '~> 0.83.0'
31
+ spec.add_dependency 'cocina-models', '~> 0.84.0'
32
32
  spec.add_dependency 'dry-monads'
33
33
  spec.add_dependency 'faraday', '>= 0.16'
34
34
 
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.89.0
4
+ version: 0.92.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: 2022-07-15 00:00:00.000000000 Z
11
+ date: 2022-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.83.0
33
+ version: 0.84.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.83.0
40
+ version: 0.84.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: dry-monads
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -274,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
274
274
  - !ruby/object:Gem::Version
275
275
  version: '0'
276
276
  requirements: []
277
- rubygems_version: 3.3.7
277
+ rubygems_version: 3.2.32
278
278
  signing_key:
279
279
  specification_version: 4
280
280
  summary: The CLI for https://github.com/sul-dlss/sdr-api