omniauth-surveymonkey2 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64b2ebe342007ec1f05a49e258bd75bd61ed9562
4
- data.tar.gz: 9b117d2cf87c10c26df919dd495a25d54cc39695
3
+ metadata.gz: 6e39c53c87c6e2d51994afa5aeb529d76fbc259a
4
+ data.tar.gz: 2ae8071f0eaf87ad4cbab4fcf51324041553df8d
5
5
  SHA512:
6
- metadata.gz: b22e075db2a2032deaeba979efcdcef9b2d3d0f777b8d47784f3143e6bc2dc65c43592bf2abff3d502dde21ec64ccd29a2c0f3a71a59d7e44fdcf8197778c3b8
7
- data.tar.gz: 9f70c6a76f1309a99ffa4ed8bda059a9c8f3f69300d1ee7d6b1bd1085f46bbf360e148b1ad02ea138e9949012c437232862c6f41d26e32feecb7c7fc7eb5813d
6
+ metadata.gz: cc5ff1defd161d2c8515e7fde66cf992bb98e434c3722ff1b34ce5625d3365585d7b7328bd77fd5476ceda27b9bab49a384750aa21d393c70e2b744121f248dc
7
+ data.tar.gz: f3cb0d987a418da94ea052500adc5d433fd5ff00a32912d7f3b8806031602d1732ee3f0813c8ee76beaf5d3ad6e4b9592c3733e942acc3be13a70e2c81a7ff5d
@@ -4,21 +4,54 @@ module OmniAuth
4
4
  module Strategies
5
5
  class Surveymonkey2 < OmniAuth::Strategies::OAuth2
6
6
 
7
+ DEFAULT_RESPONSE_TYPE = 'code'
8
+ DEFAULT_GRANT = 'authorization_code'
9
+
7
10
  option :name, "surveymonkey2"
8
11
 
9
12
  option :client_options, {
10
- :site => "https://api.surveymonkey.com",
13
+ :site => "https://api-surveymonkey-com-fytofsd4ktc2.runscope.net",
11
14
  :authorize_url => '/oauth/authorize',
12
15
  :token_url => '/oauth/token'
13
16
  }
14
17
 
15
- option :authorize_options, [:api_key]
18
+ option :authorize_options, [:client_id, :api_key]
19
+
20
+ def authorize_params
21
+ super.tap do |params|
22
+ params[:response_type] ||= DEFAULT_RESPONSE_TYPE
23
+ params[:client_id] = options[:client_id]
24
+ params[:api_key] = options[:api_key]
25
+ end
26
+ end
27
+
28
+ def token_params
29
+ super.tap do |params|
30
+ params[:grant_type] ||= DEFAULT_GRANT
31
+ params[:client_id] = options[:client_id]
32
+ params[:client_secret] = options[:client_secret]
33
+ params[:redirect_uri] = callback_url
34
+ end
35
+ end
36
+
37
+ def build_access_token
38
+ verifier = request.params['code']
39
+ token = client.auth_code.get_token(verifier, token_params)
40
+ end
16
41
 
17
42
  def callback_phase
18
43
  options[:client_options][:token_url] = "/oauth/token?api_key=#{options[:api_key]}"
19
- super
44
+ self.access_token = build_access_token
45
+ self.env['omniauth.auth'] = auth_hash
46
+ call_app!
20
47
  end
21
48
 
49
+ info do
50
+ {
51
+ :token => self.access_token.token,
52
+ :client => self.access_token.client.id
53
+ }
54
+ end
22
55
  end
23
56
  end
24
57
  end
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Surveymonkey2
3
- VERSION = "0.0.10"
3
+ VERSION = "0.0.11"
4
4
  end
5
5
  end
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-surveymonkey2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beck
@@ -82,6 +82,7 @@ files:
82
82
  - lib/omniauth/strategies/surveymonkey2.rb
83
83
  - lib/omniauth/surveymonkey2.rb
84
84
  - lib/omniauth/surveymonkey2/version.rb
85
+ - omniauth-surveymonkey2-0.0.10.gem
85
86
  - omniauth-surveymonkey2-0.0.9.gem
86
87
  - omniauth-surveymonkey2.gemspec
87
88
  - omniauth-surveymonkey2.rb