Class: CalendarApi::OauthScope
- Inherits:
-
Object
- Object
- CalendarApi::OauthScope
- Defined in:
- lib/calendar_api/models/oauth_scope.rb
Overview
OAuth 2 scopes supported by the API
Constant Summary collapse
- OAUTH_SCOPE =
[ # See and download any calendar you can access using your Google Calendar. HTTPS_WWW_GOOGLEAPIS_COM_AUTH_CALENDAR_READONLY = 'https://www.googleapis.com/auth/calendar.readonly'.freeze, # View and edit events on all your calendars. HTTPS_WWW_GOOGLEAPIS_COM_AUTH_CALENDAR_EVENTS = 'https://www.googleapis.com/auth/calendar.events'.freeze, # See, edit, share, and permanently delete all the calendars you can # access using Google Calendar. HTTPS_WWW_GOOGLEAPIS_COM_AUTH_CALENDAR = 'https://www.googleapis.com/auth/calendar'.freeze ].freeze
Class Method Summary collapse
- .from_value(value, default_value = HTTPS_WWW_GOOGLEAPIS_COM_AUTH_CALENDAR_READONLY) ⇒ Object
- .validate(value) ⇒ Object
Class Method Details
.from_value(value, default_value = HTTPS_WWW_GOOGLEAPIS_COM_AUTH_CALENDAR_READONLY) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/calendar_api/models/oauth_scope.rb', line 27 def self.from_value(value, default_value = HTTPS_WWW_GOOGLEAPIS_COM_AUTH_CALENDAR_READONLY) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'https_www_googleapis_com_auth_calendar_readonly' then HTTPS_WWW_GOOGLEAPIS_COM_AUTH_CALENDAR_READONLY when 'https_www_googleapis_com_auth_calendar_events' then HTTPS_WWW_GOOGLEAPIS_COM_AUTH_CALENDAR_EVENTS when 'https_www_googleapis_com_auth_calendar' then HTTPS_WWW_GOOGLEAPIS_COM_AUTH_CALENDAR else default_value end end |
.validate(value) ⇒ Object
21 22 23 24 25 |
# File 'lib/calendar_api/models/oauth_scope.rb', line 21 def self.validate(value) return false if value.nil? OAUTH_SCOPE.include?(value) end |