Sha256: fb5db38955457a55463223b6a105bd7b23e317a78b009d47f96f3a68dfe611be
Contents?: true
Size: 961 Bytes
Versions: 24
Compression:
Stored size: 961 Bytes
Contents
module CMIS class ObjectFactory def self.create(raw, repository) case base_type_id(raw) when 'cmis:object' then Object.new(raw, repository) when 'cmis:folder' then Folder.new(raw, repository) when 'cmis:document' then Document.new(raw, repository) when 'cmis:relationship' then Relationship.new(raw, repository) when 'cmis:policy' then Policy.new(raw, repository) when 'cmis:item' then Item.new(raw, repository) else raise "Unexpected baseTypeId: #{base_type_id(raw)}, response: #{raw}" end end private def self.base_type_id(raw) if raw['properties'] && raw['properties']['cmis:baseTypeId'] raw['properties']['cmis:baseTypeId']['value'] elsif raw['succinctProperties'] && raw['succinctProperties']['cmis:baseTypeId'] raw['succinctProperties']['cmis:baseTypeId'] else 'cmis:object' # no base type id, construct a poco end end end end
Version data entries
24 entries across 24 versions & 1 rubygems