Module: Remote
- Defined in:
- lib/jekyll/remote.rb
Overview
——————- Isn’t actually implemented right now ——————- #
Constant Summary collapse
- OOB_URI =
"urn:ietf:wg:oauth:2.0:oob"- APPLICATION_NAME =
"Drive API Ruby Quickstart"- CREDENTIALS_PATH =
".json"- TOKEN_PATH =
"token.yaml"- SCOPE =
Google::Apis::DriveV3::AUTH_DRIVE_METADATA_READONLY
Class Method Summary collapse
Class Method Details
.authorize ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/jekyll/remote.rb', line 13 def self. client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH) token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH) = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store) user_id = "default" credentials = .get_credentials(user_id) if credentials.nil? url = .(base_url: OOB_URI) puts "Open the following URL in the browser and enter the " \ "resulting code after authorization:\n" + url code = gets credentials = .get_credentials_from_code(user_id: user_id, code: code, base_url: OOB_URI) end credentials end |
.list_files_in_drive(directory_id) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/jekyll/remote.rb', line 29 def self.list_files_in_drive(directory_id) drive_service = Google::Apis::DriveV3::DriveService.new drive_service..application_name = APPLICATION_NAME drive_service. = response = drive_service.list_files(q: "'#{directory_id}' in parents") response.files end |