Class: Comfy::Admin::Meetalendar::AuthCredential

Inherits:
ApplicationRecord
  • Object
show all
Defined in:
app/models/comfy/admin/meetalendar/auth_credential.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.expand_env(str) ⇒ Object

TODO(Schau): There might be a better place for this function



7
8
9
# File 'app/models/comfy/admin/meetalendar/auth_credential.rb', line 7

def self.expand_env(str)
  str.gsub(/\$([a-zA-Z_][a-zA-Z0-9_]*)|\${\g<1>}|%\g<1>%/) { ENV[$1] }
end

Instance Method Details

#scopeObject



14
15
16
17
18
# File 'app/models/comfy/admin/meetalendar/auth_credential.rb', line 14

def scope
  # NOTE(Schau): Scope expected to be a json parsable string that results in an array.
  parsed_scope = JSON.parse(self.scope_json)
  parsed_scope = parsed_scope.empty? ? [] : parsed_scope
end

#scope=(new_scope) ⇒ Object



19
20
21
# File 'app/models/comfy/admin/meetalendar/auth_credential.rb', line 19

def scope=(new_scope)
  self.scope_json = new_scope.to_json.to_s
end