OpenAuth2 0.0.2 → 0.0.3
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.
- data/Readme.markdown +36 -31
- data/examples/fb.rb +2 -2
- data/examples/google.rb +10 -10
- data/lib/open_auth2.rb +0 -10
- data/lib/open_auth2/client.rb +11 -35
- data/lib/open_auth2/config.rb +12 -17
- data/lib/open_auth2/connection.rb +4 -5
- data/lib/open_auth2/provider/base.rb +2 -2
- data/lib/open_auth2/token.rb +6 -17
- data/lib/open_auth2/version.rb +1 -1
- data/open_auth2.gemspec +1 -1
- data/spec/client_spec.rb +23 -40
- data/spec/config_spec.rb +6 -6
- data/spec/google/client_spec.rb +6 -6
- data/spec/google/token_spec.rb +7 -7
- data/spec/token_spec.rb +2 -2
- metadata +22 -21
data/Readme.markdown
CHANGED
@@ -19,16 +19,16 @@ client_id = 'enter in your own value'
|
|
19
19
|
client_secret = 'enter in your own value'
|
20
20
|
redirect_uri = 'enter in your own value'
|
21
21
|
|
22
|
-
config = OpenAuth2::Config.new do
|
22
|
+
config = OpenAuth2::Config.new do
|
23
23
|
# indicate what kind of provider you want to use
|
24
24
|
# Accepts: :google, :facebook or :default
|
25
|
-
#
|
26
|
-
c.provider = :facebook
|
27
25
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
provider = :facebook
|
27
|
+
|
28
|
+
client_id = client_id
|
29
|
+
client_secret = client_secret
|
30
|
+
redirect_uri = redirect_uri
|
31
|
+
scope = ['publish_stream']
|
32
32
|
end
|
33
33
|
```
|
34
34
|
|
@@ -37,16 +37,16 @@ end
|
|
37
37
|
Next, initialize a `client` object, which we'll use to make requests and pass in the `config` object we created earlier.
|
38
38
|
|
39
39
|
```ruby
|
40
|
-
client = OpenAuth2::Client.new do
|
41
|
-
|
40
|
+
client = OpenAuth2::Client.new do
|
41
|
+
config = config
|
42
42
|
end
|
43
43
|
```
|
44
44
|
|
45
45
|
`Client#configure_connection` takes a block, which can be used to setup middleware like any other Faraday client, i.e:
|
46
46
|
|
47
47
|
```ruby
|
48
|
-
client.configure_connection do
|
49
|
-
|
48
|
+
client.configure_connection do
|
49
|
+
response :logger
|
50
50
|
end
|
51
51
|
```
|
52
52
|
|
@@ -72,11 +72,11 @@ Access token is used to sign the request so the server can identify the client s
|
|
72
72
|
access_token = 'enter in your value'
|
73
73
|
refresh_token = 'enter in your value'
|
74
74
|
|
75
|
-
client.configure do
|
76
|
-
|
75
|
+
client.configure do
|
76
|
+
access_token = access_token
|
77
77
|
|
78
78
|
# optional, for fb its same as above
|
79
|
-
|
79
|
+
refresh_token = refresh_token
|
80
80
|
end
|
81
81
|
```
|
82
82
|
|
@@ -88,8 +88,8 @@ If you don't have an access token, we'll need to ask the server for it.
|
|
88
88
|
|
89
89
|
```ruby
|
90
90
|
token = client.token
|
91
|
-
token.configure_connection do
|
92
|
-
|
91
|
+
token.configure_connection do
|
92
|
+
response :logger
|
93
93
|
end
|
94
94
|
|
95
95
|
# asks Facebook for access_token
|
@@ -146,20 +146,22 @@ client.connection.run_request(:get, path, nil, nil)
|
|
146
146
|
|
147
147
|
## Plugins
|
148
148
|
|
149
|
-
OpenAuth2
|
149
|
+
Since various OAuth2 providers differ in their implementation, OpenAuth2 provides a simple plugin system to accomodate the differences, rather than 'one shoe fits all' approach. Facebook and Google plugins are builtin, but it is trivial to add new ones.
|
150
150
|
|
151
|
-
There are
|
151
|
+
There are three requirements:
|
152
152
|
|
153
153
|
1. Should be under right namespace (OpenAuth2::Provider)
|
154
|
-
1.
|
155
|
-
1.
|
154
|
+
1. Contain Options hash
|
155
|
+
1. Contain #parse class method
|
156
|
+
|
157
|
+
To use the plugin, call `Config#provider=` with name of the provider. OpenAuth2 upcases and camelizes the name and looks for the constant under OpenAuth2::Provider namespace.
|
156
158
|
|
157
|
-
###
|
159
|
+
### Plugin Example
|
158
160
|
|
159
161
|
```ruby
|
160
162
|
module OpenAuth2
|
161
163
|
module Provider
|
162
|
-
module
|
164
|
+
module YourApi
|
163
165
|
|
164
166
|
# Provider::Base contains keys of various accepted
|
165
167
|
# Options, while Provider::Default contains the default options and
|
@@ -171,6 +173,9 @@ module OpenAuth2
|
|
171
173
|
:refresh_token_grant_name => '',
|
172
174
|
}
|
173
175
|
|
176
|
+
# Called after AccessToken#get and #refresh response are received
|
177
|
+
# from provider.
|
178
|
+
#
|
174
179
|
def self.parse(config, response_body)
|
175
180
|
# parse the response body
|
176
181
|
access_token = response_body.gsub('access_token=', '')
|
@@ -193,17 +198,17 @@ require 'json'
|
|
193
198
|
access_token = 'enter in your own value'
|
194
199
|
refresh_token = 'enter in your own value'
|
195
200
|
|
196
|
-
config = OpenAuth2::Config.new do
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
201
|
+
config = OpenAuth2::Config.new do
|
202
|
+
provider = :google
|
203
|
+
access_token = access_token
|
204
|
+
refresh_token = refresh_token
|
205
|
+
scope = ['https://www.googleapis.com/auth/calendar']
|
206
|
+
redirect_uri = 'http://localhost:9393/google/callback'
|
207
|
+
path_prefix = '/calendar/v3'
|
203
208
|
end
|
204
209
|
|
205
|
-
client = OpenAuth2::Client.new do
|
206
|
-
|
210
|
+
client = OpenAuth2::Client.new do
|
211
|
+
config = config
|
207
212
|
end
|
208
213
|
|
209
214
|
# get request
|
data/examples/fb.rb
CHANGED
data/examples/google.rb
CHANGED
@@ -8,18 +8,18 @@ AccessToken = nil
|
|
8
8
|
RefreshToken = nil
|
9
9
|
PostEmail = nil
|
10
10
|
|
11
|
-
@config = OpenAuth2::Config.new do
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
@config = OpenAuth2::Config.new do
|
12
|
+
provider = :google
|
13
|
+
code = Code
|
14
|
+
client_id = ClientId
|
15
|
+
client_secret = ClientSecret
|
16
|
+
scope = ['https://www.googleapis.com/auth/calendar']
|
17
|
+
redirect_uri = 'http://localhost:9393/google/callback'
|
18
|
+
path_prefix = '/calendar/v3'
|
19
19
|
end
|
20
20
|
|
21
|
-
@client = OpenAuth2::Client.new do
|
22
|
-
|
21
|
+
@client = OpenAuth2::Client.new do
|
22
|
+
config = @config
|
23
23
|
end
|
24
24
|
|
25
25
|
@token = @client.token
|
data/lib/open_auth2.rb
CHANGED
@@ -19,15 +19,5 @@ require_relative 'open_auth2/client'
|
|
19
19
|
require_relative 'open_auth2/version'
|
20
20
|
|
21
21
|
module OpenAuth2
|
22
|
-
|
23
|
-
# Raised in Config#provider= when user sets to provider not in
|
24
|
-
# 'lib/open_auth2/provider/' or included by them manually.
|
25
|
-
#
|
26
22
|
class UnknownProvider < StandardError; end
|
27
|
-
|
28
|
-
# Raised in Client#new unless @config is set.
|
29
|
-
class NoConfigObject < StandardError; end
|
30
|
-
|
31
|
-
# Raised in Client#new unless @config is set to OpenAuth2::Config.
|
32
|
-
class UnknownConfigObject < StandardError; end
|
33
23
|
end
|
data/lib/open_auth2/client.rb
CHANGED
@@ -5,11 +5,7 @@ module OpenAuth2
|
|
5
5
|
extend DelegateToConfig
|
6
6
|
include Connection
|
7
7
|
|
8
|
-
# Use
|
9
|
-
# @config. We rely on Config for all Options info, so its important
|
10
|
-
# it is set right.
|
11
|
-
#
|
12
|
-
# Yields: self.
|
8
|
+
# Use to set config.
|
13
9
|
#
|
14
10
|
# Accepts:
|
15
11
|
# config: (optional) OpenAuth2::Config object
|
@@ -20,46 +16,33 @@ module OpenAuth2
|
|
20
16
|
# end
|
21
17
|
#
|
22
18
|
# # set via block
|
23
|
-
# OpenAuth2::Client.new do
|
24
|
-
#
|
19
|
+
# OpenAuth2::Client.new do
|
20
|
+
# config = config
|
25
21
|
# end
|
26
22
|
#
|
27
23
|
# # or pass it as an argument
|
28
24
|
# OpenAuth2::Client.new(config)
|
29
25
|
#
|
30
|
-
|
31
|
-
#
|
32
|
-
def initialize(config=nil)
|
26
|
+
def initialize(config=nil, &blk)
|
33
27
|
@config = config
|
34
|
-
|
35
|
-
yield self if block_given?
|
36
|
-
raise_config_setter_errors
|
37
|
-
|
38
|
-
# endpoint is where the api requests are made
|
28
|
+
instance_eval(&blk) if block_given?
|
39
29
|
@faraday_url = endpoint
|
40
|
-
|
41
|
-
self
|
42
30
|
end
|
43
31
|
|
44
|
-
#
|
45
|
-
# Mainly for setting access_token and refresh_token. Will raise
|
46
|
-
# Config related errors same as #initialize.
|
32
|
+
# Use to set/change config after #initialize.
|
47
33
|
#
|
48
34
|
# Examples:
|
49
35
|
# client = OpenAuth2::Client.new
|
50
36
|
#
|
51
|
-
# client.configure do
|
52
|
-
#
|
53
|
-
#
|
37
|
+
# client.configure do
|
38
|
+
# access_token = :access_token
|
39
|
+
# refresh_token = :refresh_token
|
54
40
|
# end
|
55
41
|
#
|
56
42
|
# Returns: self.
|
57
43
|
#
|
58
|
-
def configure
|
59
|
-
|
60
|
-
raise_config_setter_errors
|
61
|
-
|
62
|
-
self
|
44
|
+
def configure(&blk)
|
45
|
+
instance_eval(&blk) if block_given?
|
63
46
|
end
|
64
47
|
|
65
48
|
# We use this to get & refresh access/refresh tokens.
|
@@ -171,12 +154,5 @@ module OpenAuth2
|
|
171
154
|
connection.run_request(hash[:verb], hash[:path], hash[:body],
|
172
155
|
hash[:header])
|
173
156
|
end
|
174
|
-
|
175
|
-
private
|
176
|
-
|
177
|
-
def raise_config_setter_errors
|
178
|
-
raise NoConfigObject unless config
|
179
|
-
raise UnknownConfigObject unless config.is_a?(OpenAuth2::Config)
|
180
|
-
end
|
181
157
|
end
|
182
158
|
end
|
data/lib/open_auth2/config.rb
CHANGED
@@ -5,39 +5,34 @@ module OpenAuth2
|
|
5
5
|
attr_accessor *Provider::Base::Keys
|
6
6
|
attr_reader :provider, :provider_const, :provider_string
|
7
7
|
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# Yields: self, use it to set config.
|
8
|
+
# Use to set config info.
|
11
9
|
#
|
12
10
|
# Examples:
|
13
|
-
# OpenAuth2::Config.new do
|
14
|
-
#
|
11
|
+
# OpenAuth2::Config.new do
|
12
|
+
# provider = :default
|
15
13
|
# end
|
16
14
|
#
|
17
|
-
|
18
|
-
#
|
19
|
-
def initialize
|
15
|
+
def initialize(&blk)
|
20
16
|
set_default_as_provider
|
21
|
-
|
22
|
-
yield self if block_given?
|
17
|
+
instance_eval(&blk) if block_given?
|
23
18
|
end
|
24
19
|
|
25
|
-
#
|
20
|
+
# Use to set config info.
|
26
21
|
#
|
27
22
|
# Examples:
|
28
23
|
# config = OpenAuth2::Config.new
|
29
24
|
#
|
30
|
-
# config.configure do
|
31
|
-
#
|
25
|
+
# config.configure do
|
26
|
+
# provider = :google
|
32
27
|
# end
|
33
28
|
#
|
34
29
|
# Returns: self.
|
35
30
|
#
|
36
|
-
def configure
|
37
|
-
|
31
|
+
def configure(&blk)
|
32
|
+
instance_eval(&blk) if block_given?
|
38
33
|
end
|
39
34
|
|
40
|
-
# Finds provider's module & copies its Options key/
|
35
|
+
# Finds provider's module & copies its Options key/value pairs.
|
41
36
|
#
|
42
37
|
# Accepts:
|
43
38
|
# name - String/Symbol/Constant.
|
@@ -47,7 +42,7 @@ module OpenAuth2
|
|
47
42
|
copy_provider_keys
|
48
43
|
end
|
49
44
|
|
50
|
-
# Removes all overwritten config &
|
45
|
+
# Removes all overwritten config & reset to default.
|
51
46
|
def reset_provider
|
52
47
|
remove_instance_vars
|
53
48
|
set_default_as_provider
|
@@ -18,20 +18,19 @@ module OpenAuth2
|
|
18
18
|
# config = OpenAuth2::Config.new
|
19
19
|
# client = OpenAuth2::Client.new(config)
|
20
20
|
#
|
21
|
-
# client.connection do
|
22
|
-
#
|
21
|
+
# client.connection do
|
22
|
+
# response :logger
|
23
23
|
# end
|
24
24
|
#
|
25
25
|
# Returns: Faraday object.
|
26
26
|
#
|
27
|
-
def connection
|
27
|
+
def connection(&blk)
|
28
28
|
@connection ||= Faraday.new(:url => @faraday_url) do |builder|
|
29
29
|
builder.request :url_encoded
|
30
30
|
builder.adapter :net_http
|
31
|
+
builder.instance_eval(&blk) if block_given?
|
31
32
|
end
|
32
33
|
|
33
|
-
yield @connection if block_given?
|
34
|
-
|
35
34
|
@connection
|
36
35
|
end
|
37
36
|
end
|
data/lib/open_auth2/token.rb
CHANGED
@@ -5,24 +5,14 @@ module OpenAuth2
|
|
5
5
|
extend DelegateToConfig
|
6
6
|
include Connection
|
7
7
|
|
8
|
-
#
|
9
|
-
# this is not part of public api. This will be called from
|
10
|
-
# Client#token internally only.
|
11
|
-
#
|
12
|
-
# Accepts:
|
13
|
-
# config: OpenAuth2::Config object
|
14
|
-
#
|
15
|
-
# Returns: self.
|
16
|
-
#
|
8
|
+
# Called internally from Client#token only.
|
17
9
|
def initialize(config)
|
18
10
|
@config = config
|
19
11
|
@faraday_url = authorize_url
|
20
|
-
|
21
|
-
self
|
22
12
|
end
|
23
13
|
|
24
|
-
# Packages
|
25
|
-
#
|
14
|
+
# Packages info from config & passed in arguments into an url that
|
15
|
+
# user can to visit to authorize this app.
|
26
16
|
#
|
27
17
|
# Examples:
|
28
18
|
# token.build_code_url
|
@@ -32,8 +22,7 @@ module OpenAuth2
|
|
32
22
|
# token.build_code_url(:scope => 'publish_stream')
|
33
23
|
#
|
34
24
|
# Accepts:
|
35
|
-
# params: (optional) Hash of additional config
|
36
|
-
# the url.
|
25
|
+
# params: (optional) Hash of additional config.
|
37
26
|
#
|
38
27
|
# Returns: String (url).
|
39
28
|
#
|
@@ -46,7 +35,7 @@ module OpenAuth2
|
|
46
35
|
end
|
47
36
|
|
48
37
|
# Make request to OAuth server for access token & ask @config to
|
49
|
-
# parse it. @config delegates
|
38
|
+
# parse it. @config delegates to the appropriate provider.
|
50
39
|
#
|
51
40
|
# We ask @config since the format of response differs between
|
52
41
|
# OAuth servers widely.
|
@@ -131,7 +120,7 @@ module OpenAuth2
|
|
131
120
|
}.merge(params)
|
132
121
|
end
|
133
122
|
|
134
|
-
# Makes the actual request. connection is
|
123
|
+
# Makes the actual request. `connection` is a Faraday object.
|
135
124
|
def post(body)
|
136
125
|
connection.post do |conn|
|
137
126
|
conn.headers["Content-Type"] = "application/x-www-form-urlencoded"
|
data/lib/open_auth2/version.rb
CHANGED
data/open_auth2.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
|
32
32
|
s.add_development_dependency 'rake', '~> 0.9'
|
33
33
|
s.add_development_dependency 'rspec', '~> 2.8'
|
34
|
-
s.add_development_dependency 'vcr', '
|
34
|
+
s.add_development_dependency 'vcr', '1.11.3'
|
35
35
|
s.add_development_dependency 'fakeweb', '~> 1.3'
|
36
36
|
s.add_development_dependency 'timecop', '~> 0.3'
|
37
37
|
|
data/spec/client_spec.rb
CHANGED
@@ -3,65 +3,45 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
describe OpenAuth2::Client do
|
5
5
|
let(:config) do
|
6
|
-
OpenAuth2::Config.new do
|
7
|
-
|
8
|
-
|
6
|
+
OpenAuth2::Config.new do
|
7
|
+
self.provider = :facebook
|
8
|
+
self.access_token = :access_token
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
+
subject do
|
13
|
+
described_class.new(config)
|
14
|
+
end
|
15
|
+
|
12
16
|
context '#initialize' do
|
13
|
-
it 'accepts config as argument' do
|
14
|
-
subject = described_class.new(config)
|
17
|
+
it 'accepts config as an argument' do
|
15
18
|
subject.config.should == config
|
16
19
|
end
|
17
20
|
|
18
21
|
it 'accepts config via block' do
|
19
|
-
|
20
|
-
|
22
|
+
rspec = self
|
23
|
+
subject = described_class.new do
|
24
|
+
self.config = rspec.config
|
21
25
|
end
|
22
|
-
end
|
23
26
|
|
24
|
-
|
25
|
-
expect do
|
26
|
-
subject = described_class.new
|
27
|
-
end.to raise_error(OpenAuth2::NoConfigObject)
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'raises UnknownConfigObject' do
|
31
|
-
expect do
|
32
|
-
subject = described_class.new('string')
|
33
|
-
end.to raise_error(OpenAuth2::UnknownConfigObject)
|
27
|
+
subject.config.should == config
|
34
28
|
end
|
35
29
|
|
36
|
-
it 'sets
|
30
|
+
it 'sets endpoint to make requests' do
|
37
31
|
subject.faraday_url.should == 'https://graph.facebook.com'
|
38
32
|
end
|
39
33
|
end
|
40
34
|
|
41
35
|
context '#configure' do
|
42
36
|
it 'accepts a block to set/overwrite config' do
|
43
|
-
subject.configure do
|
44
|
-
|
45
|
-
|
37
|
+
subject.configure do
|
38
|
+
self.access_token = :access_token
|
39
|
+
self.refresh_token = :refresh_token
|
46
40
|
end
|
47
41
|
|
48
42
|
subject.access_token.should == :access_token
|
49
43
|
subject.refresh_token.should == :refresh_token
|
50
44
|
end
|
51
|
-
|
52
|
-
it 'raises NoConfigObject' do
|
53
|
-
expect do
|
54
|
-
subject = described_class.new(config)
|
55
|
-
subject.configure {|c| c.config = nil }
|
56
|
-
end.to raise_error(OpenAuth2::NoConfigObject)
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'raises UnknownConfigObject' do
|
60
|
-
expect do
|
61
|
-
subject = described_class.new(config)
|
62
|
-
subject.configure {|c| c.config = 'string' }
|
63
|
-
end.to raise_error(OpenAuth2::UnknownConfigObject)
|
64
|
-
end
|
65
45
|
end
|
66
46
|
|
67
47
|
context '#token' do
|
@@ -97,14 +77,17 @@ describe OpenAuth2::Client do
|
|
97
77
|
end
|
98
78
|
|
99
79
|
context OpenAuth2::Connection do
|
100
|
-
it 'returns Faraday
|
80
|
+
it 'returns Faraday object' do
|
101
81
|
subject.connection.should be_a(Faraday::Connection)
|
102
82
|
end
|
103
83
|
|
104
|
-
it '
|
105
|
-
subject.connection do
|
106
|
-
|
84
|
+
it 'allows adding custom middleware to Faraday' do
|
85
|
+
subject.connection do
|
86
|
+
response :logger
|
107
87
|
end
|
88
|
+
|
89
|
+
subject.connection.builder.handlers.should
|
90
|
+
include(Faraday::Response::Logger)
|
108
91
|
end
|
109
92
|
end
|
110
93
|
end
|
data/spec/config_spec.rb
CHANGED
@@ -11,8 +11,8 @@ describe OpenAuth2::Config do
|
|
11
11
|
|
12
12
|
context '#initialize' do
|
13
13
|
subject do
|
14
|
-
described_class.new do
|
15
|
-
|
14
|
+
described_class.new do
|
15
|
+
self.client_id = :set_in_new
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -27,8 +27,8 @@ describe OpenAuth2::Config do
|
|
27
27
|
|
28
28
|
context '#configure' do
|
29
29
|
it 'accepts a block to set/overwrite config' do
|
30
|
-
subject.configure do
|
31
|
-
|
30
|
+
subject.configure do
|
31
|
+
self.client_id = :set_in_configure
|
32
32
|
end
|
33
33
|
|
34
34
|
subject.client_id.should == :set_in_configure
|
@@ -85,8 +85,8 @@ describe OpenAuth2::Config do
|
|
85
85
|
end
|
86
86
|
|
87
87
|
let(:overwrite_response_type) do
|
88
|
-
subject.configure do
|
89
|
-
|
88
|
+
subject.configure do
|
89
|
+
self.response_type = :overwritten
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
data/spec/google/client_spec.rb
CHANGED
@@ -3,12 +3,12 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
describe 'Google Client' do
|
5
5
|
let(:config) do
|
6
|
-
OpenAuth2::Config.new do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
OpenAuth2::Config.new do
|
7
|
+
self.provider = :google
|
8
|
+
self.access_token = Creds::Google::AccessToken
|
9
|
+
self.refresh_token = Creds::Google::RefreshToken
|
10
|
+
self.redirect_uri = 'http://localhost:9393/google/callback'
|
11
|
+
self.path_prefix = '/calendar/v3'
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
data/spec/google/token_spec.rb
CHANGED
@@ -3,13 +3,13 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
describe 'Google Token' do
|
5
5
|
let(:config) do
|
6
|
-
OpenAuth2::Config.new do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
OpenAuth2::Config.new do
|
7
|
+
self.provider = :google
|
8
|
+
self.client_id = Creds::Google::ClientId
|
9
|
+
self.client_secret = Creds::Google::ClientSecret
|
10
|
+
self.code = Creds::Google::Code
|
11
|
+
self.redirect_uri = 'http://localhost:9393/google/callback'
|
12
|
+
self.scope = ['https://www.googleapis.com/auth/calendar']
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
data/spec/token_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: OpenAuth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-04-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
16
|
-
requirement: &
|
16
|
+
requirement: &70097461613900 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0.7'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70097461613900
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activesupport
|
27
|
-
requirement: &
|
27
|
+
requirement: &70097461612320 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '3.2'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70097461612320
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: json
|
38
|
-
requirement: &
|
38
|
+
requirement: &70097461607360 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70097461607360
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rake
|
49
|
-
requirement: &
|
49
|
+
requirement: &70097461606500 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0.9'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70097461606500
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rspec
|
60
|
-
requirement: &
|
60
|
+
requirement: &70097461605800 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,21 +65,21 @@ dependencies:
|
|
65
65
|
version: '2.8'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70097461605800
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: vcr
|
71
|
-
requirement: &
|
71
|
+
requirement: &70097461605280 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - =
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: 1.11.3
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70097461605280
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: fakeweb
|
82
|
-
requirement: &
|
82
|
+
requirement: &70097461603840 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '1.3'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70097461603840
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: timecop
|
93
|
-
requirement: &
|
93
|
+
requirement: &70097461602600 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
version: '0.3'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70097461602600
|
102
102
|
description: OpenAuth2 is a thin OAuth2 wrapper written on top of Faraday in Ruby.
|
103
103
|
email:
|
104
104
|
- senthil196@gmail.com
|
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
164
|
version: '0'
|
165
165
|
requirements: []
|
166
166
|
rubyforge_project: OpenAuth2
|
167
|
-
rubygems_version: 1.8.
|
167
|
+
rubygems_version: 1.8.16
|
168
168
|
signing_key:
|
169
169
|
specification_version: 3
|
170
170
|
summary: OpenAuth2 is a thin OAuth2 wrapper written on top of Faraday in Ruby. The
|
@@ -188,3 +188,4 @@ test_files:
|
|
188
188
|
- spec/google/token_spec.rb
|
189
189
|
- spec/spec_helper.rb
|
190
190
|
- spec/token_spec.rb
|
191
|
+
has_rdoc:
|