Class: Dor::Services::Client::Object

Inherits:
VersionedService show all
Defined in:
lib/dor/services/client/object.rb

Overview

API calls that are about a repository object

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection:, version:, object_identifier:) ⇒ Object

Returns a new instance of Object.

Parameters:

  • object_identifier (String)

    the pid for the object

Raises:

  • (ArgumentError)


11
12
13
14
15
16
# File 'lib/dor/services/client/object.rb', line 11

def initialize(connection:, version:, object_identifier:)
  raise ArgumentError, "The `object_identifier` parameter must be an identifier string: #{object_identifier.inspect}" unless object_identifier.is_a?(String)

  super(connection: connection, version: version)
  @object_identifier = object_identifier
end

Instance Attribute Details

#object_identifierObject (readonly)

Returns the value of attribute object_identifier.



8
9
10
# File 'lib/dor/services/client/object.rb', line 8

def object_identifier
  @object_identifier
end

Instance Method Details

#filesObject



26
27
28
# File 'lib/dor/services/client/object.rb', line 26

def files
  @files ||= Files.new(connection: connection, version: api_version, object_identifier: object_identifier)
end

#metadataObject



22
23
24
# File 'lib/dor/services/client/object.rb', line 22

def 
   ||= .new(connection: connection, version: api_version, object_identifier: object_identifier)
end

#notify_goobiboolean

Notify the external Goobi system for a new object that was registered in DOR

Returns:

  • (boolean)

    true on success

Raises:



85
86
87
88
89
90
91
92
# File 'lib/dor/services/client/object.rb', line 85

def notify_goobi
  resp = connection.post do |req|
    req.url "#{object_path}/notify_goobi"
  end
  return true if resp.success?

  raise_exception_based_on_response!(resp)
end

#publishboolean

Publish a new object

Returns:

  • (boolean)

    true on success

Raises:



46
47
48
49
50
51
52
53
# File 'lib/dor/services/client/object.rb', line 46

def publish
  resp = connection.post do |req|
    req.url "#{object_path}/publish"
  end
  return true if resp.success?

  raise_exception_based_on_response!(resp)
end

#refresh_metadataboolean

Pull in metadata from Symphony and update descMetadata

Returns:

  • (boolean)

    true on success

Raises:



72
73
74
75
76
77
78
79
# File 'lib/dor/services/client/object.rb', line 72

def 
  resp = connection.post do |req|
    req.url "#{object_path}/refresh_metadata"
  end
  return true if resp.success?

  raise_exception_based_on_response!(resp)
end

#release_tagsObject



34
35
36
# File 'lib/dor/services/client/object.rb', line 34

def release_tags
  @release_tags ||= ReleaseTags.new(connection: connection, version: api_version, object_identifier: object_identifier)
end

#sdrObject



18
19
20
# File 'lib/dor/services/client/object.rb', line 18

def sdr
  @sdr ||= SDR.new(connection: connection, version: api_version, object_identifier: object_identifier)
end

#update_marc_recordboolean

Update the marc record for the give object

Returns:

  • (boolean)

    true on success

Raises:



59
60
61
62
63
64
65
66
# File 'lib/dor/services/client/object.rb', line 59

def update_marc_record
  resp = connection.post do |req|
    req.url "#{object_path}/update_marc_record"
  end
  return true if resp.success?

  raise_exception_based_on_response!(resp)
end

#versionObject



38
39
40
# File 'lib/dor/services/client/object.rb', line 38

def version
  @version ||= ObjectVersion.new(connection: connection, version: api_version, object_identifier: object_identifier)
end

#workspaceObject



30
31
32
# File 'lib/dor/services/client/object.rb', line 30

def workspace
  @workspace ||= Workspace.new(connection: connection, version: api_version, object_identifier: object_identifier)
end