-
Clone the repository:
git clone https://github.com/dorkrawk/docs-pull.git cd docs-pull -
Install the required gems:
bundle install -
Set up Google API credentials:
- Go to the Google Cloud Console.
- Create a new project or select an existing project.
- Enable the Google Docs API and Google Drive API for the project.
- Create OAuth 2.0 credentials and download the JSON file.
- Save the JSON file as
credentials.jsonin the root directory of the repository.
-
Run the Ruby script to pull the contents of a Google Doc:
ruby google_doc_pull.rb -
Follow the instructions to authorize your Google account. The credentials will be stored to avoid re-authorization after the first time.
- The application uses the
googleauthgem for OAuth2 authorization and thegoogle_drivegem to pull the contents of a Google Doc. - Make sure to keep your
credentials.jsonfile secure and do not share it with others.
The credentials.json file should look like this:
{
"installed": {
"client_id": "YOUR_CLIENT_ID",
"project_id": "YOUR_PROJECT_ID",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "YOUR_CLIENT_SECRET",
"redirect_uris": [
"urn:ietf:wg:oauth:2.0:oob",
"http://localhost"
]
}
}