Sha256: 0a762ea81760da76a6a845d381ee0937ce2d0d556f0148abfe4fe4082fdf1a2b
Contents?: true
Size: 1.37 KB
Versions: 2
Compression:
Stored size: 1.37 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_id [String] the pid for the object def initialize(connection:, version:, object_id:) super(connection: connection, version: version) @object_id = object_id end # Creates a new release tag 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(release:, what:, to:, who:) params = { to: to, who: who, what: what, release: release } resp = connection.post do |req| req.url "#{api_version}/objects/#{object_id}/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 private attr_reader :object_id end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dor-services-client-1.1.0 | lib/dor/services/client/release_tags.rb |
dor-services-client-1.0.0 | lib/dor/services/client/release_tags.rb |