Module: DocumentCloud::API::Upload

Includes:
Utils
Included in:
Client
Defined in:
lib/document_cloud/api/upload.rb

Constant Summary collapse

UPLOAD_PATH =
'/upload.json'

Instance Method Summary collapse

Methods included from Utils

#build_object, #parse_json

Instance Method Details

#upload(file, title, options = {}) ⇒ Object

Upload a document

Parameters:

  • file (String|File)

    Local file to upload, or remote url of file

  • title (String)

    The document’s canonical title

  • options (Hash) (defaults to: {})

    Customizable set of options

  • options (String) (defaults to: {})

    :source The source who produced the document

  • options (String) (defaults to: {})

    :description A paragraph of detailed description

  • options (String) (defaults to: {})

    :related_article The URL of the article associated with the document

  • options (String) (defaults to: {})

    :published_url The URL of the page on which the document will be embedded

  • options (String) (defaults to: {})

    :access One of ‘public’, ‘private’, ‘organization’, defaults to ‘private’

  • options (Integer) (defaults to: {})

    :project A numeric Project id, to upload the document into an existing project.

  • options (Hash) (defaults to: {})

    :data A hash of arbitrary key/value data pairs

  • options (Boolean) (defaults to: {})

    :secure If you’re dealing with a truly sensitive document, pass the “secure” parameter in order to prevent the document from being sent to OpenCalais for entity extraction.

See Also:



22
23
24
# File 'lib/document_cloud/api/upload.rb', line 22

def upload(file, title, options={})
  build_object DocumentCloud::Document, post(UPLOAD_PATH, options.merge(file: file, title: title))
end