Class: D2L::Valence::AppContext
- Inherits:
-
Object
- Object
- D2L::Valence::AppContext
- Defined in:
- lib/d2l/valence/app_context.rb
Overview
AppContext
Class with contextual detail for the application (the ruby client)
Constant Summary collapse
- APP_ID_PARAM =
'x_a'.freeze
- AUTH_KEY_PARAM =
'x_b'.freeze
- CALLBACK_URL_PARAM =
'x_target'.freeze
- AUTH_SERVICE_URI_PATH =
'/d2l/auth/api/token'.freeze
Instance Attribute Summary collapse
-
#api_version ⇒ Object
readonly
Returns the value of attribute api_version.
-
#app_id ⇒ Object
readonly
Returns the value of attribute app_id.
-
#app_key ⇒ Object
readonly
Returns the value of attribute app_key.
-
#brightspace_host ⇒ Object
readonly
Returns the value of attribute brightspace_host.
Instance Method Summary collapse
-
#auth_url(callback_uri) ⇒ String
Generates a URL for authentication.
-
#initialize(brightspace_host:, app_id:, app_key:, api_version: '1.0') ⇒ AppContext
constructor
A new instance of AppContext.
Constructor Details
#initialize(brightspace_host:, app_id:, app_key:, api_version: '1.0') ⇒ AppContext
Returns a new instance of AppContext.
20 21 22 23 24 25 |
# File 'lib/d2l/valence/app_context.rb', line 20 def initialize(brightspace_host:, app_id:, app_key:, api_version: '1.0') @brightspace_host = brightspace_host @app_id = app_id @app_key = app_key @api_version = api_version end |
Instance Attribute Details
#api_version ⇒ Object (readonly)
Returns the value of attribute api_version.
11 12 13 |
# File 'lib/d2l/valence/app_context.rb', line 11 def api_version @api_version end |
#app_id ⇒ Object (readonly)
Returns the value of attribute app_id.
11 12 13 |
# File 'lib/d2l/valence/app_context.rb', line 11 def app_id @app_id end |
#app_key ⇒ Object (readonly)
Returns the value of attribute app_key.
11 12 13 |
# File 'lib/d2l/valence/app_context.rb', line 11 def app_key @app_key end |
#brightspace_host ⇒ Object (readonly)
Returns the value of attribute brightspace_host.
11 12 13 |
# File 'lib/d2l/valence/app_context.rb', line 11 def brightspace_host @brightspace_host end |
Instance Method Details
#auth_url(callback_uri) ⇒ String
Generates a URL for authentication
31 32 33 34 35 36 |
# File 'lib/d2l/valence/app_context.rb', line 31 def auth_url(callback_uri) @brightspace_host.to_uri( path: AUTH_SERVICE_URI_PATH, query: query_params_using(callback_url: callback_uri.to_s) ).to_s end |