Module: Caplinked::REST::Files
- Included in:
- API
- Defined in:
- lib/caplinked/rest/files.rb
Instance Method Summary collapse
- #copy_file(options = {}) ⇒ Object
- #delete_file(options = {}) ⇒ Object
- #get_file_info(options = {}) ⇒ Object
- #get_file_viewer(options = {}) ⇒ Object
- #move_file(options = {}) ⇒ Object
- #update_file_info(options = {}) ⇒ Object
- #upload_file(options = {}) ⇒ Object
Instance Method Details
#copy_file(options = {}) ⇒ Object
35 36 37 38 39 |
# File 'lib/caplinked/rest/files.rb', line 35 def copy_file( = {}) body = .stringify_keys.slice('id', 'workspace_id', 'destination_folder_id') file_id = body.delete('id') perform_post('/api/v1/files/' + file_id.to_s + '/copy', {}, body.to_json, { 'Content-Type' => 'application/json' }) end |
#delete_file(options = {}) ⇒ Object
22 23 24 25 26 |
# File 'lib/caplinked/rest/files.rb', line 22 def delete_file( = {}) body = .stringify_keys.slice('id', 'workspace_id') file_id = body.delete('id') perform_delete('/api/v1/files/' + file_id.to_s, {}, body.to_json, { 'Content-Type' => 'application/json' }) end |
#get_file_info(options = {}) ⇒ Object
10 11 12 13 14 |
# File 'lib/caplinked/rest/files.rb', line 10 def get_file_info( = {}) params = .stringify_keys.slice('id', 'workspace_id', 'page_number') file_id = params.delete('id') perform_get('/api/v1/files/' + file_id.to_s, params) end |
#get_file_viewer(options = {}) ⇒ Object
16 17 18 19 20 |
# File 'lib/caplinked/rest/files.rb', line 16 def get_file_viewer( = {}) params = .stringify_keys.slice('id', 'workspace_id', 'expiring_token') file_id = params.delete('id') perform_get('/api/v1/files/' + file_id.to_s + '/viewer', params) end |
#move_file(options = {}) ⇒ Object
41 42 43 44 45 |
# File 'lib/caplinked/rest/files.rb', line 41 def move_file( = {}) body = .stringify_keys.slice('id', 'workspace_id', 'destination_folder_id') file_id = body.delete('id') perform_post('/api/v1/files/' + file_id.to_s + '/move', {}, body.to_json, { 'Content-Type' => 'application/json' }) end |
#update_file_info(options = {}) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/caplinked/rest/files.rb', line 28 def update_file_info( = {}) params = .stringify_keys.slice('id') file_id = params.delete('id') body = .stringify_keys.slice('workspace_id', 'file') perform_put('/api/v1/files/' + file_id.to_s, {}, body.to_json, { 'Content-Type' => 'application/json' }) end |
#upload_file(options = {}) ⇒ Object
4 5 6 7 8 |
# File 'lib/caplinked/rest/files.rb', line 4 def upload_file( = {}) params = .stringify_keys.slice('workspace_id', 'folder_id', 'file_name') file = .stringify_keys['file'].b perform_put_with_binary_data('/api/v1/files/upload', params, file) end |