Sha256: 6264c56b54587a35fe365ca2e832d5d9dcce73bed83a60ade2a8c4a0a8c97c91

Contents?: true

Size: 1.33 KB

Versions: 4

Compression:

Stored size: 1.33 KB

Contents

# encoding: utf-8
require 'virtus'

require 'libis/tools/extend/hash'
require_relative 'collection_info'
require_relative 'client'

module Libis
  module Services
    module Rosetta

      class CollectionHandler < Libis::Services::Rosetta::Client


        def initialize(base_url = 'https://repository.teneo.libis.be', options = {})
          super 'repository', 'CollectionWebServices', {url: base_url}.merge(options)
        end

        def get(id)
          request_object :get_collection_by_id, Rosetta::CollectionInfo, pds_handle: @pds_handle, collection_id: id
        end

        def find(path)
          request_object :get_collection_by_name, Rosetta::CollectionInfo, pds_handle: @pds_handle, collection_path: path
        end

        def create(collection_info)
          collection_info = collection_info.to_hash.cleanup if collection_info.is_a? CollectionInfo
          call :create_collection, pds_handle: @pds_handle, collection: collection_info
        end

        def delete(id)
          call :delete_collection, pds_handle: @pds_handle, collection_id: id
        end

        def update(collection_info)
          collection_info = collection_info.to_hash.cleanup if collection_info.is_a? CollectionInfo
          call :update_collection, pds_handle: @pds_handle, collection: collection_info
        end

      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
libis-services-1.1.0 lib/libis/services/rosetta/collection_handler.rb
libis-services-1.0.13 lib/libis/services/rosetta/collection_handler.rb
libis-services-1.0.12 lib/libis/services/rosetta/collection_handler.rb
libis-services-1.0.11 lib/libis/services/rosetta/collection_handler.rb