Class: PandaPal::Platform::Generic

Inherits:
Platform
  • Object
show all
Defined in:
app/models/panda_pal/platform.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Generic

Returns a new instance of Generic.



110
111
112
# File 'app/models/panda_pal/platform.rb', line 110

def initialize(options)
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



99
100
101
# File 'app/models/panda_pal/platform.rb', line 99

def options
  @options
end

Class Method Details

.from_urls(base_url, jwks: nil, auth_redirect: nil, grant: nil) ⇒ Object



101
102
103
104
105
106
107
108
# File 'app/models/panda_pal/platform.rb', line 101

def self.from_urls(base_url, jwks: nil, auth_redirect: nil, grant: nil)
  new({
    base_url: base_url,
    jwks_url: jwks,
    auth_redirect_url: auth_redirect,
    grant_url: grant,
  })
end

Instance Method Details

#authentication_redirect_urlObject



122
123
124
# File 'app/models/panda_pal/platform.rb', line 122

def authentication_redirect_url
  URI.join(options[:base_url], options[:auth_redirect_url] || "/api/lti/authorize_redirect").to_s
end

#grant_urlObject



126
127
128
# File 'app/models/panda_pal/platform.rb', line 126

def grant_url
  URI.join(options[:base_url], options[:grant_url] || "/login/oauth2/token").to_s
end

#jwks_urlObject



118
119
120
# File 'app/models/panda_pal/platform.rb', line 118

def jwks_url
  URI.join(options[:base_url], options[:jwks_url] || "/api/lti/security/jwks").to_s
end

#platform_uriObject



114
115
116
# File 'app/models/panda_pal/platform.rb', line 114

def platform_uri
  options[:issuer] || options[:base_url]
end

#serializeObject



130
131
132
# File 'app/models/panda_pal/platform.rb', line 130

def serialize
  super.merge(options)
end