Class: Leash::DriveClient
- Inherits:
-
Object
- Object
- Leash::DriveClient
- Defined in:
- lib/leash/drive.rb
Overview
Client for Google Drive operations via the Leash platform proxy.
Not instantiated directly – use Integrations#drive instead.
Constant Summary collapse
- PROVIDER =
"google_drive"
Instance Method Summary collapse
-
#get_file(file_id) ⇒ Hash
Get file metadata by ID.
-
#initialize(call_fn) ⇒ DriveClient
constructor
private
A new instance of DriveClient.
-
#list_files(query: nil, max_results: nil, folder_id: nil) ⇒ Hash
List files in the user’s Drive.
-
#search_files(query, max_results: nil) ⇒ Hash
Search files using a query string.
Constructor Details
#initialize(call_fn) ⇒ DriveClient
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of DriveClient.
11 12 13 |
# File 'lib/leash/drive.rb', line 11 def initialize(call_fn) @call = call_fn end |
Instance Method Details
#get_file(file_id) ⇒ Hash
Get file metadata by ID.
33 34 35 |
# File 'lib/leash/drive.rb', line 33 def get_file(file_id) @call.call(PROVIDER, "get-file", { "fileId" => file_id }) end |
#list_files(query: nil, max_results: nil, folder_id: nil) ⇒ Hash
List files in the user’s Drive.
21 22 23 24 25 26 27 |
# File 'lib/leash/drive.rb', line 21 def list_files(query: nil, max_results: nil, folder_id: nil) params = {} params["query"] = query if query params["maxResults"] = max_results if max_results params["folderId"] = folder_id if folder_id @call.call(PROVIDER, "list-files", params) end |
#search_files(query, max_results: nil) ⇒ Hash
Search files using a query string.
42 43 44 45 46 |
# File 'lib/leash/drive.rb', line 42 def search_files(query, max_results: nil) params = { "query" => query } params["maxResults"] = max_results if max_results @call.call(PROVIDER, "search-files", params) end |