signet 0.2.1 → 0.2.2
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/CHANGELOG +4 -0
- data/README.md +50 -0
- data/lib/signet/oauth_2/client.rb +4 -10
- data/lib/signet/version.rb +1 -1
- data/tasks/gem.rake +3 -3
- data/tasks/rdoc.rake +1 -1
- data/tasks/yard.rake +1 -1
- metadata +12 -12
- data/README +0 -46
data/CHANGELOG
CHANGED
data/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Signet
|
2
|
+
|
3
|
+
<dl>
|
4
|
+
<dt>Homepage</dt><dd><a href="http://signet.rubyforge.org/">signet.rubyforge.org</a></dd>
|
5
|
+
<dt>Author</dt><dd><a href="mailto:bobaman@google.com">Bob Aman</a></dd>
|
6
|
+
<dt>Copyright</dt><dd>Copyright © 2010 Google, Inc.</dd>
|
7
|
+
<dt>License</dt><dd>Apache 2.0</dd>
|
8
|
+
</dl>
|
9
|
+
|
10
|
+
## Description
|
11
|
+
|
12
|
+
Signet is an OAuth 1.0 / OAuth 2.0 implementation.
|
13
|
+
|
14
|
+
## Reference
|
15
|
+
|
16
|
+
- {Signet::OAuth1}
|
17
|
+
- {Signet::OAuth1::Client}
|
18
|
+
- {Signet::OAuth1::Credential}
|
19
|
+
- {Signet::OAuth2}
|
20
|
+
- {Signet::OAuth2::Client}
|
21
|
+
|
22
|
+
## Example Usage for Google
|
23
|
+
|
24
|
+
require 'signet/oauth_1/client'
|
25
|
+
client = Signet::OAuth1::Client.new(
|
26
|
+
:temporary_credential_uri =>
|
27
|
+
'https://www.google.com/accounts/OAuthGetRequestToken',
|
28
|
+
:authorization_uri =>
|
29
|
+
'https://www.google.com/accounts/OAuthAuthorizeToken',
|
30
|
+
:token_credential_uri =>
|
31
|
+
'https://www.google.com/accounts/OAuthGetAccessToken',
|
32
|
+
:client_credential_key => 'anonymous',
|
33
|
+
:client_credential_secret => 'anonymous'
|
34
|
+
)
|
35
|
+
client.fetch_temporary_credential!(:additional_parameters => {
|
36
|
+
:scope => 'https://mail.google.com/mail/feed/atom'
|
37
|
+
})
|
38
|
+
# Send the user to client.authorization_uri, obtain verifier
|
39
|
+
client.fetch_token_credential!(:verifier => '12345')
|
40
|
+
response = client.fetch_protected_resource(
|
41
|
+
:uri => 'https://mail.google.com/mail/feed/atom'
|
42
|
+
)
|
43
|
+
# The Rack response format is used here
|
44
|
+
status, headers, body = response
|
45
|
+
|
46
|
+
## Install
|
47
|
+
|
48
|
+
`sudo gem install signet`
|
49
|
+
|
50
|
+
Be sure `http://rubygems.org/` is in your gem sources.
|
@@ -198,19 +198,13 @@ module Signet
|
|
198
198
|
unless options[:response_type]
|
199
199
|
options[:response_type] = :code
|
200
200
|
end
|
201
|
+
options[:client_id] ||= self.client_id
|
202
|
+
options[:redirect_uri] ||= self.redirect_uri
|
201
203
|
unless options[:client_id]
|
202
|
-
|
203
|
-
options[:client_id] = self.client_id
|
204
|
-
else
|
205
|
-
raise ArgumentError, "Missing required client identifier."
|
206
|
-
end
|
204
|
+
raise ArgumentError, "Missing required client identifier."
|
207
205
|
end
|
208
206
|
unless options[:redirect_uri]
|
209
|
-
|
210
|
-
options[:redirect_uri] = self.redirect_uri
|
211
|
-
else
|
212
|
-
raise ArgumentError, "Missing required redirect URI."
|
213
|
-
end
|
207
|
+
raise ArgumentError, "Missing required redirect URI."
|
214
208
|
end
|
215
209
|
if !options[:scope] && self.scope
|
216
210
|
options[:scope] = self.scope.join(' ')
|
data/lib/signet/version.rb
CHANGED
data/tasks/gem.rake
CHANGED
@@ -19,12 +19,12 @@ namespace :gem do
|
|
19
19
|
s.files = PKG_FILES.to_a
|
20
20
|
|
21
21
|
s.has_rdoc = true
|
22
|
-
s.extra_rdoc_files = %w( README )
|
23
|
-
s.rdoc_options.concat ["--main", "README"]
|
22
|
+
s.extra_rdoc_files = %w( README.md )
|
23
|
+
s.rdoc_options.concat ["--main", "README.md"]
|
24
24
|
|
25
25
|
s.add_runtime_dependency("httpadapter", "~> 1.0.0")
|
26
26
|
s.add_runtime_dependency("addressable", "~> 2.2.1")
|
27
|
-
s.add_runtime_dependency("json", "
|
27
|
+
s.add_runtime_dependency("json", ">= 1.4.6")
|
28
28
|
|
29
29
|
s.add_development_dependency("rake", "~> 0.8.3")
|
30
30
|
s.add_development_dependency("rspec", "~> 1.1.11")
|
data/tasks/rdoc.rake
CHANGED
@@ -8,7 +8,7 @@ namespace :doc do
|
|
8
8
|
rdoc.options << "--line-numbers" << "--inline-source" <<
|
9
9
|
"--accessor" << "cattr_accessor=object" << "--charset" << "utf-8"
|
10
10
|
rdoc.template = "#{ENV["template"]}.rb" if ENV["template"]
|
11
|
-
rdoc.rdoc_files.include("README", "CHANGELOG", "LICENSE")
|
11
|
+
rdoc.rdoc_files.include("README.md", "CHANGELOG", "LICENSE")
|
12
12
|
rdoc.rdoc_files.include("lib/**/*.rb")
|
13
13
|
end
|
14
14
|
|
data/tasks/yard.rake
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: signet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Bob Aman
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-05-12 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -56,14 +56,14 @@ dependencies:
|
|
56
56
|
requirement: &id003 !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
hash:
|
61
|
+
hash: 11
|
62
62
|
segments:
|
63
63
|
- 1
|
64
|
-
-
|
65
|
-
-
|
66
|
-
version: 1.
|
64
|
+
- 4
|
65
|
+
- 6
|
66
|
+
version: 1.4.6
|
67
67
|
type: :runtime
|
68
68
|
version_requirements: *id003
|
69
69
|
- !ruby/object:Gem::Dependency
|
@@ -155,7 +155,7 @@ executables: []
|
|
155
155
|
extensions: []
|
156
156
|
|
157
157
|
extra_rdoc_files:
|
158
|
-
- README
|
158
|
+
- README.md
|
159
159
|
files:
|
160
160
|
- lib/compat/digest/hmac.rb
|
161
161
|
- lib/compat/securerandom.rb
|
@@ -192,7 +192,7 @@ files:
|
|
192
192
|
- CHANGELOG
|
193
193
|
- LICENSE
|
194
194
|
- Rakefile
|
195
|
-
- README
|
195
|
+
- README.md
|
196
196
|
has_rdoc: true
|
197
197
|
homepage: http://signet.rubyforge.org/
|
198
198
|
licenses: []
|
@@ -200,7 +200,7 @@ licenses: []
|
|
200
200
|
post_install_message:
|
201
201
|
rdoc_options:
|
202
202
|
- --main
|
203
|
-
- README
|
203
|
+
- README.md
|
204
204
|
require_paths:
|
205
205
|
- lib
|
206
206
|
required_ruby_version: !ruby/object:Gem::Requirement
|
data/README
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
== Signet
|
2
|
-
|
3
|
-
Homepage:: signet.rubyforge.org[http://signet.rubyforge.org/]
|
4
|
-
Author:: Bob Aman (mailto:bobaman@google.com)
|
5
|
-
Copyright:: Copyright © 2010 Google Inc.
|
6
|
-
License:: Apache 2.0
|
7
|
-
|
8
|
-
== Description
|
9
|
-
|
10
|
-
Signet is an OAuth 1.0 / OAuth 2.0 implementation.
|
11
|
-
|
12
|
-
== Reference
|
13
|
-
|
14
|
-
- {Signet::OAuth1}
|
15
|
-
- {Signet::OAuth1::Client}
|
16
|
-
- {Signet::OAuth1::Credential}
|
17
|
-
- {Signet::OAuth2}
|
18
|
-
- {Signet::OAuth2::Client}
|
19
|
-
|
20
|
-
== Example Usage for Google
|
21
|
-
|
22
|
-
require 'signet/oauth_1/client'
|
23
|
-
client = Signet::OAuth1::Client.new(
|
24
|
-
:temporary_credential_uri =>
|
25
|
-
'https://www.google.com/accounts/OAuthGetRequestToken',
|
26
|
-
:authorization_uri =>
|
27
|
-
'https://www.google.com/accounts/OAuthAuthorizeToken',
|
28
|
-
:token_credential_uri =>
|
29
|
-
'https://www.google.com/accounts/OAuthGetAccessToken',
|
30
|
-
:client_credential_key => 'anonymous',
|
31
|
-
:client_credential_secret => 'anonymous'
|
32
|
-
)
|
33
|
-
client.fetch_temporary_credential!(:additional_parameters => {
|
34
|
-
:scope => 'https://mail.google.com/mail/feed/atom'
|
35
|
-
})
|
36
|
-
# Send the user to client.authorization_uri, obtain verifier
|
37
|
-
client.fetch_token_credential!(:verifier => '12345')
|
38
|
-
response = client.fetch_protected_resource(
|
39
|
-
:uri => 'https://mail.google.com/mail/feed/atom'
|
40
|
-
)
|
41
|
-
# The Rack response format is used here
|
42
|
-
status, headers, body = response
|
43
|
-
|
44
|
-
== Install
|
45
|
-
|
46
|
-
* sudo gem install signet
|