wine_bouncer 0.2.0 → 0.2.1
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.
- checksums.yaml +4 -4
 - data/.travis.yml +2 -4
 - data/CHANGELOG.md +4 -0
 - data/Gemfile +3 -3
 - data/README.md +26 -20
 - data/lib/generators/templates/wine_bouncer.rb +7 -0
 - data/lib/generators/wine_bouncer/initializer_generator.rb +12 -0
 - data/lib/wine_bouncer/version.rb +1 -1
 - data/spec/lib/generators/wine_bouncer/initializer_generator_spec.rb +18 -0
 - data/spec/lib/wine_bouncer/auth_methods/auth_methods_spec.rb +1 -1
 - data/spec/lib/wine_bouncer/auth_strategies/default_spec.rb +2 -2
 - data/spec/rails_helper.rb +7 -8
 - data/spec/spec_helper.rb +2 -0
 - data/wine_bouncer.gemspec +2 -2
 - metadata +30 -6
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: d9ca00d6af297ea83a1b780674f0138125560ba6
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 87685246db6c845a980a28b7e2de53e2aed44bf8
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 3c10d58093da1170c43819866b4484b157773325309811277853629d60af8da127b75b8837cdd72840f760f5ba3d9cdd468fd502790ebd6b3328b6e4324ac3f2
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 99caeb2b029573f56f7705e3bf5078941f4b2fec45b5deebf570aad449cc00c3d6dd7386d7d565354c8b7d1bb1b3e5cdd49e67dbd57b795c3a241738389e559a
         
     | 
    
        data/.travis.yml
    CHANGED
    
    | 
         @@ -7,13 +7,11 @@ rvm: 
     | 
|
| 
       7 
7 
     | 
    
         
             
              - 2.0
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 2.1
         
     | 
| 
       9 
9 
     | 
    
         
             
            env:
         
     | 
| 
       10 
     | 
    
         
            -
              - rails=3.1.12 grape=0.8.0
         
     | 
| 
       11 
10 
     | 
    
         
             
              - rails=3.2.18 grape=0.8.0
         
     | 
| 
       12 
     | 
    
         
            -
              - rails=4.0.5 grape=0.8.0
         
     | 
| 
       13 
11 
     | 
    
         
             
              - rails=4.1.1 grape=0.8.0
         
     | 
| 
       14 
     | 
    
         
            -
              - rails=3. 
     | 
| 
      
 12 
     | 
    
         
            +
              - rails=3.2.18 grape=0.9.0 doorkeeper=1.4.1
         
     | 
| 
       15 
13 
     | 
    
         
             
              - rails=3.2.18 grape=0.9.0
         
     | 
| 
       16 
     | 
    
         
            -
              - rails=4. 
     | 
| 
      
 14 
     | 
    
         
            +
              - rails=4.1.1 grape=0.9.0 doorkeeper=1.4.1
         
     | 
| 
       17 
15 
     | 
    
         
             
              - rails=4.1.1 grape=0.9.0
         
     | 
| 
       18 
16 
     | 
    
         
             
            addons:
         
     | 
| 
       19 
17 
     | 
    
         
             
              code_climate:
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,6 +1,10 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            Changelog
         
     | 
| 
       2 
2 
     | 
    
         
             
            =========
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
      
 4 
     | 
    
         
            +
            ## 0.2.1
         
     | 
