Module: CSVPlusPlus::GoogleApiClient

Extended by:
T::Sig
Defined in:
lib/csv_plus_plus/google_api_client.rb

Overview

A convenience wrapper around Google's REST API client

Class Method Summary collapse

Class Method Details

.drive_clientGoogle::Apis::DriveV3::DriveService

Get a Google::Apis::DriveV3::DriveService instance connected to the drive API

Returns:

  • (Google::Apis::DriveV3::DriveService)


23
24
25
26
27
# File 'lib/csv_plus_plus/google_api_client.rb', line 23

def self.drive_client
  ::Google::Apis::DriveV3::DriveService.new.tap do |d|
    d.authorization = ::Google::Auth.get_application_default(['https://www.googleapis.com/auth/drive.file'].freeze)
  end
end

.sheets_clientGoogle::Apis::SheetsV4::SheetsService

Get a Google::Apis::SheetsV4::SheetsService instance configured to connect to the sheets API

Returns:

  • (Google::Apis::SheetsV4::SheetsService)


13
14
15
16
17
# File 'lib/csv_plus_plus/google_api_client.rb', line 13

def self.sheets_client
  ::Google::Apis::SheetsV4::SheetsService.new.tap do |s|
    s.authorization = ::Google::Auth.get_application_default(['https://www.googleapis.com/auth/spreadsheets'].freeze)
  end
end