dor-services-client 1.1.0 → 1.1.1

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: 2b750e59b5465e3b4c75b7122071f3398618ec9c861ac0494c77956ba97b3a1a
4
- data.tar.gz: 1a86fa9cf387b199fc3560a101d889ab9287e1183c2b32f165d7f87503d9a6c6
3
+ metadata.gz: 8647a5b059a14045feb35bb4fe72147cc44854dfb88e19c7af98132a719ba8aa
4
+ data.tar.gz: 715989551938b54347651a53e3221a46d68d7e7d455ac6ac65e7e0bb766f38d2
5
5
  SHA512:
6
- metadata.gz: 11b7a35b2a9be2bbf1abff74c8a17ab5fdf3725fb45423b8f148d15bfe28a8eda16ece00a9d7e4d8e6d59f937ba34c1d88a224ff8ffb3a8f6f50d364561e3dbe
7
- data.tar.gz: 4738fc58390fd1465299c7df58c2cf5af700231e63ee6f02486f3ad852f8cb251d895da4bee11072917925a7cc39e48a45fcf7990881f5a90dee23573e1d8ca6
6
+ metadata.gz: 9ce7568f2fbd9b2672eb5879a68bc07fc7b29f092f8ec2fa4c00c9683a199f6801a3c3386a8f81ff60d4de10ad861a07e7722c32146ab9d9c5e6d9091195366e
7
+ data.tar.gz: f1b77e539cde7590cc63270eb577dfa95131f9a4b893c5ff4efc87c53c3705557034516cf0b3ea7dd3ee07a58a6c1d4503c29d401de283fe8226c8c27a8f2305
@@ -5,10 +5,10 @@ module Dor
5
5
  class Client
6
6
  # API calls relating to files
7
7
  class Files < VersionedService
8
- # @param object_id [String] the pid for the object
9
- def initialize(connection:, version:, object_id:)
8
+ # @param object_identifier [String] the pid for the object
9
+ def initialize(connection:, version:, object_identifier:)
10
10
  super(connection: connection, version: version)
11
- @object_id = object_id
11
+ @object_identifier = object_identifier
12
12
  end
13
13
 
14
14
  # Get the contents from the workspace
@@ -16,7 +16,7 @@ module Dor
16
16
  # @return [String] the file contents from the workspace
17
17
  def retrieve(filename:)
18
18
  resp = connection.get do |req|
19
- req.url "#{api_version}/objects/#{object_id}/contents/#{filename}"
19
+ req.url "#{api_version}/objects/#{object_identifier}/contents/#{filename}"
20
20
  end
21
21
  return unless resp.success?
22
22
 
@@ -29,7 +29,7 @@ module Dor
29
29
  # @return [String] the file contents from the SDR
30
30
  def preserved_content(filename:, version:)
31
31
  resp = connection.get do |req|
32
- req.url "#{api_version}/sdr/objects/#{object_id}/content/#{CGI.escape(filename)}?version=#{version}"
32
+ req.url "#{api_version}/sdr/objects/#{object_identifier}/content/#{CGI.escape(filename)}?version=#{version}"
33
33
  end
34
34
  return unless resp.success?
35
35
 
@@ -40,7 +40,7 @@ module Dor
40
40
  # @return [Array<String>] the list of filenames in the workspace
41
41
  def list
42
42
  resp = connection.get do |req|
43
- req.url "#{api_version}/objects/#{object_id}/contents"
43
+ req.url "#{api_version}/objects/#{object_identifier}/contents"
44
44
  end
45
45
  return [] unless resp.success?
46
46
 
@@ -50,7 +50,7 @@ module Dor
50
50
 
51
51
  private
52
52
 
53
- attr_reader :object_id
53
+ attr_reader :object_identifier
54
54
  end
55
55
  end
56
56
  end
@@ -11,34 +11,34 @@ module Dor
11
11
  class Client
12
12
  # API calls that are about a repository object
13
13
  class Object < VersionedService
14
- attr_reader :object_id
14
+ attr_reader :object_identifier
15
15
 
16
- # @param object_id [String] the pid for the object
17
- def initialize(connection:, version:, object_id:)
18
- raise ArgumentError, "The `object_id` parameter must be an identifier string: #{object_id.inspect}" unless object_id.is_a?(String)
16
+ # @param object_identifier [String] the pid for the object
17
+ def initialize(connection:, version:, object_identifier:)
18
+ raise ArgumentError, "The `object_identifier` parameter must be an identifier string: #{object_identifier.inspect}" unless object_identifier.is_a?(String)
19
19
 
