sdr-client 0.25.0 → 0.26.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: 4ba412736744579cc3c7730354944d6357027106ca021c60e7363071a441ac21
4
- data.tar.gz: 808952a65481516130017e8215656062e06ed9386fbab4486eb2b00bf1e977a1
3
+ metadata.gz: bc94441356e85e3a35f47af78c1b64f4a9d15d7c74bdc0878bd4be7fa1f58970
4
+ data.tar.gz: f394f42beca6b52397efa057c737e1926d417f8bfcf0b04027b279cfe4b4e8f2
5
5
  SHA512:
6
- metadata.gz: dbc1f0cb2fd1edf1b3af487cb585aab7304600cae177791d0861eeacfed8ba15caf8e59fd222def840e2e102656868e73869ec739fcc499fc40c0807b17ddaf8
7
- data.tar.gz: 22a5983f2c7b3d77b70efbaab7a6e0280e9057cec80697c80759c4b6efd25fddfcd52c1b8b51c5bc4b819a42b9cabd09ecbb8abcb2522ba6ae2a25dfce2f97a7
6
+ metadata.gz: 4f14dd1c266779bbe8ce6f361589d518af6b6febe28b5a225112b56e08c090f5ed20d070d5a9a8265fc22fc2db0901b6629e66734b94a6986122fa6a7e62afaa
7
+ data.tar.gz: 3b8a03492afe8ca395f46018cfaa4c2eaec6a97547b2b5f8d69604d46e2247481d96c9015ce3389a73fef15e6b32a29d73f87bf88d09ae5e96bf7037286a8384
@@ -2,4 +2,11 @@
2
2
 
3
3
 
4
4
 
5
- ## Was the documentation (README, wiki) updated?
5
+ ## How was this change tested?
6
+
7
+
8
+
9
+ ## Which documentation and/or configurations were updated?
10
+
11
+
12
+
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+
5
+ module SdrClient
6
+ # API calls around background job results from dor-services-app
7
+ module BackgroundJobResults
8
+ # Get status/result of a background job
9
+ # @param url [String] url for the service
10
+ # @param job_id [String] required string representing a job identifier
11
+ # @return [Hash] result of background job
12
+ def self.show(url:, job_id:)
13
+ connection = Connection.new(url: "#{url}/v1/background_job_results/#{job_id}").connection
14
+ resp = connection.get
15
+
16
+ raise "unexpected response: #{response.status} #{response.body}" unless resp.success?
17
+
18
+ JSON.parse(resp.body).with_indifferent_access
19
+ end
20
+ end
21
+ end
@@ -26,6 +26,7 @@ module SdrClient
26
26
  # rubocop:enable Metrics/ParameterLists
27
27
 
28
28
  # rubocop:disable Metrics/AbcSize
29
+ # @return [String] job id for the background job result
29
30
  def run
30
31
  check_files_exist
31
32
  upload_responses = UploadFiles.new(files: files,
@@ -21,14 +21,14 @@ module SdrClient
21
21
  end
22
22
 
23
23
  # @param [Hash<Symbol,String>] the result of the metadata call
24
- # @return [Hash<Symbol,String>] the result of the metadata call
24
+ # @return [String] job id for the background job result
25
25
  def run
26
26
  response = metadata_request
27
27
  unexpected_response(response) unless response.status == 201
28
28
 
29
29
  logger.info("Response from server: #{response.body}")
30
30
 
31
- { druid: JSON.parse(response.body)['druid'], background_job: response.headers['Location'] }
31
+ JSON.parse(response.body)['jobId']
32
32
  end
33
33
 
34
34
  private
@@ -8,6 +8,7 @@ module SdrClient
8
8
  BOOK_TYPE = 'http://cocina.sul.stanford.edu/models/book.jsonld'
9
9
  # rubocop:disable Metrics/ParameterLists
10
10
  # rubocop:disable Metrics/MethodLength
11
+ # @return [String] job id for the background job result
11
12
  def self.run(label: nil,
12
13
  type: BOOK_TYPE,
13
14
  viewing_direction: nil,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SdrClient
4
- VERSION = '0.25.0'
4
+ VERSION = '0.26.0'
5
5
  end
data/lib/sdr_client.rb CHANGED
@@ -15,6 +15,7 @@ require 'sdr_client/login'
15
15
  require 'sdr_client/login_prompt'
16
16
  require 'sdr_client/cli'
17
17
  require 'sdr_client/connection'
18
+ require 'sdr_client/background_job_results'
18
19
 
19
20
  module SdrClient
20
21
  class Error < StandardError; 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.25.0
4
+ version: 0.26.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-04-27 00:00:00.000000000 Z
11
+ date: 2020-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -188,6 +188,7 @@ files:
188
188
  - exe/sdr
189
189
  - lib/sdr-client.rb
190
190
  - lib/sdr_client.rb
191
+ - lib/sdr_client/background_job_results.rb
191
192
  - lib/sdr_client/cli.rb
192
193
  - lib/sdr_client/connection.rb
193
194
  - lib/sdr_client/credentials.rb