| 
      
 5 
     | 
    
         
            +
            *[#12](https://github.com/antek-drzewiecki/wine_bouncer/pull/12): Added a rails generator to generate the WineBouncer configuration file. Thanks @whatasunnyday.
         
     | 
| 
      
 6 
     | 
    
         
            +
            *[#7](https://github.com/antek-drzewiecki/wine_bouncer/pull/7): Added support for Doorkeeper 2.0.0 and 2.0.1. Thanks @whatasunnyday .
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
       4 
8 
     | 
    
         
             
            ## 0.2.0
         
     | 
| 
       5 
9 
     | 
    
         
             
            *[#4](https://github.com/antek-drzewiecki/wine_bouncer/pull/4): Support for newer versions of grape ( > 0.8 ).
         
     | 
| 
       6 
10 
     | 
    
         
             
            *[#6](https://github.com/antek-drzewiecki/wine_bouncer/pull/6): Added the option to configure the resource owner.
         
     | 
    
        data/Gemfile
    CHANGED
    
    | 
         @@ -2,15 +2,15 @@ source 'https://rubygems.org' 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            ENV['grape'] ||= '0.9.0'
         
     | 
| 
       4 
4 
     | 
    
         
             
            ENV['rails'] ||= '4.1.1'
         
     | 
| 
      
 5 
     | 
    
         
            +
            ENV['doorkeeper'] ||= '2.0.1'
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
       6 
7 
     | 
    
         
             
            gem 'rails', ENV['rails']
         
     | 
| 
       7 
8 
     | 
    
         | 
| 
       8 
9 
     | 
    
         
             
            gem 'activerecord'
         
     | 
| 
       9 
10 
     | 
    
         
             
            gem 'grape', ENV['grape']
         
     | 
| 
      
 11 
     | 
    
         
            +
            gem 'doorkeeper', ENV['doorkeeper']
         
     | 
| 
       10 
12 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
            gem  
     | 
| 
      
 13 
     | 
    
         
            +
            gem 'codeclimate-test-reporter', group: :test, require: nil
         
     | 
| 
       12 
14 
     | 
    
         | 
| 
       13 
15 
     | 
    
         
             
            # Specify your gem's dependencies in wine_bouncer.gemspec
         
     | 
| 
       14 
16 
     | 
    
         
             
            gemspec
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -4,7 +4,7 @@ 
     | 
|
| 
       4 
4 
     | 
    
         
             
            [](https://codeclimate.com/github/antek-drzewiecki/wine_bouncer)
         
     | 
| 
       5 
5 
     | 
    
         
             
            [](http://badge.fury.io/rb/wine_bouncer)
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
            Protect your precious Grape API with Doorkeeper. 
     | 
| 
      
 7 
     | 
    
         
            +
            Protect your precious Grape API with Doorkeeper.
         
     | 
| 
       8 
8 
     | 
    
         
             
            WineBouncer uses minimal modification, to make the magic happen.
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
            Table of Contents
         
     | 
| 
         @@ -24,7 +24,7 @@ Table of Contents 
     | 
|
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
            ## Requirements
         
     | 
| 
       26 
26 
     | 
    
         
             
            - Ruby > 1.9.3
         
     | 
| 
       27 
     | 
    
         
            -
            - Doorkeeper > 1.4.0
         
     | 
| 
      
 27 
     | 
    
         
            +
            - Doorkeeper > 1.4.0 and =< 2.0.1
         
     | 
| 
       28 
28 
     | 
    
         
             
            - Grape > 0.8
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
            ## Installation
         
     | 
| 
         @@ -45,17 +45,23 @@ bundle 
     | 
|
| 
       45 
45 
     | 
    
         
             
            When upgrading from a previous version, see [UPGRADING](UPGRADING.md). You might also be interested at the [CHANGELOG](CHANGELOG.md).
         
     | 
| 
       46 
46 
     | 
    
         | 
| 
       47 
47 
     | 
    
         
             
            ## Usage
         
     | 
| 
       48 
     | 
    
         
            -
            WineBouncer is a custom Grape Middleware used for Authentication and Authorization. We assume you have a Grape API mounted in your Rails application together with Doorkeeper. 
     | 
| 
      
 48 
     | 
    
         
            +
            WineBouncer is a custom Grape Middleware used for Authentication and Authorization. We assume you have a Grape API mounted in your Rails application together with Doorkeeper.
         
     | 
| 
       49 
49 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
            To get started with WineBouncer,  
     | 
| 
      
 50 
     | 
    
         
            +
            To get started with WineBouncer, run the configuration initializer:
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            ```shell
         
     | 
| 
      
 53 
     | 
    
         
            +
            $ rails g wine_bouncer:initializer
         
     | 
| 
      
 54 
     | 
    
         
            +
            ```
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
            This creates a rails initializer in your Rails app at `config/initializers/wine_bouncer.rb` with the following configuration:
         
     | 
| 
       51 
57 
     | 
    
         | 
| 
       52 
58 
     | 
    
         
             
            ``` ruby
         
     | 
| 
       53 
59 
     | 
    
         
             
            WineBouncer.configure do |config|
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
      
 60 
     | 
    
         
            +
              config.auth_strategy = :default
         
     | 
| 
       55 
61 
     | 
    
         | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
      
 62 
     | 
    
         
            +
              config.define_resource_owner do
         
     | 
| 
      
 63 
     | 
    
         
            +
                User.find(doorkeeper_access_token.resource_owner_id) if doorkeeper_access_token
         
     | 
| 
      
 64 
     | 
    
         
            +
              end
         
     | 
| 
       59 
65 
     | 
    
         
             
            end
         
     | 
| 
       60 
66 
     | 
    
         
             
            ```
         
     | 
| 
       61 
67 
     | 
    
         | 
| 
         @@ -70,7 +76,7 @@ class Api < Grape::API 
     | 
|
| 
       70 
76 
     | 
    
         
             
            end
         
     | 
| 
       71 
77 
     | 
    
         
             
            ```
         
     | 
| 
       72 
78 
     | 
    
         | 
| 
       73 
     | 
    
         
            -
            WineBouncer relies on Grape's endpoint method description to define if an endpoint method should be protected. 
     | 
| 
      
 79 
     | 
    
         
            +
            WineBouncer relies on Grape's endpoint method description to define if an endpoint method should be protected.
         
     | 
| 
       74 
80 
     | 
    
         
             
            It comes with authorization strategies that allow a custom format for your authorization definition. Pick an authentication strategy to get started.
         
     | 
| 
       75 
81 
     | 
    
         
             
            Currently the following strategies are included:
         
     | 
| 
       76 
82 
     | 
    
         | 
| 
         @@ -84,30 +90,30 @@ Example: 
     | 
|
| 
       84 
90 
     | 
    
         | 
| 
       85 
91 
     | 
    
         
             
            ``` ruby
         
     | 
| 
       86 
92 
     | 
    
         
             
             class MyAwesomeAPI < Grape::API
         
     | 
| 
       87 
     | 
    
         
            -
                desc 'protected method with required public scope', 
     | 
| 
      
 93 
     | 
    
         
            +
                desc 'protected method with required public scope',
         
     | 
| 
       88 
94 
     | 
    
         
             
                auth: { scopes: ['public'] }
         
     | 
| 
       89 
95 
     | 
    
         
             
                get '/protected' do
         
     | 
| 
       90 
96 
     | 
    
         
             
                   { hello: 'world' }
         
     | 
| 
       91 
97 
     | 
    
         
             
                end
         
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
       93 
99 
     | 
    
         
             
                desc 'Unprotected method'
         
     | 
| 
       94 
100 
     | 
    
         
             
                get '/unprotected' do
         
     | 
| 
       95 
101 
     | 
    
         
             
                  { hello: 'unprotected world' }
         
     | 
| 
       96 
102 
     | 
    
         
             
                end
         
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
       98 
104 
     | 
    
         
             
                desc 'This method needs the public or private scope.',
         
     | 
| 
       99 
105 
     | 
    
         
             
                auth: { scopes: [ 'public', 'private' ] }
         
     | 
| 
       100 
106 
     | 
    
         
             
                get '/method' do
         
     | 
| 
       101 
107 
     | 
    
         
             
                  { hello: 'public or private user.' }
         
     | 
| 
       102 
108 
     | 
    
         
             
                end
         
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
     | 
    
         
            -
                desc 'This method uses Doorkeepers default scopes.', 
     | 
| 
       105 
     | 
    
         
            -
                auth: { scopes: [] } 
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
                desc 'This method uses Doorkeepers default scopes.',
         
     | 
| 
      
 111 
     | 
    
         
            +
                auth: { scopes: [] }
         
     | 
| 
       106 
112 
     | 
    
         
             
                get '/protected_with_default_scope' do
         
     | 
| 
       107 
113 
     | 
    
         
             
                   { hello: 'protected unscoped world' }
         
     | 
| 
       108 
114 
     | 
    
         
             
                end
         
     | 
| 
       109 
115 
     | 
    
         
             
             end
         
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
       111 
117 
     | 
    
         
             
             class Api < Grape::API
         
     | 
| 
       112 
118 
     | 
    
         
             
                default_format :json
         
     | 
| 
       113 
119 
     | 
    
         
             
                format :json
         
     | 
| 
         @@ -122,7 +128,7 @@ Example: 
     | 
|
| 
       122 
128 
     | 
    
         | 
| 
       123 
129 
     | 
    
         
             
            WineBouncer comes with a strategy that can be perfectly used with [grape-swagger](https://github.com/tim-vandecasteele/grape-swagger) with a syntax compliant with the [swagger spec](https://github.com/wordnik/swagger-spec/).
         
     | 
| 
       124 
130 
     | 
    
         
             
            This might be one of the simplest methods to protect your API and serve it with documentation. You can use [swagger-ui](https://github.com/wordnik/swagger-ui) to view your documentation.
         
     | 
| 
       125 
     | 
    
         
            -
             
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
       126 
132 
     | 
    
         
             
            To get started ensure you also have included the `grape-swagger` gem in your gemfile.
         
     | 
| 
       127 
133 
     | 
    
         | 
| 
       128 
134 
     | 
    
         
             
            Run `bundle` to install the missing gems.
         
     | 
| 
         @@ -192,7 +198,7 @@ You can use the default scopes of Doorkeeper by just adding `authorizations: { o 
     | 
|
| 
       192 
198 
     | 
    
         | 
| 
       193 
199 
     | 
    
         
             
            ### Token information
         
     | 
| 
       194 
200 
     | 
    
         | 
| 
       195 
     | 
    
         
            -
            WineBouncer comes with free extras! Methods for `resource_owner` and `doorkeeper_access_token` get included in your endpoints. You can use them to get the current resource owner, and the access_token object of doorkeeper. 
     | 
| 
      
 201 
     | 
    
         
            +
            WineBouncer comes with free extras! Methods for `resource_owner` and `doorkeeper_access_token` get included in your endpoints. You can use them to get the current resource owner, and the access_token object of doorkeeper.
         
     | 
| 
       196 
202 
     | 
    
         | 
| 
       197 
203 
     | 
    
         
             
            ## Exceptions and Exception handling
         
     | 
| 
       198 
204 
     | 
    
         | 
| 
         @@ -200,12 +206,12 @@ This gem raises the following exceptions which can be handled in your Grape API, 
     | 
|
| 
       200 
206 
     | 
    
         | 
| 
       201 
207 
     | 
    
         
             
            * `WineBouncer::Errors::OAuthUnauthorizedError`
         
     | 
| 
       202 
208 
     | 
    
         
             
               when the request is unauthorized.
         
     | 
| 
       203 
     | 
    
         
            -
            * `WineBouncer::Errors::OAuthForbiddenError` 
     | 
| 
      
 209 
     | 
    
         
            +
            * `WineBouncer::Errors::OAuthForbiddenError`
         
     | 
| 
       204 
210 
     | 
    
         
             
               when the token is found but scopes do not match.
         
     | 
| 
       205 
211 
     | 
    
         | 
| 
       206 
212 
     | 
    
         
             
            ## Development
         
     | 
| 
       207 
213 
     | 
    
         | 
| 
       208 
     | 
    
         
            -
            Since we want the gem tested against several rails versions we use the same way to prepare our development environment as Doorkeeper. 
     | 
| 
      
 214 
     | 
    
         
            +
            Since we want the gem tested against several rails versions we use the same way to prepare our development environment as Doorkeeper.
         
     | 
| 
       209 
215 
     | 
    
         | 
| 
       210 
216 
     | 
    
         
             
            To install the development environment for rails 3.2.18, you can also specify a different rails version to test against.
         
     | 
| 
       211 
217 
     | 
    
         | 
| 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module WineBouncer
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Generators
         
     | 
| 
      
 3 
     | 
    
         
            +
                class InitializerGenerator < ::Rails::Generators::Base
         
     | 
| 
      
 4 
     | 
    
         
            +
                  source_root File.expand_path('../../templates', __FILE__)
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                  desc 'Creates a sample WineBouncer initializer.'
         
     | 
| 
      
 7 
     | 
    
         
            +
                  def copy_initializer
         
     | 
| 
      
 8 
     | 
    
         
            +
                    copy_file 'wine_bouncer.rb', 'config/initializers/wine_bouncer.rb'
         
     | 
| 
      
 9 
     | 
    
         
            +
                  end
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/wine_bouncer/version.rb
    CHANGED
    
    
| 
         @@ -0,0 +1,18 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'generator_spec'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'rails_helper'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'generators/wine_bouncer/initializer_generator'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            describe WineBouncer::Generators::InitializerGenerator, type: :generator do
         
     | 
| 
      
 7 
     | 
    
         
            +
              destination '/tmp'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              before do
         
     | 
| 
      
 10 
     | 
    
         
            +
                prepare_destination
         
     | 
| 
      
 11 
     | 
    
         
            +
                run_generator
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              it 'creates a test initializer' do
         
     | 
| 
      
 15 
     | 
    
         
            +
                assert_file 'config/initializers/wine_bouncer.rb', /WineBouncer\.configure/
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
            end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
         @@ -1,10 +1,10 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require ' 
     | 
| 
      
 1 
     | 
    
         
            +
            require 'rails_helper'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'wine_bouncer/auth_strategies/default'
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            describe ::WineBouncer::AuthStrategies::Default do
         
     | 
| 
       5 
5 
     | 
    
         
             
              subject(:klass) { ::WineBouncer::AuthStrategies::Default.new }
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
              let(:scopes) {  
     | 
| 
      
 7 
     | 
    
         
            +
              let(:scopes) { %w(public private) }
         
     | 
| 
       8 
8 
     | 
    
         
             
              let(:scopes_hash) { { scopes: scopes } }
         
     | 
| 
       9 
9 
     | 
    
         
             
              let(:auth_context) { { auth: scopes_hash } }
         
     | 
| 
       10 
10 
     | 
    
         | 
    
        data/spec/rails_helper.rb
    CHANGED
    
    | 
         @@ -1,15 +1,12 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # This file is copied to spec/ when you run 'rails generate rspec:install'
         
     | 
| 
       2 
     | 
    
         
            -
            ENV[ 
     | 
| 
      
 2 
     | 
    
         
            +
            ENV['RAILS_ENV'] ||= 'test'
         
     | 
| 
       3 
3 
     | 
    
         
             
            ORM = (ENV['orm'] || :active_record).to_sym
         
     | 
| 
       4 
4 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       5 
     | 
    
         
            -
            require File.expand_path( 
     | 
| 
      
 5 
     | 
    
         
            +
            require File.expand_path('../dummy/config/environment', __FILE__)
         
     | 
| 
       6 
6 
     | 
    
         
             
            require 'rspec/rails'
         
     | 
| 
       7 
7 
     | 
    
         
             
            require 'wine_bouncer'
         
     | 
| 
       8 
8 
     | 
    
         
             
            require 'factory_girl'
         
     | 
| 
       9 
9 
     | 
    
         
             
            require 'database_cleaner'
         
     | 
| 
       10 
     | 
    
         
            -
            require "codeclimate-test-reporter"
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
            CodeClimate::TestReporter.start
         
     | 
| 
       13 
10 
     | 
    
         | 
| 
       14 
11 
     | 
    
         
             
            # Add additional requires below this line. Rails is not loaded until this point!
         
     | 
| 
       15 
12 
     | 
    
         | 
| 
         @@ -40,13 +37,15 @@ module ApiHelper 
     | 
|
| 
       40 
37 
     | 
    
         
             
              end
         
     | 
| 
       41 
38 
     | 
    
         
             
            end
         
     | 
| 
       42 
39 
     | 
    
         | 
| 
      
 40 
     | 
    
         
            +
            def orm_name
         
     | 
| 
      
 41 
     | 
    
         
            +
              orm = Doorkeeper.configuration.orm
         
     | 
| 
      
 42 
     | 
    
         
            +
              [:mongoid2, :mongoid3, :mongoid4].include?(orm.to_sym) ? :mongoid : orm
         
     | 
| 
      
 43 
     | 
    
         
            +
            end
         
     | 
| 
       43 
44 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
            require "shared/orm/#{ 
     | 
| 
      
 45 
     | 
    
         
            +
            require "shared/orm/#{orm_name}"
         
     | 
| 
       45 
46 
     | 
    
         | 
| 
       46 
47 
     | 
    
         
             
            FactoryGirl.find_definitions
         
     | 
| 
       47 
48 
     | 
    
         | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
49 
     | 
    
         
             
            RSpec.configure do |config|
         
     | 
| 
       51 
50 
     | 
    
         
             
              # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
         
     | 
| 
       52 
51 
     | 
    
         
             
              #config.fixture_path = "#{::Rails.root}/spec/fixtures"
         
     | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | 
         @@ -14,6 +14,8 @@ 
     | 
|
| 
       14 
14 
     | 
    
         
             
            # users commonly want.
         
     | 
| 
       15 
15 
     | 
    
         
             
            #
         
     | 
| 
       16 
16 
     | 
    
         
             
            # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
         
     | 
| 
      
 17 
     | 
    
         
            +
            require "codeclimate-test-reporter"
         
     | 
| 
      
 18 
     | 
    
         
            +
            CodeClimate::TestReporter.start
         
     | 
| 
       17 
19 
     | 
    
         | 
| 
       18 
20 
     | 
    
         
             
            RSpec.configure do |config|
         
     | 
| 
       19 
21 
     | 
    
         
             
              # rspec-expectations config goes here. You can use an alternate
         
     | 
    
        data/wine_bouncer.gemspec
    CHANGED
    
    | 
         @@ -18,14 +18,14 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       18 
18 
     | 
    
         
             
              spec.require_paths = ["lib"]
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
              spec.add_runtime_dependency 'grape', '~> 0.8'
         
     | 
| 
       21 
     | 
    
         
            -
              spec.add_runtime_dependency 'doorkeeper', ' 
     | 
| 
      
 21 
     | 
    
         
            +
              spec.add_runtime_dependency 'doorkeeper', '>= 1.4', '<= 2.0.1'
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
              spec.add_development_dependency "railties"
         
     | 
| 
       24 
24 
     | 
    
         
             
              spec.add_development_dependency "bundler", "~> 1.7"
         
     | 
| 
       25 
25 
     | 
    
         
             
              spec.add_development_dependency "rake", "~> 10.0"
         
     | 
| 
       26 
26 
     | 
    
         
             
              spec.add_development_dependency "rspec-rails", "~> 3.1.0"
         
     | 
| 
       27 
27 
     | 
    
         
             
              spec.add_development_dependency 'factory_girl', '~> 4.4.0'
         
     | 
| 
      
 28 
     | 
    
         
            +
              spec.add_development_dependency "generator_spec", "~> 0.9.0"
         
     | 
| 
       28 
29 
     | 
    
         
             
              spec.add_development_dependency "sqlite3"
         
     | 
| 
       29 
30 
     | 
    
         
             
              spec.add_development_dependency "database_cleaner", "~> 1.3.0"
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
31 
     | 
    
         
             
            end
         
     | 
    
        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.2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.2.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Antek Drzewiecki
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-01-15 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: grape
         
     | 
| 
         @@ -28,16 +28,22 @@ dependencies: 
     | 
|
| 
       28 
28 
     | 
    
         
             
              name: doorkeeper
         
     | 
| 
       29 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       30 
30 
     | 
    
         
             
                requirements:
         
     | 
| 
       31 
     | 
    
         
            -
                - -  
     | 
| 
      
 31 
     | 
    
         
            +
                - - '>='
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '1.4'
         
     | 
| 
      
 34 
     | 
    
         
            +
                - - <=
         
     | 
| 
       32 
35 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       33 
     | 
    
         
            -
                    version:  
     | 
| 
      
 36 
     | 
    
         
            +
                    version: 2.0.1
         
     | 
| 
       34 
37 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       35 
38 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       36 
39 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       37 
40 
     | 
    
         
             
                requirements:
         
     | 
| 
       38 
     | 
    
         
            -
                - -  
     | 
| 
      
 41 
     | 
    
         
            +
                - - '>='
         
     | 
| 
       39 
42 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       40 
     | 
    
         
            -
                    version: 1.4 
     | 
| 
      
 43 
     | 
    
         
            +
                    version: '1.4'
         
     | 
| 
      
 44 
     | 
    
         
            +
                - - <=
         
     | 
| 
      
 45 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 46 
     | 
    
         
            +
                    version: 2.0.1
         
     | 
| 
       41 
47 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       42 
48 
     | 
    
         
             
              name: railties
         
     | 
| 
       43 
49 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -108,6 +114,20 @@ dependencies: 
     | 
|
| 
       108 
114 
     | 
    
         
             
                - - ~>
         
     | 
| 
       109 
115 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       110 
116 
     | 
    
         
             
                    version: 4.4.0
         
     | 
| 
      
 117 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 118 
     | 
    
         
            +
              name: generator_spec
         
     | 
| 
      
 119 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 120 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 121 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 122 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 123 
     | 
    
         
            +
                    version: 0.9.0
         
     | 
| 
      
 124 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 125 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 126 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 127 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 128 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 129 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 130 
     | 
    
         
            +
                    version: 0.9.0
         
     | 
| 
       111 
131 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       112 
132 
     | 
    
         
             
              name: sqlite3
         
     | 
| 
       113 
133 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -153,6 +173,8 @@ files: 
     | 
|
| 
       153 
173 
     | 
    
         
             
            - README.md
         
     | 
| 
       154 
174 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       155 
175 
     | 
    
         
             
            - UPGRADING.md
         
     | 
| 
      
 176 
     | 
    
         
            +
            - lib/generators/templates/wine_bouncer.rb
         
     | 
| 
      
 177 
     | 
    
         
            +
            - lib/generators/wine_bouncer/initializer_generator.rb
         
     | 
| 
       156 
178 
     | 
    
         
             
            - lib/wine_bouncer.rb
         
     | 
| 
       157 
179 
     | 
    
         
             
            - lib/wine_bouncer/auth_methods/auth_methods.rb
         
     | 
| 
       158 
180 
     | 
    
         
             
            - lib/wine_bouncer/auth_strategies/default.rb
         
     | 
| 
         @@ -215,6 +237,7 @@ files: 
     | 
|
| 
       215 
237 
     | 
    
         
             
            - spec/factories/user.rb
         
     | 
| 
       216 
238 
     | 
    
         
             
            - spec/intergration/oauth2_default_strategy_spec.rb
         
     | 
| 
       217 
239 
     | 
    
         
             
            - spec/intergration/oauth2_swagger_strategy_spec.rb
         
     | 
| 
      
 240 
     | 
    
         
            +
            - spec/lib/generators/wine_bouncer/initializer_generator_spec.rb
         
     | 
| 
       218 
241 
     | 
    
         
             
            - spec/lib/wine_bouncer/auth_methods/auth_methods_spec.rb
         
     | 
| 
       219 
242 
     | 
    
         
             
            - spec/lib/wine_bouncer/auth_strategies/default_spec.rb
         
     | 
| 
       220 
243 
     | 
    
         
             
            - spec/rails_helper.rb
         
     | 
| 
         @@ -300,6 +323,7 @@ test_files: 
     | 
|
| 
       300 
323 
     | 
    
         
             
            - spec/factories/user.rb
         
     | 
| 
       301 
324 
     | 
    
         
             
            - spec/intergration/oauth2_default_strategy_spec.rb
         
     | 
| 
       302 
325 
     | 
    
         
             
            - spec/intergration/oauth2_swagger_strategy_spec.rb
         
     | 
| 
      
 326 
     | 
    
         
            +
            - spec/lib/generators/wine_bouncer/initializer_generator_spec.rb
         
     | 
| 
       303 
327 
     | 
    
         
             
            - spec/lib/wine_bouncer/auth_methods/auth_methods_spec.rb
         
     | 
| 
       304 
328 
     | 
    
         
             
            - spec/lib/wine_bouncer/auth_strategies/default_spec.rb
         
     | 
| 
       305 
329 
     | 
    
         
             
            - spec/rails_helper.rb
         
     |