drillbit 2.9.1 → 2.10.0
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
 - checksums.yaml.gz.sig +0 -0
 - data.tar.gz.sig +1 -3
 - data/lib/drillbit/authorizable_resource.rb +9 -3
 - data/lib/drillbit/authorizers/parameters/resource.rb +1 -1
 - data/lib/drillbit/requests/rack.rb +0 -2
 - data/lib/drillbit/responses/invalid_api_request.rb +3 -3
 - data/lib/drillbit/responses/invalid_request_body.rb +3 -3
 - data/lib/drillbit/responses/invalid_subdomain.rb +3 -3
 - data/lib/drillbit/responses/invalid_token.rb +3 -3
 - data/lib/drillbit/tokens/json_web_tokens/password_reset.rb +1 -1
 - data/lib/drillbit/version.rb +1 -1
 - data/spec/drillbit/accept_header_spec.rb +1 -1
 - data/spec/drillbit/errors/invalid_api_request_spec.rb +1 -1
 - data/spec/drillbit/errors/invalid_request_body_spec.rb +1 -1
 - data/spec/drillbit/errors/invalid_subdomain_spec.rb +1 -1
 - data/spec/drillbit/errors/invalid_token_spec.rb +1 -1
 - data/spec/drillbit/invalid_subdomain_spec.rb +1 -1
 - data/spec/drillbit/invalid_token_spec.rb +1 -1
 - data/spec/drillbit/matchers/accept_header_spec.rb +1 -1
 - data/spec/drillbit/matchers/subdomain_spec.rb +1 -1
 - data/spec/drillbit/matchers/version_spec.rb +1 -1
 - data/spec/drillbit/middleware/api_request_validator_spec.rb +1 -1
 - data/spec/drillbit/middleware/token_processor_spec.rb +1 -1
 - data/spec/drillbit/requests/base_spec.rb +1 -1
 - data/spec/drillbit/requests/rack_spec.rb +1 -2
 - data/spec/drillbit/requests/rails_spec.rb +1 -1
 - data/spec/drillbit/resource/model_spec.rb +1 -1
 - data/spec/drillbit/resource/processors/filtering_spec.rb +1 -1
 - data/spec/drillbit/resource/processors/indexing_spec.rb +2 -3
 - data/spec/drillbit/resource/processors/paging_spec.rb +1 -1
 - data/spec/drillbit/resource/processors/sorting_spec.rb +1 -1
 - data/spec/drillbit/tokens/base64_spec.rb +1 -1
 - data/spec/drillbit/tokens/json_web_token_spec.rb +1 -1
 - data/spec/drillbit/tokens/json_web_tokens/password_reset_spec.rb +1 -1
 - data/spec/support/private_keys.rb +0 -2
 - metadata +5 -5
 - metadata.gz.sig +0 -0
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 661d2f0c465f93327b9baa2a3e2feabf6c066cd1
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 0742f6aa1d4b375be2cff08ab70eff87ce908faf
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 00d8164c6424c877f31797741adc5371d7895969958ca81ce24eb9ae937c96e34b3367eb541c4d9b39b90d21145600f322d6d0a82b4b42769e4ad6f5363f6b34
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 17eaf922c23f0e3da08edac204ad321e0e8e64e5e6a2e27c4f0ec5b674c8eaf2361833fd70203eb7268068c0dff2dd4815bebc89b29d020d46aaff874b7454c6
         
     | 
    
        checksums.yaml.gz.sig
    CHANGED
    
    | 
         Binary file 
     | 
    
        data.tar.gz.sig
    CHANGED
    
    | 
         @@ -1,3 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
            ���[���~�>�����}�#;A��>uV]����
         
     | 
| 
       3 
     | 
    
         
            -
            ���XH�w� @cV��c:A+\��tLб�B�Q�s^IY+r`�����È�M��}����Nݞ��t�����YZ>b�aE��7e����(�<
         
     | 
| 
      
 1 
     | 
    
         
            +
            BiCb��ݽ�z�}Pq������Es_�YAJ��x~Ɂj���.�y^m��r�0	���ې��6�%�}��x'c`�3q�A���"�B�����^G7����Ю\hO�F���_Z�Uه��&��)����}?����f8���1m%���+$�rb\�ZE(�ԛ@��%?TY��bl����@]���6�;�B�+�!}�Y���9�j���#�u6d�_W>��5s<�L��m����i�N��e鿬� ��@�q�B�j
         
     | 
| 
         @@ -71,12 +71,14 @@ module  AuthorizableResource 
     | 
|
| 
       71 
71 
     | 
    
         
             
              private
         
     | 
| 
       72 
72 
     | 
    
         | 
| 
       73 
73 
     | 
    
         
             
              def authorize
         
     | 
| 
      
 74 
     | 
    
         
            +
                return if authorizer.public_send(authorization_query)
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
       74 
