Sha256: cd44d41f172852a248268add36932b96a84a3deff99ffa0ee16784c58eedda95

Contents?: true

Size: 1.4 KB

Versions: 30

Compression:

Stored size: 1.4 KB

Contents

# frozen_string_literal: true

module Dor
  module Services
    class Client
      # API calls that are about a repository object
      class ReleaseTags < 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

        # Creates a new release tag for the object
        # @param release [Boolean]
        # @param what [String]
        # @param to [String]
        # @param who [String]
        # @raise [UnexpectedResponse] if the request is unsuccessful.
        # @return [Boolean] true if successful
        # rubocop:disable Metrics/MethodLength
        def create(release:, what:, to:, who:)
          params = {
            to: to,
            who: who,
            what: what,
            release: release
          }
          resp = connection.post do |req|
            req.url "#{api_version}/objects/#{object_identifier}/release_tags"
            req.headers['Content-Type'] = 'application/json'
            req.body = params.to_json
          end
          raise UnexpectedResponse, ResponseErrorFormatter.format(response: resp) unless resp.success?

          true
        end
        # rubocop:enable Metrics/MethodLength

        private

        attr_reader :object_identifier
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
dor-services-client-4.10.0 lib/dor/services/client/release_tags.rb
dor-services-client-4.9.0 lib/dor/services/client/release_tags.rb
dor-services-client-4.8.0 lib/dor/services/client/release_tags.rb
dor-services-client-4.7.0 lib/dor/services/client/release_tags.rb
dor-services-client-4.6.0 lib/dor/services/client/release_tags.rb
dor-services-client-4.5.0 lib/dor/services/client/release_tags.rb
dor-services-client-4.4.0 lib/dor/services/client/release_tags.rb
dor-services-client-4.3.0 lib/dor/services/client/release_tags.rb
dor-services-client-4.2.0 lib/dor/services/client/release_tags.rb
dor-services-client-4.1.0 lib/dor/services/client/release_tags.rb
dor-services-client-4.0.0 lib/dor/services/client/release_tags.rb
dor-services-client-3.9.2 lib/dor/services/client/release_tags.rb
dor-services-client-3.9.1 lib/dor/services/client/release_tags.rb
dor-services-client-3.9.0 lib/dor/services/client/release_tags.rb
dor-services-client-3.8.0 lib/dor/services/client/release_tags.rb
dor-services-client-3.7.0 lib/dor/services/client/release_tags.rb
dor-services-client-3.6.0 lib/dor/services/client/release_tags.rb
dor-services-client-3.5.0 lib/dor/services/client/release_tags.rb
dor-services-client-3.4.0 lib/dor/services/client/release_tags.rb
dor-services-client-3.3.0 lib/dor/services/client/release_tags.rb