Sha256: 41d7833bf22a5a5a7b88367c36a71dcd55e6bd71ef1c0028162d57af9ea17a30

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

module PurlFetcher
  class Client
    # Transfer release tags to purl-fetcher
    class ReleaseTags
      # @param [String] druid the identifier of the object
      # @param [Array<String>] index ([]) list of properties to index to
      # @param [Array<String>] delete ([]) list of properties to delete from
      def self.release(druid:, index: [], delete: [])
        new(index:, delete:).release
      end

      # @param [String] druid the identifier of the object
      # @param [Array<String>] index ([]) list of properties to index to
      # @param [Array<String>] delete ([]) list of properties to delete from
      def initialize(druid:, index: [], delete: [])
        @druid = druid
        @index = index
        @delete = delete
      end

      def release
        logger.debug("Starting an release request for: #{druid}")
        response = client.put(path:, body:)
        logger.debug("Release request complete")
      end

      private

      attr_reader :druid, :index, :delete

      def body
        { index:, delete: }.to_json
      end

      def logger
        Client.config.logger
      end

      def client
        Client.instance
      end

      def path
        "/v1/released/#{druid}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
purl_fetcher-client-1.2.0 lib/purl_fetcher/client/release_tags.rb