facebookoauth 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/facebookoauth.rb +7 -0
- data/lib/facebookoauth/client.rb +43 -0
- metadata +79 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f4f5e31f79f2a8f57df26518f86ea1e62d7456d1
|
4
|
+
data.tar.gz: cb204afaab3b94dafebe1c2ff213418b97369805
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bf83367e2e70d12c0cc20723c65a41c08b629f87691d4ffaf313761e37eedc8ddc2907b3aa5b4233ca1108279bca984d7be976478dc74f157246ed4772e9a9d4
|
7
|
+
data.tar.gz: 58219a57966119fb465fdc9d348335679576d740e15fc6e785270584d9592776006f49e77c6ac591aadc51e8ec0cc105d2af0e6e6afda47f3059f569358bfd00
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module FacebookOAuth
|
2
|
+
class Client
|
3
|
+
|
4
|
+
@@token = nil
|
5
|
+
|
6
|
+
def initialize(options = {})
|
7
|
+
@client_id = options[:client_id]
|
8
|
+
@client_secret = options[:client_secret]
|
9
|
+
@redirect = options[:redirect]
|
10
|
+
end
|
11
|
+
|
12
|
+
def authorize_url(options = {})
|
13
|
+
consumer.authorize_url({
|
14
|
+
:client_id => @client_id,
|
15
|
+
:redirect_uri => @redirect,
|
16
|
+
:scope => options[:scope]
|
17
|
+
})
|
18
|
+
end
|
19
|
+
|
20
|
+
def authorize(options = {})
|
21
|
+
@@token = consumer.auth_code.get_token(
|
22
|
+
options[:code],
|
23
|
+
:redirect_uri => @redirect,
|
24
|
+
:parse => :query
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
def request(request_uri)
|
29
|
+
@@token.get("https://graph.facebook.com/#{request_uri}".gsub('/\/\//', '')).body
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
def consumer
|
34
|
+
OAuth2::Client.new(
|
35
|
+
@client_id,
|
36
|
+
@client_secret,
|
37
|
+
:site => 'https://graph.facebook.com',
|
38
|
+
:authorize_url => 'https://www.facebook.com/dialog/oauth',
|
39
|
+
:token_url => '/oauth/access_token'
|
40
|
+
)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: facebookoauth
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- iamdual
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: oauth2
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.8'
|
34
|
+
- - '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 1.8.3
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '1.8'
|
44
|
+
- - '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.8.3
|
47
|
+
description: This is a Facebook OAuth library for Ruby.
|
48
|
+
email: i@ekin.pw
|
49
|
+
executables: []
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
53
|
+
- lib/facebookoauth.rb
|
54
|
+
- lib/facebookoauth/client.rb
|
55
|
+
homepage: https://rubygems.org/gems/facebookoauth
|
56
|
+
licenses:
|
57
|
+
- MIT
|
58
|
+
metadata: {}
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
requirements: []
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 2.5.0
|
76
|
+
signing_key:
|
77
|
+
specification_version: 4
|
78
|
+
summary: Facebook OAuth library for Ruby.
|
79
|
+
test_files: []
|