app/controllers/concerns/googledrive.rb
# create a new oauth2client with all the attributes that remain constant and return it
create a new oauth2client with all the attributes that remain constant and return it
create a new oauth2client with all the attributes that remain constant and return it
def oauth2client
    client = Signet::OAuth2::Client.new(client_id: ENV.fetch('GOOGLE_API_CLIENT_ID'),
                                        client_secret: ENV.fetch('GOOGLE_API_CLIENT_SECRET'),
                                        authorization_uri: 'https://accounts.google.com/o/oauth2/auth',
                                        token_credential_uri: 'https://accounts.google.com/o/oauth2/token',
                                        scope: Google::Apis::DriveV3::AUTH_DRIVE_READONLY,
                                        redirect_uri: oauth2callback_googledrive_index_url)
    client
  end
def oauth2client client = Signet :: OAuth2 :: Client . new ( client_id : ENV . fetch ( 'GOOGLE_API_CLIENT_ID' ) , client_secret : ENV . fetch ( 'GOOGLE_API_CLIENT_SECRET' ) , authorization_uri : 'https://accounts.google.com/o/oauth2/auth' , token_credential_uri : 'https://accounts.google.com/o/oauth2/token' , scope : Google :: Apis :: DriveV3 :: AUTH_DRIVE_READONLY , redirect_uri : oauth2callback_googledrive_index_url ) client end
create a new oauth2client with all the attributes that remain constant and return it
create a new oauth2client with all the attributes that remain constant and return it
# (mostly taken from http://readysteadycode.com/howto-access-the-google-calendar-api-with-ruby)