module Teamlab::CrmFiles

Methods for working with crm files

Public Instance Methods

associate_file_with_entity(entity_type, entity_id, *fileids) click to toggle source
# File lib/teamlab/modules/crm/crm_files.rb, line 16
def associate_file_with_entity(entity_type, entity_id, *fileids)
  @request.post([entity_type,
                 entity_id,
                 'files'],
                fileids: fileids.flatten)
end
create_txt(entity_type, entity_id, title, content) click to toggle source
# File lib/teamlab/modules/crm/crm_files.rb, line 23
def create_txt(entity_type, entity_id, title, content)
  @request.post([entity_type.to_s,
                 entity_id.to_s,
                 'files',
                 'text'],
                title: title,
                content: content)
end
delete_file(id) click to toggle source
# File lib/teamlab/modules/crm/crm_files.rb, line 40
def delete_file(id)
  @request.delete(['files', id.to_s])
end
get_file_list(entity_type, entity_id) click to toggle source
# File lib/teamlab/modules/crm/crm_files.rb, line 10
def get_file_list(entity_type, entity_id)
  @request.get([entity_type.to_s,
                entity_id.to_s,
                'files'])
end
get_root_folder_id() click to toggle source
# File lib/teamlab/modules/crm/crm_files.rb, line 6
def get_root_folder_id
  @request.get(%w[files root])
end
upload_file(entity_type, entity_id, file) click to toggle source
# File lib/teamlab/modules/crm/crm_files.rb, line 32
def upload_file(entity_type, entity_id, file)
  @request.post([entity_type.to_s,
                 entity_id.to_s,
                 'files',
                 'upload'],
                somefile: File.new(file))
end