76 
     | 
    
         
             
                Erratum.raise(
         
     | 
| 
       75 
77 
     | 
    
         
             
                  'ForbiddenError',
         
     | 
| 
       76 
78 
     | 
    
         
             
                  resource_name: self.class.singular_resource_name,
         
     | 
| 
       77 
79 
     | 
    
         
             
                  resource_id:   [params[:id]],
         
     | 
| 
       78 
80 
     | 
    
         
             
                  action:        action_name,
         
     | 
| 
       79 
     | 
    
         
            -
                ) 
     | 
| 
      
 81 
     | 
    
         
            +
                )
         
     | 
| 
       80 
82 
     | 
    
         
             
              end
         
     | 
| 
       81 
83 
     | 
    
         | 
| 
       82 
84 
     | 
    
         
             
              def authorizer
         
     | 
| 
         @@ -123,7 +125,8 @@ module  AuthorizableResource 
     | 
|
| 
       123 
125 
     | 
    
         
             
              end
         
     | 
| 
       124 
126 
     | 
    
         | 
| 
       125 
127 
     | 
    
         
             
              # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity
         
     | 
| 
       126 
     | 
    
         
            -
              # rubocop:disable Metrics/CyclomaticComplexity
         
     | 
| 
      
 128 
     | 
    
         
            +
              # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength
         
     | 
| 
      
 129 
     | 
    
         
            +
              # rubocop:disable Metrics/BlockNesting
         
     | 
| 
       127 
130 
     | 
    
         
             
              def authorized_attributes
         
     | 
| 
       128 
131 
     | 
    
         
             
                @authorized_attributes ||= begin
         
     | 
| 
       129 
132 
     | 
    
         
             
                  attributes    = authorized_params.
         
     | 
| 
         @@ -158,12 +161,15 @@ module  AuthorizableResource 
     | 
|
| 
       158 
161 
     | 
    
         
             
                    end
         
     | 
| 
       159 
162 
     | 
    
         
             
                  end
         
     | 
| 
       160 
163 
     | 
    
         | 
| 
      
 164 
     | 
    
         
            +
                  relationships.permit! if relationships.respond_to?(:permit!)
         
     | 
| 
      
 165 
     | 
    
         
            +
             
     | 
| 
       161 
166 
     | 
    
         
             
                  ActiveSupport::Deprecation.silence do
         
     | 
| 
       162 
167 
     | 
    
         
             
                    attributes.merge(relationships)
         
     | 
| 
       163 
168 
     | 
    
         
             
                  end
         
     | 
| 
       164 
169 
     | 
    
         
             
                end
         
     | 
| 
       165 
170 
     | 
    
         
             
              end
         
     | 
| 
       166 
     | 
    
         
            -
              # rubocop:enable Metrics/ 
     | 
| 
      
 171 
     | 
    
         
            +
              # rubocop:enable Metrics/BlockNesting
         
     | 
| 
      
 172 
     | 
    
         
            +
              # rubocop:enable Metrics/CyclomaticComplexity, Metrics/MethodLength
         
     | 
| 
       167 
173 
     | 
    
         
             
              # rubocop:enable Metrics/AbcSize, Metrics/PerceivedComplexity
         
     | 
| 
       168 
174 
     | 
    
         | 
| 
       169 
175 
     | 
    
         
             
              def authorized_resource
         
     | 
| 
         @@ -53,7 +53,7 @@ class   Resource < Authorizers::Parameters 
     | 
|
| 
       53 
53 
     | 
    
         
             
              end
         
     | 
| 
       54 
54 
     | 
    
         | 
| 
       55 
55 
     | 
    
         
             
              # rubocop:disable Metrics/AbcSize
         
     | 
