Sha256: 18557d2667f06df1955a2d3cc0a31e0cad5f7eee851c13619da11a3ca3feb07d

Contents?: true

Size: 1.16 KB

Versions: 6

Compression:

Stored size: 1.16 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]
        # @raises [UnexpectedResponse] if the request is unsuccessful.
        # @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 "#{api_version}/objects/#{object}/release_tags"
            req.headers['Content-Type'] = 'application/json'
            req.body = params.to_json
          end
          raise UnexpectedResponse, "#{resp.reason_phrase}: #{resp.status} (#{resp.body})" unless resp.success?

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dor-services-client-0.10.0 lib/dor/services/client/release_tags.rb
dor-services-client-0.9.0 lib/dor/services/client/release_tags.rb
dor-services-client-0.8.0 lib/dor/services/client/release_tags.rb
dor-services-client-0.7.0 lib/dor/services/client/release_tags.rb
dor-services-client-0.6.0 lib/dor/services/client/release_tags.rb
dor-services-client-0.5.0 lib/dor/services/client/release_tags.rb