Sha256: bdc5336418c9dead2d378b0cb60b1d483a7fb42733dd1b77a55967006e0b8dc0

Contents?: true

Size: 804 Bytes

Versions: 4

Compression:

Stored size: 804 Bytes

Contents

module CanvasOauth
  class CanvasApiExtensions
    def self.build(canvas_url, user_id, tool_consumer_instance_guid)
      account_id = CanvasOauth::Authorization.fetch_account(user_id, tool_consumer_instance_guid)
      token = CanvasOauth::Authorization.fetch_token(user_id, tool_consumer_instance_guid)
      refresh_token = CanvasOauth::Authorization.fetch_refresh_token(user_id, tool_consumer_instance_guid)
      canvas_key = ((CanvasLtiKey.table_exists? && CanvasLtiKey.find_by(canvas_url: canvas_url)&.key) or CanvasConfig.key)
      canvas_secret = ((CanvasLtiKey.table_exists? && CanvasLtiKey.find_by(key: canvas_key, canvas_url: canvas_url)&.secret) or CanvasConfig.secret)
      CanvasApi.new(canvas_url, user_id, account_id, token, refresh_token, canvas_key, canvas_secret)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
qalam_oauth_engine-3.0.8 lib/canvas_oauth/canvas_api_extensions.rb
qalam_oauth_engine-3.0.7 lib/canvas_oauth/canvas_api_extensions.rb
qalam_oauth_engine-3.0.6 lib/canvas_oauth/canvas_api_extensions.rb
qalam_oauth_engine-3.0.5 lib/canvas_oauth/canvas_api_extensions.rb