Class: Teamlab::Files

Inherits:
Object
  • Object
show all
Defined in:
lib/teamlab/modules/files.rb

Instance Method Summary collapse

Constructor Details

#initializeFiles

Returns a new instance of Files.



3
4
5
# File 'lib/teamlab/modules/files.rb', line 3

def initialize
  @request = Teamlab::Request.new('files')
end

Instance Method Details

#check_conflict(options = {}) ⇒ Object



45
46
47
# File 'lib/teamlab/modules/files.rb', line 45

def check_conflict(options = {})
  @request.get(%w(fileops move), options)
end

#check_conversion_status(fileid) ⇒ Object



49
50
51
# File 'lib/teamlab/modules/files.rb', line 49

def check_conversion_status(fileid)
  @request.get(['file', fileid.to_s, 'checkconversion'])
end

#chunked_upload(folder_id, filename, file_size) ⇒ Object



227
228
229
# File 'lib/teamlab/modules/files.rb', line 227

def chunked_upload(folder_id, filename, file_size)
  @request.post([folder_id.to_s, 'upload', 'create_session'], fileName: filename, fileSize: file_size)
end

#clear_recycle_binObject



74
75
76
# File 'lib/teamlab/modules/files.rb', line 74

def clear_recycle_bin
  @request.put(%w(fileops emptytrash))
end

#copy_to_folder(dest_folder_id, options = {}) ⇒ Object



58
59
60
# File 'lib/teamlab/modules/files.rb', line 58

def copy_to_folder(dest_folder_id, options = {})
  @request.put(%w(fileops copy), { destFolderId: dest_folder_id }.merge(options))
end

#create_file(folder_id, title) ⇒ Object



33
34
35
# File 'lib/teamlab/modules/files.rb', line 33

def create_file(folder_id, title)
  @request.post([folder_id.to_s, 'file'], title: title.to_s)
end

#create_html(folder_id, title, content) ⇒ Object



29
30
31
# File 'lib/teamlab/modules/files.rb', line 29

def create_html(folder_id, title, content)
  @request.post([folder_id.to_s, 'html'], title: title.to_s, content: content.to_s)
end

#create_html_in_common_docs(title, content) ⇒ Object



21
22
23
# File 'lib/teamlab/modules/files.rb', line 21

def create_html_in_common_docs(title, content)
  @request.post(%w(common html), title: title.to_s, content: content.to_s)
end

#create_html_in_my_docs(title, content) ⇒ Object



13
14
15
# File 'lib/teamlab/modules/files.rb', line 13

def create_html_in_my_docs(title, content)
  @request.post(%w(@my html), title: title.to_s, content: content.to_s)
end

#create_txt(folder_id, title, content) ⇒ Object



25
26
27
# File 'lib/teamlab/modules/files.rb', line 25

def create_txt(folder_id, title, content)
  @request.post([folder_id.to_s, 'text'], title: title.to_s, content: content.to_s)
end

#create_txt_in_common_docs(title, content) ⇒ Object



17
18
19
# File 'lib/teamlab/modules/files.rb', line 17

def create_txt_in_common_docs(title, content)
  @request.post(%w(@common text), title: title.to_s, content: content.to_s)
end

#create_txt_in_my_docs(title, content) ⇒ Object

region File Creation



9
10
11
# File 'lib/teamlab/modules/files.rb', line 9

def create_txt_in_my_docs(title, content)
  @request.post(%w(@my text), title: title.to_s, content: content.to_s)
end

#delete(options = {}) ⇒ Object



62
63
64
# File 'lib/teamlab/modules/files.rb', line 62

def delete(options = {})
  @request.put(%w(fileops delete), options)
end

#delete_file(file_id) ⇒ Object



106
107
108
# File 'lib/teamlab/modules/files.rb', line 106

def delete_file(file_id)
  @request.delete(['file', file_id.to_s])
end

#delete_folder(folder_id) ⇒ Object



155
156
157
# File 'lib/teamlab/modules/files.rb', line 155

def delete_folder(folder_id)
  @request.delete(['folder', folder_id.to_s])
end

#document_server_infoObject



241
242
243
# File 'lib/teamlab/modules/files.rb', line 241

def document_server_info
  @request.get(%w(docservice))
end

#finish_allObject



66
67
68
# File 'lib/teamlab/modules/files.rb', line 66

def finish_all
  @request.put(%w(fileops terminate))
end

#finish_operations(options = {}) ⇒ Object



78
79
80
# File 'lib/teamlab/modules/files.rb', line 78

def finish_operations(options = {})
  @request.put(%w(fileops bulkdownload), options)
end


237
238
239
# File 'lib/teamlab/modules/files.rb', line 237

def generate_shared_link(file_id, share)
  @request.put([file_id.to_s, 'sharedlink'], share: share)
end

#get_common_docsObject



127
128
129
# File 'lib/teamlab/modules/files.rb', line 127

def get_common_docs
  @request.get(['@common'])
end

#get_file_history(file_id) ⇒ Object



94
95
96
# File 'lib/teamlab/modules/files.rb', line 94

def get_file_history(file_id)
  @request.get(['file', file_id.to_s, 'history'])
end

#get_file_info(file_id) ⇒ Object

region Files



90
91
92
# File 'lib/teamlab/modules/files.rb', line 90

def get_file_info(file_id)
  @request.get(['file', file_id.to_s])
end

#get_file_operations_listObject

region File operations



41
42
43
# File 'lib/teamlab/modules/files.rb', line 41

def get_file_operations_list
  @request.get(%w(fileops))
end

#get_file_sharing(file_id) ⇒ Object

region Sharing



163
164
165
# File 'lib/teamlab/modules/files.rb', line 163

def get_file_sharing(file_id)
  @request.get(['file', file_id.to_s, 'share'])
end

#get_folder(folder_id, options = {}) ⇒ Object



135
136
137
# File 'lib/teamlab/modules/files.rb', line 135

def get_folder(folder_id, options = {})
  @request.get([folder_id.to_s], options)
end

#get_folder_info(folder_id) ⇒ Object



139
140
141
# File 'lib/teamlab/modules/files.rb', line 139

def get_folder_info(folder_id)
  @request.get(['folder', folder_id.to_s])
end

#get_folder_path(folder_id) ⇒ Object



143
144
145
# File 'lib/teamlab/modules/files.rb', line 143

def get_folder_path(folder_id)
  @request.get(['folder', folder_id.to_s, 'path'])
end

#get_folder_sharing(folder_id) ⇒ Object



167
168
169
# File 'lib/teamlab/modules/files.rb', line 167

def get_folder_sharing(folder_id)
  @request.get(['folder', folder_id.to_s, 'share'])
end

#get_my_docsObject Also known as: get_my_files

region Folders



114
115
116
# File 'lib/teamlab/modules/files.rb', line 114

def get_my_docs
  @request.get(['@my'])
end

#get_projects_folderObject



131
132
133
# File 'lib/teamlab/modules/files.rb', line 131

def get_projects_folder
  @request.get(['@projects'])
end

#get_shared_docsObject



119
120
121
# File 'lib/teamlab/modules/files.rb', line 119

def get_shared_docs
  @request.get(['@share'])
end

#get_third_partyObject

region Third-Party Integration



187
188
189
# File 'lib/teamlab/modules/files.rb', line 187

def get_third_party
  @request.get(%w(thirdparty))
end

#get_trashObject



123
124
125
# File 'lib/teamlab/modules/files.rb', line 123

def get_trash
  @request.get(['@trash'])
end

#insert_file(folder_id, file, title: File.basename(file), keep_convert_status: false) ⇒ Object



223
224
225
# File 'lib/teamlab/modules/files.rb', line 223

def insert_file(folder_id, file, title: File.basename(file), keep_convert_status: false)
  @request.post([folder_id.to_s, 'insert'], file: File.new(file), title: title, keepConvertStatus: keep_convert_status)
end

#insert_to_common_docs(file, title: File.basename(file), keep_convert_status: false) ⇒ Object



215
216
217
# File 'lib/teamlab/modules/files.rb', line 215

def insert_to_common_docs(file, title: File.basename(file), keep_convert_status: false)
  @request.post(%w(@common insert), file: File.new(file), title: title, keepConvertStatus: keep_convert_status)
end

#insert_to_my_docs(file, title: File.basename(file), keep_convert_status: false) ⇒ Object



207
208
209
# File 'lib/teamlab/modules/files.rb', line 207

def insert_to_my_docs(file, title: File.basename(file), keep_convert_status: false)
  @request.post(%w(@my insert), file: File.new(file), title: title, keepConvertStatus: keep_convert_status)
end

#mark_as_readObject



70
71
72
# File 'lib/teamlab/modules/files.rb', line 70

def mark_as_read
  @request.put(%w(fileops markasread))
end

#move_to_folder(dest_folder_id, options = {}) ⇒ Object Also known as: move_files



53
54
55
# File 'lib/teamlab/modules/files.rb', line 53

def move_to_folder(dest_folder_id, options = {})
  @request.put(%w(fileops move), { destFolderId: dest_folder_id }.merge(options))
end

#new_folder(folder_id, title) ⇒ Object



147
148
149
# File 'lib/teamlab/modules/files.rb', line 147

def new_folder(folder_id, title)
  @request.post(['folder', folder_id.to_s], title: title)
end

#remove_third_party_account(provider_id) ⇒ Object



195
196
197
# File 'lib/teamlab/modules/files.rb', line 195

def (provider_id)
  @request.delete(['thirdparty', provider_id.to_s])
end

#removes_sharing_rights(options = {}) ⇒ Object



179
180
181
# File 'lib/teamlab/modules/files.rb', line 179

def removes_sharing_rights(options = {})
  @request.delete(['share'], options)
end

#rename_folder(folder_id, title) ⇒ Object



151
152
153
# File 'lib/teamlab/modules/files.rb', line 151

def rename_folder(folder_id, title)
  @request.put(['folder', folder_id.to_s], title: title)
end

#save_third_party(options = {}) ⇒ Object



191
192
193
# File 'lib/teamlab/modules/files.rb', line 191

def save_third_party(options = {})
  @request.post(%w(thirdparty), options)
end

#search(query) ⇒ Object

endregion



233
234
235
# File 'lib/teamlab/modules/files.rb', line 233

def search(query)
  @request.get(['@search', query.to_s])
end

#share_file(file_id, user_id, access_type, options = {}) ⇒ Object



171
172
173
# File 'lib/teamlab/modules/files.rb', line 171

def share_file(file_id, user_id, access_type, options = {})
  @request.put(['file', file_id.to_s, 'share'], { share: { shareTo: user_id, Access: access_type } }.merge(options))
end

#share_folder(folder_id, user_id, access_type, options = {}) ⇒ Object



175
176
177
# File 'lib/teamlab/modules/files.rb', line 175

def share_folder(folder_id, user_id, access_type, options = {})
  @request.put(['folder', folder_id.to_s, 'share'], { share: { shareTo: user_id, Access: access_type } }.merge(options))
end

#start_conversion(file_id, start) ⇒ Object



82
83
84
# File 'lib/teamlab/modules/files.rb', line 82

def start_conversion(file_id, start)
  @request.put(['file', file_id.to_s, 'checkconversion'], start: start)
end

#update_file_history(file_id, version, continue_version = false) ⇒ Object



98
99
100
# File 'lib/teamlab/modules/files.rb', line 98

def update_file_history(file_id, version, continue_version = false)
  @request.put(['file', file_id.to_s, 'history'], version: version, continueVersion: continue_version)
end

#update_file_info(file_id, title, last_version) ⇒ Object



102
103
104
# File 'lib/teamlab/modules/files.rb', line 102

def update_file_info(file_id, title, last_version)
  @request.put(['file', file_id.to_s], title: title, lastVersion: last_version)
end

#upload_to_common_docs(file) ⇒ Object



211
212
213
# File 'lib/teamlab/modules/files.rb', line 211

def upload_to_common_docs(file)
  @request.post(%w(@common upload), somefile: File.new(file))
end

#upload_to_folder(folder_id, file) ⇒ Object



219
220
221
# File 'lib/teamlab/modules/files.rb', line 219

def upload_to_folder(folder_id, file)
  @request.post([folder_id.to_s, 'upload'], somefile: File.new(file))
end

#upload_to_my_docs(file) ⇒ Object

region Uploads



203
204
205
# File 'lib/teamlab/modules/files.rb', line 203

def upload_to_my_docs(file)
  @request.post(%w(@my upload), somefile: File.new(file))
end