| 
       56 
     | 
    
         
            -
              def add_authorized_relationship(name, embedded_attributes:  
     | 
| 
      
 56 
     | 
    
         
            +
              def add_authorized_relationship(name, embedded_attributes: [])
         
     | 
| 
       57 
57 
     | 
    
         
             
                param    = params.
         
     | 
| 
       58 
58 
     | 
    
         
             
                           fetch(:data,          {}).
         
     | 
| 
       59 
59 
     | 
    
         
             
                           fetch(:relationships, {}).
         
     | 
| 
         @@ -5,7 +5,6 @@ require 'drillbit/accept_header' 
     | 
|
| 
       5 
5 
     | 
    
         
             
            require 'drillbit/tokens/json_web_token'
         
     | 
| 
       6 
6 
     | 
    
         
             
            require 'drillbit/tokens/base64'
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
            # rubocop:disable Style/VariableNumber
         
     | 
| 
       9 
8 
     | 
    
         
             
            module  Drillbit
         
     | 
| 
       10 
9 
     | 
    
         
             
            module  Requests
         
     | 
| 
       11 
10 
     | 
    
         
             
            class   Rack < Base
         
     | 
| 
         @@ -50,4 +49,3 @@ class   Rack < Base 
     | 
|
| 
       50 
49 
     | 
    
         
             
            end
         
     | 
| 
       51 
50 
     | 
    
         
             
            end
         
     | 
| 
       52 
51 
     | 
    
         
             
            end
         
     | 
| 
       53 
     | 
    
         
            -
            # rubocop:enable Style/VariableNumber
         
     | 
| 
         @@ -8,9 +8,9 @@ class   InvalidApiRequest 
     | 
|
| 
       8 
8 
     | 
    
         
             
                error = Drillbit::Errors::InvalidApiRequest.new(accept_header: env['HTTP_ACCEPT'])
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
                [
         
     | 
| 
       11 
     | 
    
         
            -
                  error.http_status, 
     | 
| 
       12 
     | 
    
         
            -
                  {}, 
     | 
| 
       13 
     | 
    
         
            -
                  [error.to_json], 
     | 
| 
      
 11 
     | 
    
         
            +
                  error.http_status,                    # HTTP Status Code
         
     | 
| 
      
 12 
     | 
    
         
            +
                  {},                                   # Response Headers
         
     | 
| 
      
 13 
     | 
    
         
            +
                  ["{\"errors\": [#{error.to_json}]}"], # Message
         
     | 
| 
       14 
14 
     | 
    
         
             
                ]
         
     | 
| 
       15 
15 
     | 
    
         
             
              end
         
     | 
| 
       16 
16 
     | 
    
         
             
            end
         
     | 
| 
         @@ -8,9 +8,9 @@ class   InvalidRequestBody 
     | 
|
| 
       8 
8 
     | 
    
         
             
                error = Drillbit::Errors::InvalidRequestBody.new(request_body: env['RACK_INPUT'])
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
                [
         
     | 
| 
       11 
     | 
    
         
            -
                  error.http_status, 
     | 
| 
       12 
     | 
    
         
            -
                  {}, 
     | 
| 
       13 
     | 
    
         
            -
                  [error.to_json], 
     | 
| 
      
 11 
     | 
    
         
            +
                  error.http_status,                    # HTTP Status Code
         
     | 
| 
      
 12 
     | 
    
         
            +
                  {},                                   # Response Headers
         
     | 
| 
      
 13 
     | 
    
         
            +
                  ["{\"errors\": [#{error.to_json}]}"], # Message
         
     | 
| 
       14 
14 
     | 
    
         
             
                ]
         
     | 
| 
       15 
15 
     | 
    
         
             
              end
         
     | 
| 
       16 
16 
     | 
    
         
             
            end
         
     | 
| 
         @@ -8,9 +8,9 @@ class   InvalidSubdomain 
     | 
|
| 
       8 
8 
     | 
    
         
             
                error = Drillbit::Errors::InvalidSubdomain.new(http_host: env['HTTP_HOST'])
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
                [
         
     | 
| 
       11 
     | 
    
         
            -
                  error.http_status, 
     | 
| 
       12 
     | 
    
         
            -
                  {}, 
     | 
| 
       13 
     | 
    
         
            -
                  [error.to_json], 
     | 
| 
      
 11 
     | 
    
         
            +
                  error.http_status,                    # HTTP Status Code
         
     | 
| 
      
 12 
     | 
    
         
            +
                  {},                                   # Response Headers
         
     | 
| 
      
 13 
     | 
    
         
            +
                  ["{\"errors\": [#{error.to_json}]}"], # Message
         
     | 
| 
       14 
14 
     | 
    
         
             
                ]
         
     | 
| 
       15 
15 
     | 
    
         
             
              end
         
     | 
| 
       16 
16 
     | 
    
         
             
            end
         
     | 
| 
         @@ -8,11 +8,11 @@ class   InvalidToken 
     | 
|
| 
       8 
8 
     | 
    
         
             
                error = Drillbit::Errors::InvalidToken.new
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
                [
         
     | 
| 
       11 
     | 
    
         
            -
                  error.http_status, 
     | 
| 
       12 
     | 
    
         
            -
                  { 
     | 
| 
      
 11 
     | 
    
         
            +
                  error.http_status,                    # HTTP Status Code
         
     | 
| 
      
 12 
     | 
    
         
            +
                  {                                     # Response Headers
         
     | 
| 
       13 
13 
     | 
    
         
             
                    'WWW-Authenticate' => %Q{Token realm="#{application_name}"},
         
     | 
| 
       14 
14 
     | 
    
         
             
                  },
         
     | 
| 
       15 
     | 
    
         
            -
                  [error.to_json], 
     | 
| 
      
 15 
     | 
    
         
            +
                  ["{\"errors\": [#{error.to_json}]}"], # Message
         
     | 
| 
       16 
16 
     | 
    
         
             
                ]
         
     | 
| 
       17 
17 
     | 
    
         
             
              end
         
     | 
| 
       18 
18 
     | 
    
         
             
            end
         
     | 
    
        data/lib/drillbit/version.rb
    CHANGED
    
    
| 
         @@ -1,11 +1,10 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
            require ' 
     | 
| 
      
 2 
     | 
    
         
            +
            require 'rspeckled/spec_helpers/rspeckled'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'drillbit/resource/processors/indexing'
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            module Drillbit
         
     | 
| 
       6 
6 
     | 
    
         
             
            class  TestIndexClass
         
     | 
| 
       7 
     | 
    
         
            -
              def for_query(_param)
         
     | 
| 
       8 
     | 
    
         
            -
              end
         
     | 
| 
      
 7 
     | 
    
         
            +
              def for_query(_param); end
         
     | 
| 
       9 
8 
     | 
    
         
             
            end
         
     | 
| 
       10 
9 
     | 
    
         
             
            end
         
     | 
| 
       11 
10 
     | 
    
         | 
| 
         @@ -33,7 +33,6 @@ def invalid_jwe_token 
     | 
|
| 
       33 
33 
     | 
    
         
             
              @invalid_jwe_token ||= valid_jwe_token.tr('a', 'f')
         
     | 
| 
       34 
34 
     | 
    
         
             
            end
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
            # rubocop:disable Style/VariableNumber
         
     | 
| 
       37 
36 
     | 
    
         
             
            def valid_b64_token(payload = 'hereisacoollittlestring')
         
     | 
| 
       38 
37 
     | 
    
         
             
              @valid_b64_token ||= Base64.encode64(payload).chomp
         
     | 
| 
       39 
38 
     | 
    
         
             
            end
         
     | 
| 
         @@ -41,4 +40,3 @@ end 
     | 
|
| 
       41 
40 
     | 
    
         
             
            def invalid_b64_token
         
     | 
| 
       42 
41 
     | 
    
         
             
              @invalid_b64_token ||= valid_b64_token.tr('abcdefghijklmnop', '$o#m$k#i$g#e$c#a')
         
     | 
| 
       43 
42 
     | 
    
         
             
            end
         
     | 
| 
       44 
     | 
    
         
            -
            # rubocop:enable Style/VariableNumber
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: drillbit
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.10.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - thegranddesign
         
     | 
| 
         @@ -31,7 +31,7 @@ cert_chain: 
     | 
|
| 
       31 
31 
     | 
    
         
             
              zRIv8lqQM8QFT76rzP5SBCERwN+ltKAFbQ5/FwmZNGWYnmCP3RZMQiRnbh+9H9lh
         
     | 
| 
       32 
32 
     | 
    
         
             
              mlbwaYZTjgsXq6cy8N38EecewgBbZYS1IYJraE/M
         
     | 
| 
       33 
33 
     | 
    
         
             
              -----END CERTIFICATE-----
         
     | 
| 
       34 
     | 
    
         
            -
            date:  
     | 
| 
      
 34 
     | 
    
         
            +
            date: 2017-02-17 00:00:00.000000000 Z
         
     | 
| 
       35 
35 
     | 
    
         
             
            dependencies:
         
     | 
| 
       36 
36 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       37 
37 
     | 
    
         
             
              name: erratum
         
     | 
| 
         @@ -109,14 +109,14 @@ dependencies: 
     | 
|
| 
       109 
109 
     | 
    
         
             
                requirements:
         
     | 
| 
       110 
110 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       111 
111 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       112 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 112 
     | 
    
         
            +
                    version: 0.8.0
         
     | 
| 
       113 
113 
     | 
    
         
             
              type: :development
         
     | 
| 
       114 
114 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       115 
115 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       116 
116 
     | 
    
         
             
                requirements:
         
     | 
| 
       117 
117 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       118 
118 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       119 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 119 
     | 
    
         
            +
                    version: 0.8.0
         
     | 
| 
       120 
120 
     | 
    
         
             
            description: ''
         
     | 
| 
       121 
121 
     | 
    
         
             
            email: rubygems@livinghighontheblog.com
         
     | 
| 
       122 
122 
     | 
    
         
             
            executables: []
         
     | 
| 
         @@ -233,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       233 
233 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       234 
234 
     | 
    
         
             
            requirements: []
         
     | 
| 
       235 
235 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       236 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 236 
     | 
    
         
            +
            rubygems_version: 2.6.8
         
     | 
| 
       237 
237 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       238 
238 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       239 
239 
     | 
    
         
             
            summary: APIs Need Love Too
         
     | 
    
        metadata.gz.sig
    CHANGED
    
    | 
         Binary file 
     |