app/controllers/items_controller.rb
# Will create one or more items from the ArchivesSpace record
# corresponding to params[:archivesspace_uri]
# If any item already exists it will be updated
# Returns array of item records (including both new and updated records)
Will create one or more items from the ArchivesSpace record
corresponding to params[:archivesspace_uri]
If any item already exists it will be updated
Returns array of item records (including both new and updated records)
Will create one or more items from the ArchivesSpace record corresponding to params [ : archivesspace_uri ] If any item already exists it will be updated Returns array of item records ( including both new and updated records )
def create_from_archivesspace
    begin
      if params[:archivesspace_uri] && !params[:archivesspace_uri].blank?
        service_response = CreateOrUpdateItemsFromArchivesspace.call(params[:archivesspace_uri], params)
        @items = service_response.items
        render json: @items ? { items: @items.map { |i| SerializeItem.call(i)[:item] } } : {}
        return
      else
        render json: { error: { detail: 'Bad request: No ArchivesSpace URI provided' } },
            status: 400
        return
      end
    rescue Exception => e
      logger.error e
      puts e.inspect
      error = { detail: "Internal server error: #{e.message} -
          #{e.backtrace.inspect}" }
      render json: { error: error }, status: 500
    end
  end
def create_from_archivesspace begin if params [ :archivesspace_uri ] && ! params [ :archivesspace_uri ] . blank? service_response = CreateOrUpdateItemsFromArchivesspace . call ( params [ :archivesspace_uri ] , params ) @items = service_response . items render json : @items ? { items : @items . map { | i | SerializeItem . call ( i ) [ :item ] } } : { } return else render json : { error : { detail : 'Bad request: No ArchivesSpace URI provided' } } , status : 400 return end rescue Exception => e logger . error e puts e . inspect error = { detail : "Internal server error: #{e.message} -
          #{e.backtrace.inspect}" } render json : { error : error } , status : 500 end end
Will create one or more items from the ArchivesSpace record
corresponding to params[:archivesspace_uri]
If any item already exists it will be updated
Returns array of item records (including both new and updated records)
Will create one or more items from the ArchivesSpace record corresponding to params [ : archivesspace_uri ] If any item already exists it will be updated Returns array of item records ( including both new and updated records )