coalescing_panda 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,17 +3,16 @@ module CoalescingPanda
3
3
 
4
4
  def canvas_oauth2
5
5
  user_id = params['user_id']
6
- api_domain = params['custom_canvas_api_domain']
7
6
 
8
- if token = CanvasApiAuth.where('user_id = ? and api_domain = ?', user_id, api_domain).pluck(:api_token).first
9
- @client = Bearcat::Client.new(token: token, prefix: ENV['OAUTH_PROTOCOL']+'://'+api_domain)
7
+ if token = CanvasApiAuth.where('user_id = ? and api_domain = ?', user_id, request.host).pluck(:api_token).first
8
+ @client = Bearcat::Client.new(token: token, prefix: request.host)
10
9
  elsif @lti_account = params['oauth_consumer_key'] && LtiAccount.find_by_key(params['oauth_consumer_key'])
11
10
  client_id = @lti_account.oauth2_client_id
12
- client = Bearcat::Client.new(prefix: 'http://'+api_domain)
11
+ client = Bearcat::Client.new(prefix: request.host)
13
12
  @lti_params = params.to_hash
14
13
  @canvas_url = client.auth_redirect_url(client_id,
15
14
  coalescing_panda.oauth2_redirect_url({key: params['oauth_consumer_key'],
16
- user_id: user_id, api_domain: api_domain}))
15
+ user_id: user_id, api_domain: request.host}))
17
16
  #delete the added params so the original oauth sig still works
18
17
  @lti_params.delete('action')
19
18
  @lti_params.delete('controller')
@@ -1,3 +1,3 @@
1
1
  module CoalescingPanda
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coalescing_panda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: