simpleapikeyengine-facebook 0.0.3 → 0.1.0

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: be6043e1803424e5cb547bc3d629625c87257862
4
- data.tar.gz: 22bc5a1a6c0d37246a5ef9d428ae10ff7fc9ef04
3
+ metadata.gz: e012f25ea0cb8491a840f5595271b391949b5e33
4
+ data.tar.gz: cb4c032b5df0c43565b6f0907da22a0fe840d06e
5
5
  SHA512:
6
- metadata.gz: 5da37cb8177a3b0a02c12be02febc8d1693677243f57f59a43f85ac6b1bf76c3ea07c34028e6801a5b6272084c02db4bc1aa6d9a4828c1338ad701ad3f8670fd
7
- data.tar.gz: 3c8e34c556b6b40d6328841b3b9cb7f797afa033c8ff3febae31aaead26e8b2e972a6e117eab94a557e09b1321f0e75219d0537af3eb0ba2164a9f71605375c5
6
+ metadata.gz: a4877415cc9dec1c48c563e7737c0d9285d53777441614b492d46ebdd5634cede0f65ef85e71f7d1983a3e7cb2dbb552e01ea8c63ee60c5ecb5233794232d198
7
+ data.tar.gz: 8f752e20fc8974096448e14c6fe2228d555dad3a1edf65a3e52ddd09d908d0557d2e4f1d2c275b6d780fa5697ac661e0e238ed8f38cbe86248fad24b1b507cba
data/MIT-LICENSE CHANGED
@@ -1,20 +1,20 @@
1
- Copyright 2014 YOURNAME
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright 2014 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- simpleapikeyengine-facebook
2
- ==============================
3
-
4
- Facebook Provider for simpleapikeyengine gem.
1
+ simpleapikeyengine-facebook
2
+ ==============================
3
+
4
+ Facebook Provider for simpleapikeyengine gem.
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
- begin
2
- require 'bundler/setup'
3
- rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
- end
6
-
7
- Bundler::GemHelper.install_tasks
8
-
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ Bundler::GemHelper.install_tasks
8
+
@@ -1,48 +1,48 @@
1
- require 'simpleapikeyengine/providers/abstract_provider'
2
- require 'koala'
3
-
4
- module SimpleApiKeyEngine::Providers
5
- class FacebookProvider < AbstractProvider
6
- priority 5
7
- def self.acceptable?(auth_hash)
8
- auth_hash[:provider] == 'facebook'
9
- end
10
-
11
- def client
12
- @oauth ||= Koala::Facebook::OAuth.new(SimpleApiKeyEngine.configuration.facebook_app_id,
13
- SimpleApiKeyEngine.configuration.facebook_app_secret)
14
- end
15
-
16
- def get_auth_hash!
17
- res = client.parse_signed_request(@params[:signed_request])
18
- short_token = client.get_access_token(res['code'])
19
- graph = Koala::Facebook::API.new(short_token)
20
- user_info = graph.get_object('me')
21
- new_token = client.exchange_access_token_info(short_token)
22
-
23
- if new_token['expires'].to_i > 0
24
- expires_at = (Time.now.to_i + new_token['expires'].to_i).to_i
25
- expires = true
26
- else
27
- expires_at = nil
28
- expires = false
29
- end
30
- {
31
- provider: @params[:provider],
32
- uid: user_info['id'],
33
- credentials: {
34
- token: new_token['access_token'],
35
- expires_at: expires_at,
36
- expires: expires
37
- },
38
- info: {
39
- email: user_info['email'],
40
- name: user_info['name']
41
- },
42
- extra: {
43
- raw_info: user_info.to_h
44
- }
45
- }
46
- end
47
- end
48
- end
1
+ require 'simpleapikeyengine/providers/abstract_provider'
2
+ require 'koala'
3
+
4
+ module SimpleApiKeyEngine::Providers
5
+ class FacebookProvider < AbstractProvider
6
+ priority 5
7
+ def self.acceptable?(request)
8
+ request.params['provider'] == 'facebook'
9
+ end
10
+
11
+ def client
12
+ @oauth ||= Koala::Facebook::OAuth.new(SimpleApiKeyEngine.configuration.facebook_app_id,
13
+ SimpleApiKeyEngine.configuration.facebook_app_secret)
14
+ end
15
+
16
+ def get_auth_hash!
17
+ res = client.parse_signed_request(@params['signed_request'])
18
+ short_token = client.get_access_token(res['code'])
19
+ graph = Koala::Facebook::API.new(short_token)
20
+ user_info = graph.get_object('me')
21
+ new_token = client.exchange_access_token_info(short_token)
22
+
23
+ if new_token['expires'].to_i > 0
24
+ expires_at = (Time.now.to_i + new_token['expires'].to_i).to_i
25
+ expires = true
26
+ else
27
+ expires_at = nil
28
+ expires = false
29
+ end
30
+ {
31
+ provider: @params['provider'],
32
+ uid: user_info['id'],
33
+ credentials: {
34
+ token: new_token['access_token'],
35
+ expires_at: expires_at,
36
+ expires: expires
37
+ },
38
+ info: {
39
+ email: user_info['email'],
40
+ name: user_info['name']
41
+ },
42
+ extra: {
43
+ raw_info: user_info.to_h
44
+ }
45
+ }
46
+ end
47
+ end
48
+ end
@@ -1,3 +1,3 @@
1
- module SimpleApiKeyEngineFacebook
2
- VERSION = "0.0.3"
3
- end
1
+ module SimpleApiKeyEngineFacebook
2
+ VERSION = "0.1.0"
3
+ end
@@ -1,5 +1,5 @@
1
- require 'simpleapikeyengine'
2
- require 'simpleapikeyengine/providers/facebook_provider'
3
-
4
- module SimpleApiKeyEngineFacebook
5
- end
1
+ require 'simpleapikeyengine'
2
+ require 'simpleapikeyengine/providers/facebook_provider'
3
+
4
+ module SimpleApiKeyEngineFacebook
5
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simpleapikeyengine-facebook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuichi Takeuchi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-17 00:00:00.000000000 Z
11
+ date: 2015-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.0.3
61
+ version: 0.1.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.0.3
68
+ version: 0.1.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sqlite3
71
71
  requirement: !ruby/object:Gem::Requirement