Sha256: a233decef182ed1c9b61027512f414ba6a82a218bac2e97b5137498859ee0fe9
Contents?: true
Size: 938 Bytes
Versions: 35
Compression:
Stored size: 938 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}" 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
35 entries across 35 versions & 1 rubygems