simpleapikeyengine-facebook 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +20 -20
- data/README.md +4 -4
- data/Rakefile +8 -8
- data/lib/simpleapikeyengine-facebook.rb +5 -5
- data/lib/simpleapikeyengine-facebook/version.rb +3 -3
- data/lib/simpleapikeyengine/providers/facebook_provider.rb +49 -48
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f827418f38b19ed5f7261fef30b59a7767cad08
|
4
|
+
data.tar.gz: 3ff138ca6f877684d7558bc786390560726d9752
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e93062119ed69415595d7e0dc4cb9f8cf953c1f15f831ee15025890d7f89cea4528a01f04b99c779297775f3b7b1157b6704f100c806072e1a07bfb3b8b6f5c0
|
7
|
+
data.tar.gz: 63783a71ba095380bb89bb0d8e2167a87e47facacacf73b60ce54b2b0f642d2178ced78114915c0c0f3d3269abb035be8427181caca9b638f759d1bf08bf9b87
|
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,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
|
@@ -1,3 +1,3 @@
|
|
1
|
-
module SimpleApiKeyEngineFacebook
|
2
|
-
VERSION = "0.1.
|
3
|
-
end
|
1
|
+
module SimpleApiKeyEngineFacebook
|
2
|
+
VERSION = "0.1.1"
|
3
|
+
end
|
@@ -1,48 +1,49 @@
|
|
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
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
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
|
+
description: user_info['bio']
|
42
|
+
},
|
43
|
+
extra: {
|
44
|
+
raw_info: user_info.to_h
|
45
|
+
}
|
46
|
+
}
|
47
|
+
end
|
48
|
+
end
|
49
|
+
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.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuichi Takeuchi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
127
|
version: '0'
|
128
128
|
requirements: []
|
129
129
|
rubyforge_project:
|
130
|
-
rubygems_version: 2.
|
130
|
+
rubygems_version: 2.4.5
|
131
131
|
signing_key:
|
132
132
|
specification_version: 4
|
133
133
|
summary: Facebook Provider for simple_api_key_engine gem.
|