module TransyncConfig
Constants
- CONFIG
- START_ROW
- WORKSHEET_COLUMNS
Result of
WORKSHEET_COLUMNS
should be something like this depends on LANGUAGES set in settings yaml fileWORKSHEET_COLUMNS
= { key: 1, en: 2, de: 3 }
Public Class Methods
init_spreadsheet()
click to toggle source
# File lib/transync/transync_config.rb, line 16 def self.init_spreadsheet # Authorizes with OAuth and gets an access token. client = Google::APIClient.new( application_name: 'Transync', application_version: Transync::VERSION ) auth = client.authorization auth.client_id = CONFIG['GDOC']['client_id'] # "YOUR CLIENT ID" auth.client_secret = CONFIG['GDOC']['client_secret'] # "YOUR CLIENT SECRET" auth.scope = [ 'https://www.googleapis.com/auth/drive', 'https://spreadsheets.google.com/feeds/' ] auth.redirect_uri = 'urn:ietf:wg:oauth:2.0:oob' print("1. Open this page:\n%s\n\n" % auth.authorization_uri) print('2. Enter the authorization code shown in the page: ') auth.code = $stdin.gets.chomp auth.fetch_access_token! access_token = auth.access_token # session = GoogleDrive.login_with_oauth(CONFIG['GDOC']['email'], CONFIG['GDOC']['password']) session = GoogleDrive.login_with_oauth(access_token) spreadsheet = session.spreadsheet_by_key(CONFIG['GDOC']['key']) worksheets = spreadsheet.worksheets return spreadsheet, worksheets end
re_init()
click to toggle source
used for init command after we create new tabs
# File lib/transync/transync_config.rb, line 61 def self.re_init @spreadsheet, @worksheets = TransyncConfig.init_spreadsheet end
spreadsheet()
click to toggle source
# File lib/transync/transync_config.rb, line 69 def self.spreadsheet @spreadsheet end
worksheets()
click to toggle source
# File lib/transync/transync_config.rb, line 65 def self.worksheets @worksheets end