Sha256: 95d04de94def0787fdf31f15daa952ce0b319d892fbc07ab77b4c6e9aa8e9519
Contents?: true
Size: 1.11 KB
Versions: 4
Compression:
Stored size: 1.11 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::RequestAdminPolicy] # @param assign_doi [Boolean] # @return [Cocina::Models::DROWithMetadata,Cocina::Models::CollectionWithMetadata,Cocina::Models::AdminPolicyWithMetadata] 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
4 entries across 4 versions & 1 rubygems