signet 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/lib/compat/multi_json.rb +17 -0
- data/lib/signet/oauth_2.rb +2 -1
- data/lib/signet/version.rb +1 -1
- data/spec/signet/oauth_2/client_spec.rb +7 -7
- metadata +3 -2
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
gem 'multi_json', '>= 1.0.0'
|
2
|
+
require 'multi_json'
|
3
|
+
|
4
|
+
unless MultiJson.respond_to?(:load)
|
5
|
+
module MultiJson
|
6
|
+
class <<self
|
7
|
+
alias :load :decode
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
unless MultiJson.respond_to?(:dump)
|
12
|
+
module MultiJson
|
13
|
+
class <<self
|
14
|
+
alias :dump :encode
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/signet/oauth_2.rb
CHANGED
@@ -15,6 +15,7 @@
|
|
15
15
|
require 'base64'
|
16
16
|
require 'signet'
|
17
17
|
require 'multi_json'
|
18
|
+
require 'compat/multi_json'
|
18
19
|
require 'signet/ssl_config'
|
19
20
|
|
20
21
|
module Signet #:nodoc:
|
@@ -77,7 +78,7 @@ module Signet #:nodoc:
|
|
77
78
|
if !body.kind_of?(String)
|
78
79
|
raise TypeError, "Expected String, got #{body.class}."
|
79
80
|
end
|
80
|
-
return MultiJson.
|
81
|
+
return MultiJson.load(body)
|
81
82
|
end
|
82
83
|
|
83
84
|
##
|
data/lib/signet/version.rb
CHANGED
@@ -309,7 +309,7 @@ describe Signet::OAuth2::Client, 'configured for Google userinfo API' do
|
|
309
309
|
@client.redirect_uri = 'https://www.example.com/'
|
310
310
|
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
|
311
311
|
stub.post('/o/oauth2/token') do
|
312
|
-
[200, {}, MultiJson.
|
312
|
+
[200, {}, MultiJson.dump({
|
313
313
|
'access_token' => '12345',
|
314
314
|
'refresh_token' => '54321',
|
315
315
|
'expires_in' => '3600'
|
@@ -335,7 +335,7 @@ describe Signet::OAuth2::Client, 'configured for Google userinfo API' do
|
|
335
335
|
@client.password = 'incognito'
|
336
336
|
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
|
337
337
|
stub.post('/o/oauth2/token') do
|
338
|
-
[200, {}, MultiJson.
|
338
|
+
[200, {}, MultiJson.dump({
|
339
339
|
'access_token' => '12345',
|
340
340
|
'refresh_token' => '54321',
|
341
341
|
'expires_in' => '3600'
|
@@ -360,7 +360,7 @@ describe Signet::OAuth2::Client, 'configured for Google userinfo API' do
|
|
360
360
|
@client.refresh_token = '54321'
|
361
361
|
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
|
362
362
|
stub.post('/o/oauth2/token') do
|
363
|
-
[200, {}, MultiJson.
|
363
|
+
[200, {}, MultiJson.dump({
|
364
364
|
'access_token' => '12345',
|
365
365
|
'refresh_token' => '54321',
|
366
366
|
'expires_in' => '3600'
|
@@ -546,7 +546,7 @@ JSON
|
|
546
546
|
@client.client_secret = 'secret-12345'
|
547
547
|
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
|
548
548
|
stub.post('/o/oauth2/token') do
|
549
|
-
[200, {}, MultiJson.
|
549
|
+
[200, {}, MultiJson.dump({
|
550
550
|
'access_token' => '12345',
|
551
551
|
'refresh_token' => '54321',
|
552
552
|
'expires_in' => '3600',
|
@@ -587,7 +587,7 @@ JSON
|
|
587
587
|
@client.client_secret = 'secret-12345'
|
588
588
|
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
|
589
589
|
stub.post('/o/oauth2/token') do
|
590
|
-
[200, {}, MultiJson.
|
590
|
+
[200, {}, MultiJson.dump({
|
591
591
|
'access_token' => '12345',
|
592
592
|
'refresh_token' => '54321',
|
593
593
|
'expires_in' => '3600',
|
@@ -622,7 +622,7 @@ JSON
|
|
622
622
|
@client.client_secret = 'secret-12345'
|
623
623
|
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
|
624
624
|
stub.post('/o/oauth2/token') do
|
625
|
-
[200, {}, MultiJson.
|
625
|
+
[200, {}, MultiJson.dump({
|
626
626
|
'access_token' => '12345',
|
627
627
|
'refresh_token' => '54321',
|
628
628
|
'expires_in' => '3600',
|
@@ -655,7 +655,7 @@ JSON
|
|
655
655
|
@client.client_secret = 'secret-12345'
|
656
656
|
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
|
657
657
|
stub.post('/o/oauth2/token') do
|
658
|
-
[200, {}, MultiJson.
|
658
|
+
[200, {}, MultiJson.dump({
|
659
659
|
'access_token' => '12345',
|
660
660
|
'refresh_token' => '54321',
|
661
661
|
'expires_in' => '3600',
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: signet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.4.
|
5
|
+
version: 0.4.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Bob Aman
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-08-30 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: addressable
|
@@ -101,6 +101,7 @@ extra_rdoc_files:
|
|
101
101
|
- README.md
|
102
102
|
files:
|
103
103
|
- lib/compat/digest/hmac.rb
|
104
|
+
- lib/compat/multi_json.rb
|
104
105
|
- lib/compat/securerandom.rb
|
105
106
|
- lib/signet/errors.rb
|
106
107
|
- lib/signet/oauth_1/client.rb
|