Sha256: 979903cd7d865b95c1af0ae34262149df0758721902b3f4fb485622c117fcaf6

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 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 = 'http://depot.lias.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
          result = call :create_collection, pds_handle: @pds_handle, collection: collection_info
          result[:return]
        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

1 entries across 1 versions & 1 rubygems

Version Path
libis-services-1.0.6 lib/libis/services/rosetta/collection_handler.rb