-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* calling Google Sheets API * exposing secrets in Action * run tests only if all required env variables present
- Loading branch information
Showing
13 changed files
with
2,678 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,6 @@ | |
|
||
# rspec failure tracking | ||
.rspec_status | ||
|
||
.byebug_history | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,4 @@ | |
|
||
module SheetZoukas | ||
class Error < StandardError; end | ||
# Your code goes here... | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'google/apis/sheets_v4' | ||
require 'googleauth' | ||
|
||
module SheetZoukas | ||
# Interact with Google Sheets API | ||
class GoogleSheets | ||
DEFAULT_SCOPE = 'https://www.googleapis.com/auth/spreadsheets.readonly' | ||
|
||
def initialize(scope = DEFAULT_SCOPE) | ||
@authorizer = Google::Auth::ServiceAccountCredentials.from_env(scope: scope) | ||
end | ||
|
||
def retrieve_sheet(sheet_id, tab_name, range = nil) | ||
sheets = Google::Apis::SheetsV4::SheetsService.new | ||
sheets.authorization = @authorizer | ||
|
||
computed_range = SheetZoukas::GoogleSheets.send :create_range, tab_name, range | ||
sheets.get_spreadsheet_values(sheet_id, computed_range) | ||
end | ||
|
||
private_class_method def self.create_range(tab_name, range = nil) | ||
return tab_name unless range | ||
|
||
"#{tab_name}!#{range}" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.