wine_bouncer 0.4.0 → 0.5.0

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: 4f574523e9139e98523e7ee4fa55f53c08d523d5
4
- data.tar.gz: 57f194faf3e53dd0382c9ad5d55193510eca3646
3
+ metadata.gz: e5dc6cf97cd8da451dc4702e223895ef8936bdf3
4
+ data.tar.gz: fb785eaeb2dbaee4f862f83cad1480fc5a024c42
5
5
  SHA512:
6
- metadata.gz: 8f15e202eff6141fef5a1717ab23a542b63ab49ca8558aa98dfebb3f91b8a00512893720b1c8e0858cde16d55158334522c17997b0a9411051ad2c86af60f46f
7
- data.tar.gz: a232f4bc101f50924f4c794071c1c4411498da7a45b6558994471569441cc61b7a55ff12de8480a76c0094f6fa417f75585d101d982c572a064c76d1d39741e4
6
+ metadata.gz: 3b9613742574c2c306212a77e39709c4d493f543e11358927d70aaf2d034a40e6cdb9a90677e98bbaf3d4f0c0d4ee75c3909869e195e32e3be2e685d6cfdcc02
7
+ data.tar.gz: 46032cd2d3121fe7ecdb5f251da88a23f52e75c6d4ad8efa6307c3bd35a81fafd1d6b4b2ac6fe6e2084680ba04588b3975301d63be8040af0ccf201c4b80b0ac
@@ -1,27 +1,24 @@
1
+ sudo: false
1
2
  before_install:
2
- - gem update bundler
3
- - bundle --version
3
+ - gem update bundler
4
+ - bundle --version
4
5
  language: ruby
5
6
  cache: bundler
6
7
  rvm:
7
- - 2.0
8
- - 2.1
9
- - 2.2
8
+ - 2.0
9
+ - 2.1
10
+ - 2.2
10
11
  env:
11
- - rails=3.2.18 grape=0.10.0
12
- - rails=3.2.18 grape=0.12.0
13
- - rails=4.1.1 grape=0.12.0 doorkeeper=2.0.1
14
- - rails=4.1.1 grape=0.12.0 doorkeeper=2.1.4
15
- - rails=4.2.0 grape=0.10.0 doorkeeper=2.2.1
16
- - rails=4.2.0 grape=0.11.0 doorkeeper=2.2.1
17
- - rails=4.2.0 grape=0.12.0 doorkeeper=2.2.1
18
- matrix:
19
- exclude:
20
- - env: rails=3.2.18 grape=0.10.0
21
- rvm: 2.2
22
-
23
- - env: rails=3.2.18 grape=0.12.0
24
- rvm: 2.2
12
+ - rails=4.1.1 grape=0.12.0 doorkeeper=2.0.1
13
+ - rails=4.1.1 grape=0.12.0 doorkeeper=2.1.4
14
+ - rails=4.2.0 grape=0.10.0 doorkeeper=2.2.1
15
+ - rails=4.2.0 grape=0.11.0 doorkeeper=3.0.0
16
+ - rails=4.2.0 grape=0.12.0 doorkeeper=3.0.0
17
+ - rails=4.2.0 grape=0.13.0 doorkeeper=3.0.0
25
18
  addons:
26
19
  code_climate:
27
20
  repo_token: ab1b6ce5f973da033f80ae2e99fadbb32b2f9c37892703956d8ef954c8e8134e
21
+ notifications:
22
+ hipchat:
23
+ rooms:
24
+ secure: SUWenlDzlDbpryO1QzD+rN4MxIBpAAzwsFqnnkyRQ11thRVdvKuT2TUd+RlYImLXDNkvNjqmpXh7mihtcro9g8unR3nF1UKbuAPIv2kCklsio0jAnjVn7+h1l56hsa90Jy9t/YpKtoLx2QNWLz70n8VrtGJMAt53T6tZdgNUp58=
@@ -1,8 +1,12 @@
1
1
  Changelog
2
2
  =========
3
-
4
3
  ## Next
5
4
 
