Class: CMIS::ObjectFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/cmis/object_factory.rb

Class Method Summary collapse

Class Method Details

.create(raw, repository) ⇒ Object


3
4
5
6
7
8
9
10
11
12
13
# File 'lib/cmis/object_factory.rb', line 3

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