Sha256: 7a663d5806ec469e03be5cbb86dfc87f6fe8cdb9c8cbe8eb6327305e4385fd47
Contents?: true
Size: 1.26 KB
Versions: 1
Compression:
Stored size: 1.26 KB
Contents
# frozen_string_literal: true module Preservation class Client # API calls that are about the catalog class Catalog < VersionedApiService # @param [String] druid the object identifierx # @param [Integer] version the version of the object # @param [Integer] size the size of the object # @param [String] storage_location the location of storage def update(druid:, version:, size:, storage_location:) http_args = { druid: druid, incoming_version: version, incoming_size: size, storage_location: storage_location, checksums_validated: true } request(druid: druid, version: version, http_args: http_args) end private def request(druid:, version:, http_args:) result = if version == 1 connection.post "/#{api_version}/catalog", http_args else connection.patch "/#{api_version}/catalog/#{druid}", http_args end unless result.success? raise UnexpectedResponseError, "response was not successful. Received status #{result.status}" end true rescue Faraday::ClientError => e raise UnexpectedResponseError, e end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
preservation-client-2.1.0 | lib/preservation/client/catalog.rb |