20
20
  super(connection: connection, version: version)
21
- @object_id = object_id
21
+ @object_identifier = object_identifier
22
22
  end
23
23
 
24
24
  def sdr
25
- @sdr ||= SDR.new(connection: connection, version: api_version, object_id: object_id)
25
+ @sdr ||= SDR.new(connection: connection, version: api_version, object_identifier: object_identifier)
26
26
  end
27
27
 
28
28
  def files
29
- @files ||= Files.new(connection: connection, version: api_version, object_id: object_id)
29
+ @files ||= Files.new(connection: connection, version: api_version, object_identifier: object_identifier)
30
30
  end
31
31
 
32
32
  def workflow
33
- @workflow ||= Workflow.new(connection: connection, version: api_version, object_id: object_id)
33
+ @workflow ||= Workflow.new(connection: connection, version: api_version, object_identifier: object_identifier)
34
34
  end
35
35
 
36
36
  def workspace
37
- @workspace ||= Workspace.new(connection: connection, version: api_version, object_id: object_id)
37
+ @workspace ||= Workspace.new(connection: connection, version: api_version, object_identifier: object_identifier)
38
38
  end
39
39
 
40
40
  def release_tags
41
- @release_tags ||= ReleaseTags.new(connection: connection, version: api_version, object_id: object_id)
41
+ @release_tags ||= ReleaseTags.new(connection: connection, version: api_version, object_identifier: object_identifier)
42
42
  end
43
43
 
44
44
  # Publish a new object
@@ -88,7 +88,7 @@ module Dor
88
88
  # @return [String] the current version
89
89
  def open_new_version(**params)
90
90
  version = open_new_version_response(**params)
91
- raise MalformedResponse, "Version of #{object_id} is empty" if version.empty?
91
+ raise MalformedResponse, "Version of #{object_identifier} is empty" if version.empty?
92
92
 
93
93
  version
94
94
  end
@@ -112,7 +112,7 @@ module Dor
112
112
  private
113
113
 
114
114
  def object_path
115
- "#{api_version}/objects/#{object_id}"
115
+ "#{api_version}/objects/#{object_identifier}"
116
116
  end
117
117
 
118
118
  def raise_exception_based_on_response!(response)
@@ -5,10 +5,10 @@ module Dor
5
5
  class Client
6
6
  # API calls that are about a repository object
7
7
  class ReleaseTags < VersionedService
8
- # @param object_id [String] the pid for the object
9
- def initialize(connection:, version:, object_id:)
8
+ # @param object_identifier [String] the pid for the object
9
+ def initialize(connection:, version:, object_identifier:)
10
10
  super(connection: connection, version: version)
11
- @object_id = object_id
11
+ @object_identifier = object_identifier
12
12
  end
13
13
 
14
14
  # Creates a new release tag for the object
@@ -27,7 +27,7 @@ module Dor
27
27
  release: release
28
28
  }
29
29
  resp = connection.post do |req|
30
- req.url "#{api_version}/objects/#{object_id}/release_tags"
30
+ req.url "#{api_version}/objects/#{object_identifier}/release_tags"
31
31
  req.headers['Content-Type'] = 'application/json'
32
32
  req.body = params.to_json
33
33
  end
@@ -39,7 +39,7 @@ module Dor
39
39
 
40
40
  private
41
41
 
42
- attr_reader :object_id
42
+ attr_reader :object_identifier
43
43
  end
44
44
  end
45
45
  end
@@ -7,10 +7,10 @@ module Dor
7
7
  class Client
8
8
  # API calls that are about preserved objects
9
9
  class SDR < VersionedService
10
- # @param object_id [String] the pid for the object
11
- def initialize(connection:, version:, object_id:)
10
+ # @param object_identifier [String] the pid for the object
11
+ def initialize(connection:, version:, object_identifier:)
12
12
  super(connection: connection, version: version)
13
- @object_id = object_id
13
+ @object_identifier = object_identifier
14
14
  end
15
15
 
16
16
  # Gets the current version number for the object
@@ -31,7 +31,7 @@ module Dor
31
31
 
32
32
  private
33
33
 
34
- attr_reader :object_id
34
+ attr_reader :object_identifier
35
35
 
36
36
  # make the request to the server for the currentVersion xml
37
37
  # @raises [UnexpectedResponse] on an unsuccessful response from the server
@@ -42,11 +42,11 @@ module Dor
42
42
  end
43
43
  return resp.body if resp.success?
44
44
 
45
- raise UnexpectedResponse, "#{resp.reason_phrase}: #{resp.status} (#{resp.body}) for #{object_id}"
45
+ raise UnexpectedResponse, "#{resp.reason_phrase}: #{resp.status} (#{resp.body}) for #{object_identifier}"
46
46
  end
47
47
 
48
48
  def current_version_path
49
- "#{api_version}/sdr/objects/#{object_id}/current_version"
49
+ "#{api_version}/sdr/objects/#{object_identifier}/current_version"
50
50
  end
51
51
  end
52
52
  end
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '1.1.0'
6
+ VERSION = '1.1.1'
7
7
  end
8
8
  end
9
9
  end
@@ -5,10 +5,10 @@ module Dor
5
5
  class Client
6
6
  # API calls that are about workflow
7
7
  class Workflow < VersionedService
8
- # @param object_id [String] the pid for the object
9
- def initialize(connection:, version:, object_id:)
8
+ # @param object_identifier [String] the pid for the object
9
+ def initialize(connection:, version:, object_identifier:)
10
10
  super(connection: connection, version: version)
11
- @object_id = object_id
11
+ @object_identifier = object_identifier
12
12
  end
13
13
 
14
14
  # Begin a new workflow
@@ -17,14 +17,14 @@ module Dor
17
17
  # @return nil
18
18
  def create(wf_name:)
19
19
  resp = connection.post do |req|
20
- req.url "#{api_version}/objects/#{object_id}/apo_workflows/#{wf_name}"
20
+ req.url "#{api_version}/objects/#{object_identifier}/apo_workflows/#{wf_name}"
21
21
  end
22
22
  raise UnexpectedResponse, "#{resp.reason_phrase}: #{resp.status} (#{resp.body})" unless resp.success?
23
23
  end
24
24
 
25
25
  private
26
26
 
27
- attr_reader :object_id
27
+ attr_reader :object_identifier
28
28
  end
29
29
  end
30
30
  end
@@ -5,10 +5,10 @@ module Dor
5
5
  class Client
6
6
  # API calls that are about the DOR workspace
7
7
  class Workspace < VersionedService
8
- # @param object_id [String] the pid for the object
9
- def initialize(connection:, version:, object_id:)
8
+ # @param object_identifier [String] the pid for the object
9
+ def initialize(connection:, version:, object_identifier:)
10
10
  super(connection: connection, version: version)
11
- @object_id = object_id
11
+ @object_identifier = object_identifier
12
12
  end
13
13
 
14
14
  # Initializes a new workspace
@@ -17,7 +17,7 @@ module Dor
17
17
  # @return nil
18
18
  def create(source:)
19
19
  resp = connection.post do |req|
20
- req.url "#{api_version}/objects/#{object_id}/initialize_workspace"
20
+ req.url "#{api_version}/objects/#{object_identifier}/initialize_workspace"
21
21
  req.params['source'] = source
22
22
  end
23
23
  raise UnexpectedResponse, "#{resp.reason_phrase}: #{resp.status} (#{resp.body})" unless resp.success?
@@ -25,7 +25,7 @@ module Dor
25
25
 
26
26
  private
27
27
 
28
- attr_reader :object_id
28
+ attr_reader :object_identifier
29
29
  end
30
30
  end
31
31
  end
@@ -37,9 +37,9 @@ module Dor
37
37
  # Return memoized object instance if object identifier value is the same
38
38
  # This allows us to test the client more easily in downstream codebases,
39
39
  # opening up stubbing without requiring `any_instance_of`
40
- return @object if @object&.object_id == object_identifier
40
+ return @object if @object&.object_identifier == object_identifier
41
41
 
42
- @object = Object.new(connection: connection, version: DEFAULT_VERSION, object_id: object_identifier)
42
+ @object = Object.new(connection: connection, version: DEFAULT_VERSION, object_identifier: object_identifier)
43
43
  end
44
44
 
45
45
  # @return [Dor::Services::Client::Objects] an instance of the `Client::Objects` class
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dor-services-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-01-15 00:00:00.000000000 Z
12
+ date: 2019-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport