Class: Teamlab::Files
- Inherits:
-
Object
- Object
- Teamlab::Files
- Defined in:
- lib/teamlab/modules/files.rb
Instance Method Summary collapse
- #check_conflict(options = {}) ⇒ Object
- #check_conversion_status(fileid) ⇒ Object
- #chunked_upload(folder_id, filename, file_size) ⇒ Object
- #clear_recycle_bin ⇒ Object
- #copy_to_folder(dest_folder_id, options = {}) ⇒ Object
- #create_file(folder_id, title) ⇒ Object
- #create_html(folder_id, title, content) ⇒ Object
- #create_html_in_common_docs(title, content) ⇒ Object
- #create_html_in_my_docs(title, content) ⇒ Object
- #create_txt(folder_id, title, content) ⇒ Object
- #create_txt_in_common_docs(title, content) ⇒ Object
-
#create_txt_in_my_docs(title, content) ⇒ Object
region File Creation.
- #delete(options = {}) ⇒ Object
- #delete_file(file_id) ⇒ Object
- #delete_folder(folder_id) ⇒ Object
- #document_server_info ⇒ Object
- #finish_all ⇒ Object
- #finish_operations(options = {}) ⇒ Object
- #generate_shared_link(file_id, share) ⇒ Object
- #get_common_docs ⇒ Object
- #get_file_history(file_id) ⇒ Object
-
#get_file_info(file_id) ⇒ Object
region Files.
-
#get_file_operations_list ⇒ Object
region File operations.
-
#get_file_sharing(file_id) ⇒ Object
region Sharing.
- #get_folder(folder_id, options = {}) ⇒ Object
- #get_folder_info(folder_id) ⇒ Object
- #get_folder_path(folder_id) ⇒ Object
- #get_folder_sharing(folder_id) ⇒ Object
-
#get_my_docs ⇒ Object
(also: #get_my_files)
region Folders.
- #get_projects_folder ⇒ Object
- #get_shared_docs ⇒ Object
-
#get_third_party ⇒ Object
region Third-Party Integration.
- #get_trash ⇒ Object
-
#initialize ⇒ Files
constructor
A new instance of Files.
- #insert_file(folder_id, file, title: File.basename(file), keep_convert_status: false) ⇒ Object
- #insert_to_common_docs(file, title: File.basename(file), keep_convert_status: false) ⇒ Object
- #insert_to_my_docs(file, title: File.basename(file), keep_convert_status: false) ⇒ Object
- #mark_as_read ⇒ Object
- #move_to_folder(dest_folder_id, options = {}) ⇒ Object (also: #move_files)
- #new_folder(folder_id, title) ⇒ Object
- #remove_third_party_account(provider_id) ⇒ Object
- #removes_sharing_rights(options = {}) ⇒ Object
- #rename_folder(folder_id, title) ⇒ Object
- #save_third_party(options = {}) ⇒ Object
-
#search(query) ⇒ Object
endregion.
- #share_file(file_id, user_id, access_type, options = {}) ⇒ Object
- #share_folder(folder_id, user_id, access_type, options = {}) ⇒ Object
- #start_conversion(file_id, start) ⇒ Object
- #update_file_history(file_id, version, continue_version = false) ⇒ Object
- #update_file_info(file_id, title, last_version) ⇒ Object
- #upload_to_common_docs(file) ⇒ Object
- #upload_to_folder(folder_id, file) ⇒ Object
-
#upload_to_my_docs(file) ⇒ Object
region Uploads.
Constructor Details
Instance Method Details
#check_conflict(options = {}) ⇒ Object
45 46 47 |
# File 'lib/teamlab/modules/files.rb', line 45 def check_conflict( = {}) @request.get(%w(fileops move), ) 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_bin ⇒ Object
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, = {}) @request.put(%w(fileops copy), { destFolderId: dest_folder_id }.merge()) 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( = {}) @request.put(%w(fileops delete), ) 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_info ⇒ Object
241 242 243 |
# File 'lib/teamlab/modules/files.rb', line 241 def document_server_info @request.get(%w(docservice)) end |
#finish_all ⇒ Object
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( = {}) @request.put(%w(fileops bulkdownload), ) end |
#generate_shared_link(file_id, share) ⇒ Object
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_docs ⇒ Object
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_list ⇒ Object
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, = {}) @request.get([folder_id.to_s], ) 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_docs ⇒ Object 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_folder ⇒ Object
131 132 133 |
# File 'lib/teamlab/modules/files.rb', line 131 def get_projects_folder @request.get(['@projects']) end |
#get_shared_docs ⇒ Object
119 120 121 |
# File 'lib/teamlab/modules/files.rb', line 119 def get_shared_docs @request.get(['@share']) end |
#get_third_party ⇒ Object
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_trash ⇒ Object
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_read ⇒ Object
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, = {}) @request.put(%w(fileops move), { destFolderId: dest_folder_id }.merge()) 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 remove_third_party_account(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( = {}) @request.delete(['share'], ) 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( = {}) @request.post(%w(thirdparty), ) 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, = {}) @request.put(['file', file_id.to_s, 'share'], { share: { shareTo: user_id, Access: access_type } }.merge()) 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, = {}) @request.put(['folder', folder_id.to_s, 'share'], { share: { shareTo: user_id, Access: access_type } }.merge()) 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 |