Class: Caly::Providers::GoogleOauth2
- Defined in:
- lib/caly/providers/google_oauth2.rb
Instance Method Summary collapse
-
#initialize(token) ⇒ GoogleOauth2
constructor
A new instance of GoogleOauth2.
- #list_calendars ⇒ Object
Constructor Details
#initialize(token) ⇒ GoogleOauth2
Returns a new instance of GoogleOauth2.
4 5 6 7 |
# File 'lib/caly/providers/google_oauth2.rb', line 4 def initialize(token) @url = "https://www.googleapis.com/calendar/v3" super end |
Instance Method Details
#list_calendars ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/caly/providers/google_oauth2.rb', line 9 def list_calendars response = execute_request(:get, "users/me/calendarList") return error_from(response) unless response["code"] == "200" response["items"].map do |c| if c["accessRole"] == "owner" Caly::Calendar.new(id: c["id"], name: c["summary"], description: c["description"], location: c["location"], timezone: c["timeZone"], raw: c) end end.compact end |