oauth2 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9924e71401dd6ab5d22d1472dbdc7505452938ef
4
- data.tar.gz: 117bb2eb9de7facad9c2c090d492a350309d62e9
3
+ metadata.gz: 1f08c4d28879362b39b7c95041febcf876970cc6
4
+ data.tar.gz: 22b630f65b3bae6df564836c8c67dfe81172c309
5
5
  SHA512:
6
- metadata.gz: 6a5bfc4ac23428a81c0c30418d8180cfebe7cef9fb0071fdfe94753acc34c6a54f4bb9733a36e6bbfddb360b3f33fbd7bec2513c94f590a20064348384195a75
7
- data.tar.gz: f429aed04aedecaffea86c0e1690767994bb4af758ec6243177f426ac660cb36b506154ce89c7e291fd726a57c2555e7ff9528ff7500a53862cfe9f41c45451f
6
+ metadata.gz: cf71ffafcd8e2fc3abc2efca44cbafabec97b35a61cdf76ddbc0297f1fb9bbf72bb8ba6432cd443324a052bb837c1fec89080684877f655a410d8f1f988b429b
7
+ data.tar.gz: 0933fed7b3e4c8a4f58c5dab2f8bd71ff0252999023a4825d0e7249aeb6e0f2c77164669f3278ac2f358f47939c2f1779e02cf4170a5c119a7c753803ae38b40
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # OAuth2
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/oauth2.png)][gem]
4
- [![Build Status](https://secure.travis-ci.org/intridea/oauth2.png?branch=master)][travis]
5
- [![Dependency Status](https://gemnasium.com/intridea/oauth2.png?travis)][gemnasium]
6
- [![Code Climate](https://codeclimate.com/github/intridea/oauth2.png)][codeclimate]
7
- [![Coverage Status](https://coveralls.io/repos/intridea/oauth2/badge.png?branch=master)][coveralls]
3
+ [![Gem Version](http://img.shields.io/gem/v/oauth2.svg)][gem]
4
+ [![Build Status](http://img.shields.io/travis/intridea/oauth2.svg)][travis]
5
+ [![Dependency Status](http://img.shields.io/gemnasium/intridea/oauth2.svg)][gemnasium]
6
+ [![Code Climate](http://img.shields.io/codeclimate/github/intridea/oauth2.svg)][codeclimate]
7
+ [![Coverage Status](http://img.shields.io/coveralls/intridea/oauth2.svg)][coveralls]
8
8
 
9
9
  [gem]: https://rubygems.org/gems/oauth2
10
10
  [travis]: http://travis-ci.org/intridea/oauth2
@@ -63,7 +63,7 @@ module OAuth2
63
63
  #
64
64
  # @return [Boolean]
65
65
  def expires?
66
- !!@expires_at
66
+ !!@expires_at # rubocop:disable DoubleNegation
67
67
  end
68
68
 
69
69
  # Whether or not the token is expired
data/lib/oauth2/client.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'faraday'
2
+ require 'logger'
2
3
 
3
4
  module OAuth2
4
5
  # The OAuth2::Client class
@@ -23,19 +24,19 @@ module OAuth2
23
24
  # @option opts [Boolean] :raise_errors (true) whether or not to raise an OAuth2::Error
24
25
  # on responses with 400+ status codes
25
26
  # @yield [builder] The Faraday connection builder
26
- def initialize(client_id, client_secret, opts = {}, &block)
27
- _opts = opts.dup
27
+ def initialize(client_id, client_secret, options = {}, &block)
28
+ opts = options.dup
28
29
  @id = client_id
29
30
  @secret = client_secret
30
- @site = _opts.delete(:site)
31
- ssl = _opts.delete(:ssl)
31
+ @site = opts.delete(:site)
32
+ ssl = opts.delete(:ssl)
32
33
  @options = {:authorize_url => '/oauth/authorize',
33
34
  :token_url => '/oauth/token',
34
35
  :token_method => :post,
35
36
  :connection_opts => {},
36
37
  :connection_build => block,
37
38
  :max_redirects => 5,
38
- :raise_errors => true}.merge(_opts)
39
+ :raise_errors => true}.merge(opts)
39
40
  @options[:connection_opts][:ssl] = ssl if ssl
40
41
  end
41
42
 
@@ -85,6 +86,8 @@ module OAuth2
85
86
  # @option opts [Symbol] :parse @see Response::initialize
86
87
  # @yield [req] The Faraday request
87
88
  def request(verb, url, opts = {}) # rubocop:disable CyclomaticComplexity, MethodLength
89
+ connection.response :logger, ::Logger.new($stdout) if ENV['OAUTH_DEBUG'] == 'true'
90
+
88
91
  url = connection.build_url(url, opts[:params]).to_s
89
92
 
90
93
  response = connection.run_request(verb, url, opts[:body], opts[:headers]) do |req|
@@ -2,7 +2,7 @@ module OAuth2
2
2
  class Version
3
3
  MAJOR = 0
4
4
  MINOR = 9
5
- PATCH = 3
5
+ PATCH = 4
6
6
  PRE = nil
7
7
 
8
8
  class << self
data/oauth2.gemspec CHANGED
@@ -4,26 +4,24 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'oauth2/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.add_development_dependency 'bundler', '~> 1.0'
8
7
  spec.add_dependency 'faraday', ['>= 0.8', '< 0.10']
8
+ spec.add_dependency 'jwt', '~> 1.0'
9
9
  spec.add_dependency 'multi_json', '~> 1.3'
10
10
  spec.add_dependency 'multi_xml', '~> 0.5'
11
11
  spec.add_dependency 'rack', '~> 1.2'
12
- spec.add_dependency 'jwt', '~> 0.1.8'
12
+ spec.add_development_dependency 'bundler', '~> 1.0'
13
13
  spec.authors = ['Michael Bleigh', 'Erik Michaels-Ober']
14
- spec.cert_chain = %w(certs/sferik.pem)
15
- spec.description = %q{A Ruby wrapper for the OAuth 2.0 protocol built with a similar style to the original OAuth spec.}
14
+ spec.description = %q(A Ruby wrapper for the OAuth 2.0 protocol built with a similar style to the original OAuth spec.)
16
15
  spec.email = ['michael@intridea.com', 'sferik@gmail.com']
17
16
  spec.files = %w(.document CONTRIBUTING.md LICENSE.md README.md Rakefile oauth2.gemspec)
18
17
  spec.files += Dir.glob('lib/**/*.rb')
19
18
  spec.files += Dir.glob('spec/**/*')
20
19
  spec.homepage = 'http://github.com/intridea/oauth2'
21
- spec.licenses = ['MIT']
20
+ spec.licenses = %w(MIT)
22
21
  spec.name = 'oauth2'
23
- spec.require_paths = ['lib']
22
+ spec.require_paths = %w(lib)
24
23
  spec.required_rubygems_version = '>= 1.3.5'
25
- spec.signing_key = File.expand_path('~/.gem/private_key.pem') if $PROGRAM_NAME =~ /gem\z/
26
- spec.summary = %q{A Ruby wrapper for the OAuth 2.0 protocol.}
24
+ spec.summary = %q(A Ruby wrapper for the OAuth 2.0 protocol.)
27
25
  spec.test_files = Dir.glob('spec/**/*')
28
26
  spec.version = OAuth2::Version
29
27
  end
data/spec/helper.rb CHANGED
@@ -27,3 +27,15 @@ Faraday.default_adapter = :test
27
27
  RSpec.configure do |conf|
28
28
  include OAuth2
29
29
  end
30
+
31
+ def capture_output(&block)
32
+ begin
33
+ old_stdout = $stdout
34
+ $stdout = StringIO.new
35
+ block.call
36
+ result = $stdout.string
37
+ ensure
38
+ $stdout = old_stdout
39
+ end
40
+ result
41
+ end
@@ -25,7 +25,7 @@ describe AccessToken do
25
25
  describe '#initialize' do
26
26
  it 'assigns client and token' do
27
27
  expect(subject.client).to eq(client)
28
- expect(subject.token).to eq(token)
28
+ expect(subject.token).to eq(token)
29
29
  end
30
30
 
31
31
  it 'assigns extra params' do
@@ -119,6 +119,16 @@ describe OAuth2::Client do
119
119
  expect(response.headers).to eq('Content-Type' => 'text/awesome')
120
120
  end
121
121
 
122
+ it 'outputs to $stdout when OAUTH_DEBUG=true' do
123
+ ENV.stub(:[]).with('http_proxy').and_return(nil)
124
+ ENV.stub(:[]).with('OAUTH_DEBUG').and_return('true')
125
+ output = capture_output do
126
+ subject.request(:get, '/success')
127
+ end
128
+
129
+ expect(output).to include 'INFO -- : get https://api.example.com/success', 'INFO -- : get https://api.example.com/success'
130
+ end
131
+
122
132
  it 'posts a body' do
123
133
  response = subject.request(:post, '/reflect', :body => 'foo=bar')
124
134
  expect(response.body).to eq('foo=bar')
metadata CHANGED
@@ -1,127 +1,106 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oauth2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh
8
8
  - Erik Michaels-Ober
9
9
  autorequire:
10
10
  bindir: bin
11
- cert_chain:
12
- - |
13
- -----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LqWvQRsBlypHfhs6JJuLlyZPGhU3R/v
30
- Sf3lVKpBCWgRpGTvy45XVpB+59y33PJmEuQ1PTEOYvQyao9UKMAAaAN/7qWQtjl0
31
- hlw=
32
- -----END CERTIFICATE-----
33
- date: 2014-01-16 00:00:00.000000000 Z
11
+ cert_chain: []
12
+ date: 2014-05-24 00:00:00.000000000 Z
34
13
  dependencies:
35
14
  - !ruby/object:Gem::Dependency
36
- name: bundler
15
+ name: faraday
37
16
  requirement: !ruby/object:Gem::Requirement
38
17
  requirements:
39
- - - "~>"
18
+ - - '>='
40
19
  - !ruby/object:Gem::Version
41
- version: '1.0'
42
- type: :development
20
+ version: '0.8'
21
+ - - <
22
+ - !ruby/object:Gem::Version
23
+ version: '0.10'
24
+ type: :runtime
43
25
  prerelease: false
44
26
  version_requirements: !ruby/object:Gem::Requirement
45
27
  requirements:
46
- - - "~>"
28
+ - - '>='
47
29
  - !ruby/object:Gem::Version
48
- version: '1.0'
30
+ version: '0.8'
31
+ - - <
32
+ - !ruby/object:Gem::Version
33
+ version: '0.10'
49
34
  - !ruby/object:Gem::Dependency
50
- name: faraday
35
+ name: jwt
51
36
  requirement: !ruby/object:Gem::Requirement
52
37
  requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: '0.8'
56
- - - "<"
38
+ - - ~>
57
39
  - !ruby/object:Gem::Version
58
- version: '0.10'
40
+ version: '1.0'
59
41
  type: :runtime
60
42
  prerelease: false
61
43
  version_requirements: !ruby/object:Gem::Requirement
62
44
  requirements:
63
- - - ">="
64
- - !ruby/object:Gem::Version
65
- version: '0.8'
66
- - - "<"
45
+ - - ~>
67
46
  - !ruby/object:Gem::Version
68
- version: '0.10'
47
+ version: '1.0'
69
48
  - !ruby/object:Gem::Dependency
70
49
  name: multi_json
71
50
  requirement: !ruby/object:Gem::Requirement
72
51
  requirements:
73
- - - "~>"
52
+ - - ~>
74
53
  - !ruby/object:Gem::Version
75
54
  version: '1.3'
76
55
  type: :runtime
77
56
  prerelease: false
78
57
  version_requirements: !ruby/object:Gem::Requirement
79
58
  requirements:
80
- - - "~>"
59
+ - - ~>
81
60
  - !ruby/object:Gem::Version
82
61
  version: '1.3'
83
62
  - !ruby/object:Gem::Dependency
84
63
  name: multi_xml
85
64
  requirement: !ruby/object:Gem::Requirement
86
65
  requirements:
87
- - - "~>"
66
+ - - ~>
88
67
  - !ruby/object:Gem::Version
89
68
  version: '0.5'
90
69
  type: :runtime
91
70
  prerelease: false
92
71
  version_requirements: !ruby/object:Gem::Requirement
93
72
  requirements:
94
- - - "~>"
73
+ - - ~>
95
74
  - !ruby/object:Gem::Version
96
75
  version: '0.5'
97
76
  - !ruby/object:Gem::Dependency
98
77
  name: rack
99
78
  requirement: !ruby/object:Gem::Requirement
100
79
  requirements:
101
- - - "~>"
80
+ - - ~>
102
81
  - !ruby/object:Gem::Version
103
82
  version: '1.2'
104
83
  type: :runtime
105
84
  prerelease: false
106
85
  version_requirements: !ruby/object:Gem::Requirement
107
86
  requirements:
108
- - - "~>"
87
+ - - ~>
109
88
  - !ruby/object:Gem::Version
110
89
  version: '1.2'
111
90
  - !ruby/object:Gem::Dependency
112
- name: jwt
91
+ name: bundler
113
92
  requirement: !ruby/object:Gem::Requirement
114
93
  requirements:
115
- - - "~>"
94
+ - - ~>
116
95
  - !ruby/object:Gem::Version
117
- version: 0.1.8
118
- type: :runtime
96
+ version: '1.0'
97
+ type: :development
119
98
  prerelease: false
120
99
  version_requirements: !ruby/object:Gem::Requirement
121
100
  requirements:
122
- - - "~>"
101
+ - - ~>
123
102
  - !ruby/object:Gem::Version
124
- version: 0.1.8
103
+ version: '1.0'
125
104
  description: A Ruby wrapper for the OAuth 2.0 protocol built with a similar style
126
105
  to the original OAuth spec.
127
106
  email:
@@ -131,34 +110,34 @@ executables: []
131
110
  extensions: []
132
111
  extra_rdoc_files: []
133
112
  files:
134
- - ".document"
113
+ - .document
135
114
  - CONTRIBUTING.md
136
115
  - LICENSE.md
137
116
  - README.md
138
117
  - Rakefile
118
+ - oauth2.gemspec
139
119
  - lib/oauth2.rb
140
120
  - lib/oauth2/access_token.rb
141
121
  - lib/oauth2/client.rb
142
122
  - lib/oauth2/error.rb
143
123
  - lib/oauth2/response.rb
124
+ - lib/oauth2/version.rb
125
+ - lib/oauth2/strategy/implicit.rb
126
+ - lib/oauth2/strategy/password.rb
144
127
  - lib/oauth2/strategy/assertion.rb
145
128
  - lib/oauth2/strategy/auth_code.rb
146
129
  - lib/oauth2/strategy/base.rb
147
130
  - lib/oauth2/strategy/client_credentials.rb
148
- - lib/oauth2/strategy/implicit.rb
149
- - lib/oauth2/strategy/password.rb
150
- - lib/oauth2/version.rb
151
- - oauth2.gemspec
152
131
  - spec/helper.rb
153
132
  - spec/oauth2/access_token_spec.rb
154
133
  - spec/oauth2/client_spec.rb
155
134
  - spec/oauth2/response_spec.rb
156
- - spec/oauth2/strategy/assertion_spec.rb
157
135
  - spec/oauth2/strategy/auth_code_spec.rb
158
- - spec/oauth2/strategy/base_spec.rb
159
- - spec/oauth2/strategy/client_credentials_spec.rb
160
- - spec/oauth2/strategy/implicit_spec.rb
161
136
  - spec/oauth2/strategy/password_spec.rb
137
+ - spec/oauth2/strategy/implicit_spec.rb
138
+ - spec/oauth2/strategy/client_credentials_spec.rb
139
+ - spec/oauth2/strategy/assertion_spec.rb
140
+ - spec/oauth2/strategy/base_spec.rb
162
141
  homepage: http://github.com/intridea/oauth2
163
142
  licenses:
164
143
  - MIT
@@ -169,17 +148,17 @@ require_paths:
169
148
  - lib
170
149
  required_ruby_version: !ruby/object:Gem::Requirement
171
150
  requirements:
172
- - - ">="
151
+ - - '>='
173
152
  - !ruby/object:Gem::Version
174
153
  version: '0'
175
154
  required_rubygems_version: !ruby/object:Gem::Requirement
176
155
  requirements:
177
- - - ">="
156
+ - - '>='
178
157
  - !ruby/object:Gem::Version
179
158
  version: 1.3.5
180
159
  requirements: []
181
160
  rubyforge_project:
182
- rubygems_version: 2.2.0
161
+ rubygems_version: 2.0.14
183
162
  signing_key:
184
163
  specification_version: 4
185
164
  summary: A Ruby wrapper for the OAuth 2.0 protocol.
@@ -188,10 +167,10 @@ test_files:
188
167
  - spec/oauth2/access_token_spec.rb
189
168
  - spec/oauth2/client_spec.rb
190
169
  - spec/oauth2/response_spec.rb
191
- - spec/oauth2/strategy/assertion_spec.rb
192
170
  - spec/oauth2/strategy/auth_code_spec.rb
193
- - spec/oauth2/strategy/base_spec.rb
194
- - spec/oauth2/strategy/client_credentials_spec.rb
195
- - spec/oauth2/strategy/implicit_spec.rb
196
171
  - spec/oauth2/strategy/password_spec.rb
172
+ - spec/oauth2/strategy/implicit_spec.rb
173
+ - spec/oauth2/strategy/client_credentials_spec.rb
174
+ - spec/oauth2/strategy/assertion_spec.rb
175
+ - spec/oauth2/strategy/base_spec.rb
197
176
  has_rdoc:
checksums.yaml.gz.sig DELETED
Binary file
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
@@ -1,3 +0,0 @@
1
- uHF�3,��"߅v�ϟ2{>�t�A�j�O�B'���=G)�/��I �5/!�v�u�$���2R��[B<z���~苮�N�Cj�m�j�eh����vK��0hl�#ć:DH-�#Lm�zZX�!�ER� 1�I��b8iW�� m�Qa��
2
- 0�y�3CTM���M�P�0}K��y���Ԭ�� �����T� 7�"��WL�I%��/�M
3
- ��a_���?����hI�Fϸs�˿Y=�l�#kA�.8�ߒMB�E�~�S