Class: Dor::Services::Client::ReleaseTags

Inherits:
VersionedService show all
Defined in:
lib/dor/services/client/release_tags.rb

Overview

API calls that are about a repository object

Instance Method Summary collapse

Constructor Details

#initialize(connection:, version:, object_identifier:) ⇒ ReleaseTags

Returns a new instance of ReleaseTags.

Parameters:

  • object_identifier (String)

    the pid for the object



9
10
11
12
# File 'lib/dor/services/client/release_tags.rb', line 9

def initialize(connection:, version:, object_identifier:)
  super(connection: connection, version: version)
  @object_identifier = object_identifier
end

Instance Method Details

#create(release:, what:, to:, who:) ⇒ Boolean

Creates a new release tag for the object rubocop:disable Metrics/MethodLength

Parameters:

  • release (Boolean)
  • what (String)
  • to (String)
  • who (String)

Returns:

  • (Boolean)

    true if successful

Raises:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/dor/services/client/release_tags.rb', line 22

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