Class: Toptranslation::Resource::ProjectDocumentList

Inherits:
DocumentList
  • Object
show all
Defined in:
lib/toptranslation/resource/project_document_list.rb

Instance Method Summary collapse

Methods inherited from DocumentList

#each, #find, #initialize

Constructor Details

This class inherits a constructor from Toptranslation::Resource::DocumentList

Instance Method Details

#create(name, path, options = {}) ⇒ Object



3
4
5
6
# File 'lib/toptranslation/resource/project_document_list.rb', line 3

def create(name, path, options = {})
  response = @connection.post("/projects/#{@options[:project_identifier]}/documents", options.merge(name: name, path: path))
  Document.new(@connection, response)
end

#create_batch(documents) ⇒ Object



8
9
10
11
12
# File 'lib/toptranslation/resource/project_document_list.rb', line 8

def create_batch(documents)
  response = @connection.post("/projects/#{@options[:project_identifier]}/documents/batch", documents: documents)

  response.map { |document_attr| Document.new(@connection, document_attr) }
end