Class: Hubspot::File

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot/file.rb

Constant Summary collapse

UPLOAD_FILE_PATH =
'/filemanager/api/v2/files'

Class Method Summary collapse

Class Method Details

.upload(file, params) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/hubspot/file.rb', line 6

def upload(file, params)
  query = {
    overwrite: params['overwrite'] || false,
    hidden: params['hidden'] || false
  }
  options = {
    multipart:
      [
        { name: 'files', contents: file },
        { name: 'file_names', contents: params['file_names'] },
        { name: 'folder_paths', contents: params['folder_paths'] }
      ]
  }
  Hubspot::FilesConnection.post(UPLOAD_FILE_PATH, params: query, body: options)
end