Class: PandaPal::Platform::Generic

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PandaPal::Platform

deserialize, from_serialized, organization_api, #public_jwks, resolve_platform, resolve_platform_class, resolve_raw_platform

Constructor Details

#initialize(options) ⇒ Generic

Returns a new instance of Generic.



108
109
110
# File 'app/models/panda_pal/platform.rb', line 108

def initialize(options)
  @options = options
end

Class Method Details

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



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

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



120
121
122
# File 'app/models/panda_pal/platform.rb', line 120

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

#grant_urlObject



124
125
126
# File 'app/models/panda_pal/platform.rb', line 124

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

#jwks_urlObject



116
117
118
# File 'app/models/panda_pal/platform.rb', line 116

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

#platform_uriObject



112
113
114
# File 'app/models/panda_pal/platform.rb', line 112

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

#serializeObject



128
129
130
# File 'app/models/panda_pal/platform.rb', line 128

def serialize
  super.merge(options)
end