5
+ ## 0.5.0
6
+ * [#50](https://github.com/antek-drzewiecki/wine_bouncer/pull/50): Grape 0.13.x support
7
+ * [#48](https://github.com/antek-drzewiecki/wine_bouncer/pull/48): Bind Doorkeeper error response into WineBouncer errors
8
+ * [#47](https://github.com/antek-drzewiecki/wine_bouncer/pull/47): Doorkeeper 3.0.x support
9
+
6
10
  ## 0.4.0
7
11
  * [#42](https://github.com/antek-drzewiecki/wine_bouncer/pull/42): Added support for Doorkeeper 2.2
8
12
  * [#41](https://github.com/antek-drzewiecki/wine_bouncer/pull/41): Added support for Grape 0.12.0, Removed support for Grape 0.8 and 0.9 (though they still work).
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- ENV['grape'] ||= '0.12.0'
3
+ ENV['grape'] ||= '0.13.0'
4
4
  ENV['rails'] ||= '4.2.0'
5
5
  ENV['doorkeeper'] ||= '2.2.1'
6
6
 
data/README.md CHANGED
@@ -28,15 +28,15 @@ Table of Contents
28
28
 
29
29
  ## Requirements
30
30
  - Ruby > 2.0
31
- - Doorkeeper > 1.4.0 and < 3
32
- - Grape > 0.10 and < 0.13
31
+ - Doorkeeper > 1.4.0 and < 3.1
32
+ - Grape > 0.10 and < 0.14
33
33
 
34
34
  ## Installation
35
35
 
36
36
  Add this line to your application's Gemfile:
37
37
 
38
38
  ```ruby
39
- gem 'wine_bouncer', '~> 0.4.0'
39
+ gem 'wine_bouncer', '~> 0.5.0'
40
40
  ```
41
41
 
42
42
  And then execute:
@@ -215,6 +215,9 @@ This gem raises the following exceptions which can be handled in your Grape API,
215
215
  * `WineBouncer::Errors::OAuthForbiddenError`
216
216
  when the token is found but scopes do not match.
217
217
 
218
+ Detailed doorkeeper error response can be found in the error's `response` attribute. You could use
219
+ it to compose the actual HTTP response to API users.
220
+
218
221
  ## Example/Template Application
219
222
 
220
223
  A full working sample app (or starter template) can be found at [grape-doorkeeper on github](https://github.com/sethherr/grape-doorkeeper). It has one click deploy to Heroku and [a live example](https://grape-doorkeeper.herokuapp.com/).
@@ -1,6 +1,13 @@
1
1
  Upgrading WineBouncer
2
2
  =====================
3
3
 
4
+ ## Upgrading to >= 0.5.0
5
+
6
+ WineBouncer's exceptions `OAuthUnauthorizedError` and `OAuthForbiddenError` now come with a
7
+ corresponding Doorkeeper's error response. You can access it via `response` method of the exception.
8
+ For backward compatible, you can still use `message` but the content will be provided by Doorkeeper
9
+ error response's description.
10
+
4
11
  ## Upgrading to >= 0.3.0
5
12
 
6
13
  An new DSL has been introduced to WineBouncer. This DSL will become the preferred way to authorize your endpoints.
@@ -1,7 +1,21 @@
1
1
  module WineBouncer
2
2
  module Errors
3
3
  class UnconfiguredError < StandardError; end
4
- class OAuthUnauthorizedError < StandardError; end
5
- class OAuthForbiddenError < StandardError; end
4
+
5
+ class OAuthUnauthorizedError < StandardError
6
+ attr_reader :response
7
+ def initialize(response)
8
+ super(response.try(:description))
9
+ @response = response
10
+ end
11
+ end
12
+
13
+ class OAuthForbiddenError < StandardError
14
+ attr_reader :response
15
+ def initialize(response)
16
+ super(response.try(:description))
17
+ @response = response
18
+ end
19
+ end
6
20
  end
7
21
  end
@@ -62,12 +62,10 @@ module WineBouncer
62
62
  unless valid_doorkeeper_token?(*scopes)
63
63
  if !doorkeeper_token || !doorkeeper_token.accessible?
64
64
  error = Doorkeeper::OAuth::InvalidTokenResponse.from_access_token(doorkeeper_token)
65
- # TODO: localization and better error reporting
66
- raise WineBouncer::Errors::OAuthUnauthorizedError, 'unauthorized'
65
+ raise WineBouncer::Errors::OAuthUnauthorizedError, error
67
66
  else
68
67
  error = Doorkeeper::OAuth::ForbiddenTokenResponse.from_scopes(scopes)
69
- # TODO: localization and better error reporting
70
- raise WineBouncer::Errors::OAuthForbiddenError, "missing permissions"
68
+ raise WineBouncer::Errors::OAuthForbiddenError, error
71
69
  end
72
70
  end
73
71
  end
@@ -1,3 +1,3 @@
1
1
  module WineBouncer
2
- VERSION = '0.4.0'
2
+ VERSION = '0.5.0'
3
3
  end
@@ -17,8 +17,8 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_runtime_dependency 'grape', '~> 0.10', '< 0.13'
21
- spec.add_runtime_dependency 'doorkeeper', '>= 1.4', '< 3.0'
20
+ spec.add_runtime_dependency 'grape', '~> 0.10', '< 0.14'
21
+ spec.add_runtime_dependency 'doorkeeper', '>= 1.4', '< 3.1'
22
22
 
23
23
  spec.add_development_dependency "railties"
24
24
  spec.add_development_dependency "bundler", "~> 1.7"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wine_bouncer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antek Drzewiecki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-01 00:00:00.000000000 Z
11
+ date: 2015-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grape
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '0.10'
20
20
  - - <
21
21
  - !ruby/object:Gem::Version
22
- version: '0.13'
22
+ version: '0.14'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '0.10'
30
30
  - - <
31
31
  - !ruby/object:Gem::Version
32
- version: '0.13'
32
+ version: '0.14'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: doorkeeper
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: '1.4'
40
40
  - - <
41
41
  - !ruby/object:Gem::Version
42
- version: '3.0'
42
+ version: '3.1'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +49,7 @@ dependencies:
49
49
  version: '1.4'
50
50
  - - <
51
51
  - !ruby/object:Gem::Version
52
- version: '3.0'
52
+ version: '3.1'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: railties
55
55
  requirement: !ruby/object:Gem::Requirement