Class: SpreadsheetToJson::Config
- Inherits:
-
Object
- Object
- SpreadsheetToJson::Config
- Defined in:
- lib/spreadsheet_to_json/config.rb
Class Method Summary collapse
-
.get_access_token(config_path) ⇒ Object
Get the access_token of the auth.
-
.get_spreadsheet_key(config_path) ⇒ Object
Get the spreadsheet_key.
Class Method Details
.get_access_token(config_path) ⇒ Object
Get the access_token of the auth
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/spreadsheet_to_json/config.rb', line 12 def get_access_token(config_path) config = get_settings_from_yml(config_path) client = OAuth2::Client.new( config['auth']['client_id'], config['auth']['client_secret'], site: config['auth']['site'], token_url: config['auth']['token_url'], authorize_url: config['auth']['token_url'] ) auth_token = OAuth2::AccessToken.from_hash( client, { :refresh_token => config['auth']['refresh_token'], :expires_at => 3600 } ) auth_token.refresh!.token end |
.get_spreadsheet_key(config_path) ⇒ Object
Get the spreadsheet_key
7 8 9 |
# File 'lib/spreadsheet_to_json/config.rb', line 7 def get_spreadsheet_key(config_path) get_settings_from_yml(config_path)['spreadsheet_key'] end |