omniauth-notes 0.0.1 → 0.0.2

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: 8825a2149cd31498a1c50f3d2ca6fc11d6154d32
4
- data.tar.gz: 233a74494117715c369e5916f1240424a8cde0ce
3
+ metadata.gz: b6fd91b44ec687b58eda834a6de128b0f89d3119
4
+ data.tar.gz: 41d3ac1f081c5599f34587ff493285732cd058fd
5
5
  SHA512:
6
- metadata.gz: 6b3364ed3a3f023f88b398d12bd64cca3dae04eb1cd38fcd6c442099be731d3bb796455b8ee5150453579522cd50d2a9f1fdfe2921cbfca994d0d748f48dbddf
7
- data.tar.gz: fb431aeeaf2087a6af265da142d23d5dd8d1d4622d21e0aa9b4ae13d076d59eeaf2b3a63f6cf32229b9b4823188bf73054c10f62a68d125c68c505ad12d39d69
6
+ metadata.gz: bf216e2700d87bacf2cafa39150e3abf865b3809ccfe6195c4fd8132fe0cb9850df4f1a55dcbb89acecea176d29ff2bd31dc5f956b3772f9d41ce11ab72539d8
7
+ data.tar.gz: f99ef5ed68e50ac5b3afa6c3bd11bc909af3baf1957dc9f1ff2b2dd5884e891ddb44182c99474b00e3c557b352fbfa4f459b4e0ff66231e3a502009ffd3dee61
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Notes
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -1,31 +1,27 @@
1
- require 'omniauth'
1
+ require 'omniauth/strategies/oauth2'
2
2
 
3
3
  module OmniAuth
4
4
  module Strategies
5
- class Notes
6
- include OmniAuth::Strategy
5
+ class Notes < OmniAuth::Strategies::OAuth2
6
+ option :name, :notes
7
7
 
8
- option :fields, [:email]
9
- option :uid_field, :email
8
+ option :client_options, {
9
+ :site => "http://notes18.com",
10
+ :authorize_url => "/oauth/authorize"
11
+ }
10
12
 
11
- uid do
12
- request.params[options.uid_field.to_s]
13
- end
13
+ uid { raw_info["id"] }
14
14
 
15
15
  info do
16
- options.fields.inject({}) do |hash, field|
17
- hash[field] = request.params[field]
18
- hash
19
- end
16
+ {
17
+ email: raw_info["email"]
18
+ # and anything else you want to return to your API consumers
19
+ }
20
20
  end
21
21
 
22
- def request_phase
23
- redirect client.auth_code.authorize_url({:redirect_uri => callback_url}.merge(options.authorize_params))
24
- rescue ::Timeout::Error => e
25
- fail!(:timeout, e)
26
- rescue ::Net::HTTPFatalError, ::OpenSSL::SSL::SSLError => e
27
- fail!(:service_unavailable, e)
22
+ def raw_info
23
+ @raw_info ||= access_token.get('/api/me.json').parsed
28
24
  end
29
25
  end
30
26
  end
31
- END
27
+ end
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "rake"
23
23
 
24
24
  spec.add_dependency 'omniauth', '~> 1.0'
25
+ spec.add_dependency 'omniauth-oauth2', '~> 1.0'
25
26
  spec.add_dependency 'multi_json'
26
27
  end
27
28
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-notes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andersen Fan
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: omniauth-oauth2
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: multi_json
57
71
  requirement: !ruby/object:Gem::Requirement