Class: Dor::Services::Client::ReleaseTags
- Inherits:
-
VersionedService
- Object
- VersionedService
- Dor::Services::Client::ReleaseTags
- Defined in:
- lib/dor/services/client/release_tags.rb
Overview
API calls that are about a repository object
Instance Method Summary collapse
-
#create(release:, what:, to:, who:) ⇒ Boolean
Creates a new release tag for the object rubocop:disable Metrics/MethodLength.
-
#initialize(connection:, version:, object_identifier:) ⇒ ReleaseTags
constructor
A new instance of ReleaseTags.
-
#list ⇒ Object
List new release tags for the object.
Methods inherited from VersionedService
Constructor Details
#initialize(connection:, version:, object_identifier:) ⇒ ReleaseTags
Returns a new instance of ReleaseTags.
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
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/dor/services/client/release_tags.rb', line 23 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_exception_based_on_response!(resp, object_identifier) unless resp.success? true end |
#list ⇒ Object
List new release tags for the object
45 46 47 48 49 50 51 52 53 |
# File 'lib/dor/services/client/release_tags.rb', line 45 def list resp = connection.get do |req| req.url "#{api_version}/objects/#{object_identifier}/release_tags" end raise_exception_based_on_response!(resp, object_identifier) unless resp.success? JSON.parse(resp.body) end |