omniauth-kanbox 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +49 -33
- data/lib/omniauth-kanbox/version.rb +1 -1
- data/lib/omniauth/strategies/kanbox.rb +8 -8
- data/omniauth-kanbox.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTMzODg4MWFiZmVlODZjMjRkM2MxMGY4Yzg3MDk1ZGY3ZDVlZTQyMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTIwZTk4ZWM0OTIzNWM2NTUyYTcxODkxNTM5N2QwZjY0OTc3ZGE0Zg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjU5ZDVmYWUyNjZlNDc0NzEzNjA2ODg5OTYzMThlNmNmMjhmYmYyNzU0MTgy
|
10
|
+
NmI2MzcwNWZhMjRmMDI5NjVkZGU1OGFjZmViNmI5ZDhhMDMyZDE3MTY1Yzc0
|
11
|
+
OGZhZDVjMzEyMjFmOGY2OTA3OWE1ZDBjMTgzZjMxMmFhMTk3Njc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzA5OTZkOGQzMDVlNDE5MjFlODA3ZDNhNDdlMzk3ZDY5NWMxMWIxMjJmNzkz
|
14
|
+
MzM3ZDc0NmE4YjcxZGEyMGJkOGFlZjdiMTRmOTU5MTE4ZDU1MDA2YjhjYWUw
|
15
|
+
MzhlZDk5Y2FhNzRkZmZlMTVmZTRkZjc0YWUwNGE2NjRmZmVhNDg=
|
data/README.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
omniauth-workxp
|
1
|
+
omniauth-kanbox
|
3
2
|
===============
|
4
3
|
|
5
4
|
Unofficial OmniAuth strategy for Kanbox.
|
@@ -18,36 +17,53 @@ Or install it yourself as:
|
|
18
17
|
|
19
18
|
$ gem install omniauth-kanbox
|
20
19
|
|
20
|
+
|
21
21
|
## Usage
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
2.
|
50
|
-
|
51
|
-
|
52
|
-
|
22
|
+
|
23
|
+
`OmniAuth::Strategies::Kanbox` is simply a Rack middleware. Read the OmniAuth docs for detailed instructions: https://github.com/intridea/omniauth.
|
24
|
+
|
25
|
+
Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
29
|
+
provider :kanbox, ENV['KANBOX_KEY'], ENV['KANBOX_SECRET']
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
|
34
|
+
## Auth Hash
|
35
|
+
|
36
|
+
Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
{
|
40
|
+
:provider => 'kanbox',
|
41
|
+
:uid => 'user email',
|
42
|
+
:info => {
|
43
|
+
:email => 'yp.xjgz@gmail.com',
|
44
|
+
:name => 'yp.xjgz@gmail.com',
|
45
|
+
:phone => '18612553650',
|
46
|
+
::description => 'spaceUsed:200/20000'
|
47
|
+
},
|
48
|
+
:credentials => {
|
49
|
+
:token => 'ABCDEF...', # OAuth 2.0 access_token, which you may wish to store
|
50
|
+
:expires_at => 1321747205, # when the access token expires (it always will)
|
51
|
+
:expires => true # this will always be true
|
52
|
+
},
|
53
|
+
:extra => {
|
54
|
+
:raw_info => {
|
55
|
+
:status => 'ok',
|
56
|
+
:email => 'yp.xjgz@gmail.com',
|
57
|
+
:phone => '18612553650',
|
58
|
+
:spaceQuota => '200',
|
59
|
+
:spaceUsed => '20000',
|
60
|
+
:emailIsActive => 1,
|
61
|
+
:phoneIsActive => 0
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
```
|
66
|
+
|
67
|
+
The precise information available may depend on the permissions which you request.
|
68
|
+
|
53
69
|
|
@@ -1,13 +1,12 @@
|
|
1
|
-
require 'omniauth-
|
2
|
-
require 'multi_json'
|
1
|
+
require 'omniauth-oauth2'
|
3
2
|
|
4
3
|
module OmniAuth
|
5
4
|
module Strategies
|
6
|
-
class Kanbox < OmniAuth::Strategies::
|
5
|
+
class Kanbox < OmniAuth::Strategies::OAuth2
|
7
6
|
option :name, 'kanbox'
|
8
7
|
|
9
8
|
option :client_options, {
|
10
|
-
:
|
9
|
+
:authorize_url => '/0/auth',
|
11
10
|
:site => 'https://auth.kanbox.com',
|
12
11
|
:token_url => "/0/token",
|
13
12
|
}
|
@@ -16,8 +15,10 @@ module OmniAuth
|
|
16
15
|
|
17
16
|
info do
|
18
17
|
{
|
19
|
-
:name => raw_info['email']
|
20
|
-
:email => raw_info['email']
|
18
|
+
:name => raw_info['email'],
|
19
|
+
:email => raw_info['email'],
|
20
|
+
:phone => raw_info['phone'],
|
21
|
+
:description => "spaceUsed:#{raw_info['spaceUsed']}/#{raw_info['spaceQuota']}"
|
21
22
|
}
|
22
23
|
end
|
23
24
|
|
@@ -28,10 +29,9 @@ module OmniAuth
|
|
28
29
|
end
|
29
30
|
|
30
31
|
def raw_info
|
31
|
-
@raw_info ||= access_token.get(
|
32
|
+
@raw_info ||= MultiJson.decode(access_token.get("https://api.kanbox.com/0/info").body)
|
32
33
|
end
|
33
34
|
|
34
|
-
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
data/omniauth-kanbox.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
|
22
22
|
s.add_dependency 'omniauth', '~> 1.2'
|
23
|
-
s.add_dependency 'omniauth-oauth2', '~> 1.
|
23
|
+
s.add_dependency 'omniauth-oauth2', '~> 1.2'
|
24
24
|
s.add_development_dependency 'rspec', '~> 2.7'
|
25
25
|
s.add_development_dependency 'rack-test'
|
26
26
|
s.add_development_dependency 'simplecov'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-kanbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- YuanPing
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
40
|
+
version: '1.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|