Module: Rentvine::Client::Files
- Included in:
- Rentvine::Client
- Defined in:
- lib/rentvine/client/files.rb
Instance Method Summary collapse
- #delete_file(file_id) ⇒ Object
- #file(file_id) ⇒ Object
- #files(args = {}) ⇒ Object (also: #list_files)
- #upload_file(path_to_file, object_type_id, object_id) ⇒ Object
Instance Method Details
#delete_file(file_id) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/rentvine/client/files.rb', line 29 def delete_file(file_id) result = process_request(:delete, "files/#{file_id}") return result if result.is_a?(RentvineError) true end |
#file(file_id) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/rentvine/client/files.rb', line 12 def file(file_id) result = process_request(:get, "files/#{file_id}") return result if result.is_a?(RentvineError) Rentvine::File.new(result[:file]) end |
#files(args = {}) ⇒ Object Also known as: list_files
4 5 6 7 8 9 |
# File 'lib/rentvine/client/files.rb', line 4 def files(args = {}) results = process_request(:get, 'files', params: args) return results if results.is_a?(RentvineError) results.map { |result| Rentvine::File.new(result[:file]) } end |
#upload_file(path_to_file, object_type_id, object_id) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/rentvine/client/files.rb', line 19 def upload_file(path_to_file, object_type_id, object_id) result = process_file( path_to_file, { object_type_id: object_type_id, object_id: object_id } ) return result if result.is_a?(RentvineError) Rentvine::File.new(result[:file]) end |