omniauth-campus 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 91f0ac0144ab79714fd31001007ca0462db0b55c
4
- data.tar.gz: ebbe61859cea155be7a79aaf2aac0ad6b483545e
3
+ metadata.gz: a9a1930b5e53c1c8be54b2b337354ed53e93daec
4
+ data.tar.gz: 6573a9c7e784d5cc592e50a4fba90fdc63f94fe1
5
5
  SHA512:
6
- metadata.gz: 6f79c9e158305395492225ddd2fa9ce1baa84c3f3b4a79cdd66cc14210001ddca959d7a6642367afeef339e8936441f89a5ce7744198348e58144115c7bbaf8c
7
- data.tar.gz: edca576413b21010bb5a56ee1ef3a366a350777b2096019f39adc8ee8ccc27bd4ac9b87a6b1a9ae91f8436b85e54bf885dc3807c09cb7bcffdb9459c169b3d45
6
+ metadata.gz: aaae4a8eba515292769cb3ae05093b06ee0a227dbbb29e4971815f733b4f4d6d12d3f66f2f1109113e1713b83578adfafb0d74b0b07e6ac3e63527aa3b676da3
7
+ data.tar.gz: fa7d03ce964fa71f221521ad8202f16582fb61c806520b546ce03e9f6dc81bdd33282de852a5b2241913f085136c6fb3818f142d87088bca071a05731a042ffe
Binary file
Binary file
@@ -1,82 +1,35 @@
1
- require 'multi_json'
2
- require 'faraday'
3
- require 'net/http'
4
- require 'open-uri'
5
- require 'openssl'
6
- require 'rack/utils'
7
- require 'oauth'
8
- require 'omniauth'
9
-
10
- require 'uri'
11
-
12
- #require 'rack/utils'
1
+ require 'omniauth-oauth2'
13
2
 
14
3
  module OmniAuth
15
4
  module Strategies
16
- # Your code goes here...
17
- class Campus
18
- include OmniAuth::Strategy
19
-
20
-
21
- option :name, 'campus'
22
- args [:consumer_key, :consumer_secret]
23
- option :consumer_key, "YzjVHuk8xoXCTcNwYg57yiCW5w59tucC"
24
- option :consumer_secret, "ZDrWuDsunNkRroU5psb6QyMmT86XkYST"
25
- option :client_options, {
26
- #token_url: '/oauth/access_token',
27
- #authorize_url: '/oauth/authorize',
28
- #request_token_path: '/oauth/request_token',
29
- site: 'http://community3dev.devcloud.acquia-sites.com/api'
30
- }
31
- option :fields, [:username, :email]
32
-
5
+ class Campus < OmniAuth::Strategies::OAuth2
6
+ option :name, 'campus'
7
+ option :client_options, {
8
+ :site => 'http://community3dev.devcloud.acquia-sites.com/api',
9
+ :proxy => ENV['http_proxy'] ? URI(ENV['http_proxy']) : nil
10
+ }
33
11
 
12
+ uid { raw_info['uid'] }
34
13
 
35
- attr_accessor :access_token
14
+ info do
15
+ {
16
+ :id => raw_info['id'],
17
+ :name => raw_info['name'],
18
+ :email => raw_info['email'],
36
19
 
37
-
38
- #site' 'http://community3dev.devcloud.acquia-sites.com/api'
39
-
40
- #option :client_options, {]
41
- # :site => 'http://community3dev.devcloud.acquia-sites.com/api',
42
- # :authorize_url => 'https://www.vistacampus.org/login/oauth/authorize',
43
- # :token_url => 'https://www.vistacampus.org/login/oauth/access_token'
44
- #
45
- # }
46
- #
47
-
48
-
49
- def consumer
50
- consumer = ::OAuth::Consumer.new(options.consumer_key, options.consumer_secret, options.client_options)
51
- consumer.http.open_timeout = options.open_timeout if options.open_timeout
52
- consumer.http.read_timeout = options.read_timeout if options.read_timeout
53
- consumer
20
+ }
54
21
  end
55
22
 
56
- def request_phase
57
- form = OmniAuth::Form.new(:title => "User Info", :url => callback_path)
58
- options.fields.each do |field|
59
- form.text_field field.to_s.capitalize.gsub("_", " "), field.to_s
60
- end
61
- form.button "Sign In"
62
- form.to_response
63
- end
64
-
65
- uid {raw_info['uid']}
66
-
67
- info do {
68
- name: raw_info['name'],
69
- email: raw_info['email']
70
- }
71
- end
23
+ extra do
24
+ { :raw_info => raw_info }
25
+ end
72
26
 
73
- def raw_info
74
- @raw_info ||= MultiJson.decode(access_token.get('/me').body )
75
- end
27
+ def raw_info
28
+ @raw_info ||= MultiJson.load(access_token.get('/users').body)['users'][0]['user']
29
+ rescue ::Errno::ETIMEDOUT
30
+ raise ::Timeout::Error
31
+ end
76
32
 
77
33
  end
78
34
  end
79
35
  end
80
-
81
-
82
-
Binary file
@@ -1,6 +1,6 @@
1
1
  module Omniauth
2
2
  module Campus
3
- VERSION = "0.8.1"
3
+ VERSION = "0.8.2"
4
4
  end
5
5
  end
6
6
 
@@ -20,8 +20,8 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
- spec.add_runtime_dependency 'omniauth-oauth', '~> 1.0'
24
- #spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.1', '>= 1.1.1'
23
+ #spec.add_runtime_dependency 'omniauth-oauth', '~> 1.0'
24
+ spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.1', '>= 1.1.1'
25
25
  #spec.add_runtime_dependency 'oauth'
26
26
  #spec.add_dependency 'oauth2', '~> 0.8.0'
27
27
  spec.add_dependency 'faraday', ['>= 0.8', '<0.10']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-campus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - johnvehr
@@ -39,19 +39,25 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: omniauth-oauth
42
+ name: omniauth-oauth2
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: '1.0'
47
+ version: '1.1'
48
+ - - '>='
49
+ - !ruby/object:Gem::Version
50
+ version: 1.1.1
48
51
  type: :runtime
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
52
55
  - - ~>
53
56
  - !ruby/object:Gem::Version
54
- version: '1.0'
57
+ version: '1.1'
58
+ - - '>='
59
+ - !ruby/object:Gem::Version
60
+ version: 1.1.1
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: faraday
57
63
  requirement: !ruby/object:Gem::Requirement