Sha256: 03cbb7aeef5d46108127acc230535e9d85141c16c1ec7ac788bf13d6fb5639db
Contents?: true
Size: 1.41 KB
Versions: 11
Compression:
Stored size: 1.41 KB
Contents
# frozen_string_literal: tru module Dor module Services class Client # API calls that are about retrieving metadata class Metadata < VersionedService # @param object_identifier [String] the pid for the object def initialize(connection:, version:, object_identifier:) super(connection: connection, version: version) @object_identifier = object_identifier end # @return [String] The Dublin Core XML representation of the object 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 # @return [String] The descriptive metadata XML representation of the object 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 private attr_reader :object_identifier def base_path "#{api_version}/objects/#{object_identifier}/metadata" end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems