omniauth-zooniverse 0.0.3 → 0.0.4

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: 467fff8d5046ffee666ee9b6702440b250b1ee9a
4
- data.tar.gz: 52c1e0666e889633a4a3a67a9ff269464f54f577
3
+ metadata.gz: fb67d712fd698622b31601cbd634fd589762914b
4
+ data.tar.gz: b2fccc2a71cf796a2db9c4f628fc4be176a4e075
5
5
  SHA512:
6
- metadata.gz: bfa0d4d1f0051fb998b77c8ffc5d712229bd31b6a31c0896927da6718f7fe384b3bf432b12f2ce961f645d18b0a623b867fdcd3b1feade3b378b921f1c80ffbb
7
- data.tar.gz: 0de9d3ef5f99e72df2c1db2fa1ffded1fda20e9fbb9cd06a80a0cb8a4cf72a339d07e92f0c3e678e97145ae798d51184a0e58a99222f915f21a1593169c4b3b4
6
+ metadata.gz: e6c6c01b8fc38270fc14ce349b8dff5ab741c773bac6d2f0f27359c06ddbaa61bef252d5ca0d4bf21dd8f728df2e9d228bc38c340931575f2d00559b7f8cef4f
7
+ data.tar.gz: e895c4538e4e61f6ce4dc3df359a690215f4e71dd0ed3111bd57dc8d95b416f02ab80ec0b534aa91e17bcfe5562265be87c5af1f83ccf37dbbadaf9d4fa7c50f
data/README.md CHANGED
@@ -1,24 +1,38 @@
1
1
  # Omniauth::Zooniverse
2
2
 
3
- TODO: Write a gem description
3
+ OmniAuth oAuth strategy for the Zooniverse.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  Add this line to your application's Gemfile:
8
8
 
9
- gem 'omniauth-zooniverse'
9
+ ```ruby
10
+ gem 'omniauth-zooniverse'
11
+ ```
10
12
 
11
13
  And then execute:
12
14
 
13
- $ bundle
15
+ ```shell
16
+ $ bundle install
17
+ ```
14
18
 
15
19
  Or install it yourself as:
16
20
 
17
- $ gem install omniauth-zooniverse
21
+ ```shell
22
+ $ gem install omniauth-zooniverse
23
+ ```
18
24
 
19
25
  ## Usage
20
26
 
21
- TODO: Write usage instructions here
27
+ Configure the strategy in `config/initializers/omniauth.rb`:
28
+
29
+ ```ruby
30
+ Rails.application.config.middleware.use OmniAuth::Builder do
31
+ provider :zooniverse, ENV['ZOONIVERSE_APP_ID'], ENV['ZOONIVERSE_APP_SECRET']
32
+ end
33
+ ```
34
+
35
+ Refer to the docs for more information on how to use omniauth in your app, https://github.com/intridea/omniauth#integrating-omniauth-into-your-application
22
36
 
23
37
  ## Contributing
24
38
 
@@ -12,7 +12,7 @@ module OmniAuth
12
12
  option :client_options, {
13
13
  :site => "https://panoptes.zooniverse.org",
14
14
  :authorize_url => "/oauth/authorize",
15
- :scope => "user, public"
15
+ :scope => DEFAULT_SCOPE
16
16
  }
17
17
 
18
18
  uid { raw_info["id"] }
@@ -36,14 +36,20 @@ module OmniAuth
36
36
  info do
37
37
  {
38
38
  :email => raw_info["email"],
39
- :name => raw_info["display_name"]
39
+ :name => raw_info["display_name"],
40
+ :zooniverse_id => raw_info["zooniverse_id"]
40
41
  }
41
42
  end
42
43
 
43
44
 
44
45
  def raw_info
45
- raw = JSON.parse(access_token.get('/api/me', headers: {'Accept' => "application/vnd.api+json; version=1"}).body)
46
- @raw_info ||= raw["users"][0]
46
+ return @raw_info if @raw_info
47
+ token_response = access_token.get(
48
+ '/api/me',
49
+ headers: {'Accept' => "application/vnd.api+json; version=1"}
50
+ )
51
+ raw = JSON.parse(token_response.body)
52
+ @raw_info = raw["users"][0]
47
53
  end
48
54
  end
49
55
  end
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Zooniverse
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -4,6 +4,10 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'omniauth/zooniverse/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
+ # https://github.com/intridea/omniauth-oauth2/issues/81
8
+ # 1.4.0 has a bug that prevents login
9
+ spec.add_dependency "omniauth-oauth2", "1.3.1"
10
+
7
11
  spec.name = "omniauth-zooniverse"
8
12
  spec.version = Omniauth::Zooniverse::VERSION
9
13
  spec.authors = ["Stuart Lynn"]
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-zooniverse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stuart Lynn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-05 00:00:00.000000000 Z
11
+ date: 2016-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth-oauth2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.3.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.3.1
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -76,8 +90,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
90
  version: '0'
77
91
  requirements: []
78
92
  rubyforge_project:
79
- rubygems_version: 2.4.5.1
93
+ rubygems_version: 2.5.0
80
94
  signing_key:
81
95
  specification_version: 4
82
96
  summary: Provides an OAuth2.0 strategy for the zooniverse
83
97
  test_files: []
98
+ has_rdoc: