Class: Dor::Services::Client::Metadata
- Inherits:
-
VersionedService
- Object
- VersionedService
- Dor::Services::Client::Metadata
- Defined in:
- lib/dor/services/client/metadata.rb
Overview
API calls that are about retrieving metadata
Instance Method Summary collapse
-
#descriptive ⇒ String
The descriptive metadata XML representation of the object.
-
#dublin_core ⇒ String
The Dublin Core XML representation of the object.
-
#initialize(connection:, version:, object_identifier:) ⇒ Metadata
constructor
A new instance of Metadata.
Constructor Details
#initialize(connection:, version:, object_identifier:) ⇒ Metadata
Returns a new instance of Metadata.
9 10 11 12 |
# File 'lib/dor/services/client/metadata.rb', line 9 def initialize(connection:, version:, object_identifier:) super(connection: connection, version: version) @object_identifier = object_identifier end |
Instance Method Details
#descriptive ⇒ String
Returns The descriptive metadata XML representation of the object.
26 27 28 29 30 31 32 33 34 |
# File 'lib/dor/services/client/metadata.rb', line 26 def descriptive resp = connection.get do |req| req.url "#{base_path}/descriptive" end return resp.body if resp.success? return if resp.status == 404 raise UnexpectedResponse, "#{resp.reason_phrase}: #{resp.status} (#{resp.body}) for #{object_identifier}" end |
#dublin_core ⇒ String
Returns The Dublin Core XML representation of the object.
15 16 17 18 19 20 21 22 23 |
# File 'lib/dor/services/client/metadata.rb', line 15 def dublin_core resp = connection.get do |req| req.url "#{base_path}/dublin_core" end return resp.body if resp.success? return if resp.status == 404 raise UnexpectedResponse, "#{resp.reason_phrase}: #{resp.status} (#{resp.body}) for #{object_identifier}" end |