Sha256: b1c7240307aa682ee0480a781eac7686601e467666366fbbb9c0d6e94272a01b
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true require 'deprecation' module Dor module Services class Client # API calls that are about a repository objects class Objects < VersionedService # Creates a new object in DOR # @param params [Cocina::Models::RequestDRO,Cocina::Models::RequestCollection,Cocina::Models::RequestAPO] # @param assign_doi [Boolean] # @return [Cocina::Models::RequestDRO,Cocina::Models::RequestCollection,Cocina::Models::RequestAPO] the returned model def register(params:, assign_doi: false) resp = connection.post do |req| req.url "#{api_version}/objects" req.headers['Content-Type'] = 'application/json' # asking the service to return JSON (else it'll be plain text) req.headers['Accept'] = 'application/json' req.params[:assign_doi] = true if assign_doi req.body = params.to_json end raise_exception_based_on_response!(resp) unless resp.success? build_cocina_from_response(resp) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dor-services-client-9.1.1 | lib/dor/services/client/objects.rb |
dor-services-client-9.1.0 | lib/dor/services/client/objects.rb |
dor-services-client-9.0.0 | lib/dor/services/client/objects.rb |