Ruboty::GoogleCalendar
Ruboty plug-in to read schedule from Google Calendar.
Usage
> @ruboty list events
2015-03-04 09:30 - 09:40 Stand-up meeting
2015-03-04 14:00 - 15:00 Engineering meeting
>
> @ruboty list events in 30 minutes
2015-03-04 09:30 - 09:40 Stand-up meeting
ENV
Note: You need to register a native application client on Google Developers Console, then issue an access token (with a refresh token) by yourself.
GOOGLE_CALENDAR_ID - Google Calendar ID (default: primary)
GOOGLE_CLIENT_ID - Client ID
GOOGLE_CLIENT_SECRET - Client Secret
GOOGLE_REDIRECT_URI - Redirect URI (http://localhost in most cases)
GOOGLE_REFRESH_TOKEN - Refresh token issued with access token
How to issue an access token?
- Open authorization page
- Authorize
- Get code parameter from redirect URL
- Send POST request with the code
open "https://accounts.google.com/o/oauth2/auth\
?client_id=${GOOGLE_CLIENT_ID}\
&redirect_uri=http://localhost\
&scope=https://www.googleapis.com/auth/calendar\
&response_type=code\
&approval_prompt=force\
&access_type=offline"
curl \
-d "client_id=${GOOGLE_CLIENT_ID}"\
-d "client_secret=${GOOGLE_CLIENT_SECRET}"\
-d "redirect_uri=http://localhost"\
-d "grant_type=authorization_code"\
-d "code=${CODE}"\
"https://accounts.google.com/o/oauth2/token"