Sha256: 16530676e189c798be37d0fedbc398c03522f348151df5e07cb338d11c54a0db

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

module Dor
  module Services
    class Client
      # API calls that are about a repository object
      class ReleaseTags < VersionedService
        # Creates a new release tag for the object
        # @param object [String] the pid for the object
        # @param release [Boolean]
        # @param what [String]
        # @param to [String]
        # @param who [String]
        # @return [Boolean] true if successful
        # rubocop:disable Metrics/MethodLength
        def create(object:, release:, what:, to:, who:)
          params = {
            to: to,
            who: who,
            what: what,
            release: release
          }
          resp = connection.post do |req|
            req.url "#{version}/objects/#{object}/release_tags"
            req.headers['Content-Type'] = 'application/json'
            req.body = params.to_json
          end
          raise Error, "#{resp.reason_phrase}: #{resp.status} (#{resp.body})" unless resp.success?

          true
        end
        # rubocop:enable Metrics/MethodLength
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dor-services-client-0.4.0 lib/dor/services/client/release_tags.rb