Class: Hubspot::File
- Inherits:
-
Object
- Object
- Hubspot::File
- Defined in:
- lib/hubspot/file.rb
Overview
HubSpot Files API
https://developers.hubspot.com/docs/methods/files/post_files
Constant Summary collapse
- GET_FILE_PATH =
"/filemanager/api/v2/files/:file_id"
- DELETE_FILE_PATH =
"/filemanager/api/v2/files/:file_id/full-delete"
- LIST_FILE_PATH =
"/filemanager/api/v2/files"
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
Class Method Summary collapse
Instance Method Summary collapse
-
#destroy! ⇒ Object
Permanently delete a file and all related data and thumbnails from file manager.
-
#initialize(response_hash) ⇒ File
constructor
A new instance of File.
Constructor Details
#initialize(response_hash) ⇒ File
Returns a new instance of File.
19 20 21 22 |
# File 'lib/hubspot/file.rb', line 19 def initialize(response_hash) @id = response_hash["id"] @properties = response_hash end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
16 17 18 |
# File 'lib/hubspot/file.rb', line 16 def id @id end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
17 18 19 |
# File 'lib/hubspot/file.rb', line 17 def properties @properties end |
Class Method Details
.find_by_id(file_id) ⇒ Object
25 26 27 28 |
# File 'lib/hubspot/file.rb', line 25 def find_by_id(file_id) response = Hubspot::Connection.get_json(GET_FILE_PATH, { file_id: file_id }) new(response) end |
Instance Method Details
#destroy! ⇒ Object
Permanently delete a file and all related data and thumbnails from file manager. https://developers.hubspot.com/docs/methods/files/hard_delete_file_and_associated_objects
33 34 35 |
# File 'lib/hubspot/file.rb', line 33 def destroy! Hubspot::Connection.post_json(DELETE_FILE_PATH, params: {file_id: id}) end |