Class: Ruboty::Handlers::GoogleCalendar::Client
- Inherits:
-
Object
- Object
- Ruboty::Handlers::GoogleCalendar::Client
- Defined in:
- lib/ruboty/handlers/google_calendar.rb
Constant Summary collapse
- APPLICATION_NAME =
"ruboty-google_calendar"- AUTH_URI =
"https://accounts.google.com/o/oauth2/auth"- SCOPE =
"https://www.googleapis.com/auth/calendar"- TOKEN_URI =
"https://accounts.google.com/o/oauth2/token"
Instance Method Summary collapse
-
#initialize(client_id: nil, client_secret: nil, redirect_uri: nil, refresh_token: nil) ⇒ Client
constructor
A new instance of Client.
- #list_events(calendar_id: nil) ⇒ Object
Constructor Details
#initialize(client_id: nil, client_secret: nil, redirect_uri: nil, refresh_token: nil) ⇒ Client
Returns a new instance of Client.
53 54 55 56 57 58 59 |
# File 'lib/ruboty/handlers/google_calendar.rb', line 53 def initialize(client_id: nil, client_secret: nil, redirect_uri: nil, refresh_token: nil) @client_id = client_id @client_secret = client_secret @redirect_uri = redirect_uri @refresh_token = refresh_token authenticate! end |
Instance Method Details
#list_events(calendar_id: nil) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/ruboty/handlers/google_calendar.rb', line 61 def list_events(calendar_id: nil) api_client.execute( api_method: calendar.events.list, parameters: { calendarId: calendar_id, singleEvents: true, orderBy: "startTime", timeMin: Time.now.iso8601, timeMax: 1.day.since.iso8601 } ).data end |