Sha256: a9fa82b21981f91c1f57f6109a609d977fb6ebf0a313df9cfb2e5fb81d4aaea7
Contents?: true
Size: 1.86 KB
Versions: 2
Compression:
Stored size: 1.86 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 # List new release tags for the object # @raise [UnexpectedResponse] if the request is unsuccessful. # @return [Hash] (see Dor::ReleaseTags::IdentityMetadata.released_for) def list resp = connection.get do |req| req.url "#{api_version}/objects/#{object_identifier}/release_tags" end return JSON.parse(resp.body) if resp.success? raise_exception_based_on_response!(resp) end private attr_reader :object_identifier end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dor-services-client-4.12.0 | lib/dor/services/client/release_tags.rb |
dor-services-client-4.11.0 | lib/dor/services/client/release_tags.rb |