simpleapikeyengine-facebook 0.0.3 → 0.1.0
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/providers/facebook_provider.rb +48 -48
- data/lib/simpleapikeyengine-facebook/version.rb +3 -3
- data/lib/simpleapikeyengine-facebook.rb +5 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e012f25ea0cb8491a840f5595271b391949b5e33
|
4
|
+
data.tar.gz: cb4c032b5df0c43565b6f0907da22a0fe840d06e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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?(
|
8
|
-
|
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[
|
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[
|
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
|
-
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
|
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:
|
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
|
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
|
68
|
+
version: 0.1.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: sqlite3
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|