drillbit 2.2.2 → 2.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0788697b4ea28f37b25f1ba8a104f34189edd58
4
- data.tar.gz: 74f0e136c62057d6681acb69afff30e2a593b9ab
3
+ metadata.gz: b547f9cdcd3d9f8baa041bf272a075bc9196bb75
4
+ data.tar.gz: 4488ef5026448f5849be71d7f374f9cbd8e2c8a4
5
5
  SHA512:
6
- metadata.gz: 8ed9075b4c05fba27a26d3de78fb942ef8b4eb59c2021886ee6b8c0fe3120146298ae13d73a41585505aa5b9551ea0adc2f1dc80ad7eaa0e1ba2d37e18ba9ccf
7
- data.tar.gz: f9156f84f36297579c2f53daa54f8e2be98ffb95e4c2c0fb18deae3b04110e844022090c78032db1f81b2e15affbe58f656d45a49c7417e2214857a7928c32de
6
+ metadata.gz: b3565c06b61ed60df2712b4138410055586273184701d2b43267527a899d0a55ed01607f5742b14d350ab95f10a8b770d03c0ed8c671f047cf9c537a8f896ac5
7
+ data.tar.gz: d15af6ab539c2cb93d7d7ec3d1b05a913f20d7803cc995b6b7f1c9d8c82d6271aaafcc2ba61632e66ff1c7ac87ea3986d030cf992c9e6b7558dd352a5bcae61c
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2016 The Grand Design
1
+ Copyright (c) 2010-2016 The Kompanee, Ltd
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
data/lib/drillbit.rb CHANGED
@@ -6,6 +6,7 @@ require 'drillbit/authorizers/parameters/filtering'
6
6
  require 'drillbit/authorizers/parameters/resource'
7
7
  require 'drillbit/authorizers/query'
8
8
  require 'drillbit/authorizers/scope'
9
+ require 'drillbit/compatibility/controllers'
9
10
  require 'drillbit/configuration'
10
11
  require 'drillbit/matchers/accept_header'
11
12
  require 'drillbit/matchers/subdomain'
@@ -100,8 +100,8 @@ module AuthorizableResource
100
100
 
101
101
  def authorized_attributes
102
102
  @authorized_attributes ||= authorized_params.
103
- fetch(:data, {}).
104
- fetch(:attributes, {})
103
+ fetch(:data, {}).
104
+ fetch(:attributes, {})
105
105
  end
106
106
 
107
107
  def authorized_resource
@@ -113,7 +113,8 @@ module AuthorizableResource
113
113
  def authorized_collection
114
114
  return nil unless RESOURCE_COLLECTION_ACTIONS.include?(action_name)
115
115
 
116
- @authorized_collection ||= Resource::Model.
116
+ @authorized_collection ||= \
117
+ Resource::Model.
117
118
  new(resource: public_send(self.class.plural_resource_name),
118
119
  parameters: authorized_params)
119
120
  end
@@ -29,8 +29,9 @@ class Filtering < Authorizers::Parameters
29
29
  end
30
30
 
31
31
  def add_filterable_parameter(name)
32
- param = params.fetch(:filter, {}).
33
- fetch(name, nil)
32
+ param = params.
33
+ fetch(:filter, {}).
34
+ fetch(name, nil)
34
35
 
35
36
  if param.class == Array
36
37
  authorized_params[1][:filter][1][name] = []
@@ -30,9 +30,10 @@ class Resource < Authorizers::Parameters
30
30
  end
31
31
 
32
32
  def add_authorized_attribute(name)
33
- param = params.fetch(:data, {}).
34
- fetch(:attributes, {}).
35
- fetch(name, nil)
33
+ param = params.
34
+ fetch(:data, {}).
35
+ fetch(:attributes, {}).
36
+ fetch(name, nil)
36
37
 
37
38
  if param.class == Array
38
39
  authorized_params[1][:data][:attributes][0][name] = []
@@ -48,9 +49,10 @@ class Resource < Authorizers::Parameters
48
49
  end
49
50
 
50
51
  def add_authorized_relationship(name)
51
- param = params.fetch(:data, {}).
52
- fetch(:relationships, {}).
53
- fetch(name, nil)
52
+ param = params.
53
+ fetch(:data, {}).
54
+ fetch(:relationships, {}).
55
+ fetch(name, nil)
54
56
 
55
57
  if param.class == Array
56
58
  authorized_params[1][:data][:relationships][0][name] = []
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+ module Drillbit
3
+ module Compatibility
4
+ module Controllers
5
+ def cache_store; end
6
+ def cache_store=(*); end
7
+ def assets_dir=(*); end
8
+ def javascripts_dir=(*); end
9
+ def stylesheets_dir=(*); end
10
+ def page_cache_directory=(*); end
11
+ def asset_path=(*); end
12
+ def asset_host=(*); end
13
+ def relative_url_root=(*); end
14
+ def perform_caching=(*); end
15
+ def helpers_path=(*); end
16
+ def allow_forgery_protection=(*); end
17
+ def helper_method(*); end
18
+ def helper(*); end
19
+ end
20
+ end
21
+ end
@@ -26,8 +26,9 @@ class Paging
26
26
  def processed
27
27
  return resource unless parameters.present?
28
28
 
29
- resource.page(parameters.page_number).
30
- per(parameters.per_page)
29
+ resource.
30
+ page(parameters.page_number).
31
+ per(parameters.per_page)
31
32
  end
32
33
 
33
34
  def meta
@@ -4,16 +4,16 @@ module Serializers
4
4
  module JsonApi
5
5
  def json_api_type
6
6
  object.
7
- class.
8
- name.
9
- gsub(/\A[^:]+::/, '').
10
- split('::').
11
- reverse.
12
- join('::').
13
- tableize.
14
- dasherize.
15
- tr('/', '-').
16
- pluralize
7
+ class.
8
+ name.
9
+ gsub(/\A[^:]+::/, '').
10
+ split('::').
11
+ reverse.
12
+ join('::').
13
+ tableize.
14
+ dasherize.
15
+ tr('/', '-').
16
+ pluralize
17
17
  end
18
18
  end
19
19
  end
@@ -177,8 +177,8 @@ class JsonWebToken
177
177
  return JsonWebTokens::Null.instance if encrypted_token.to_s == ''
178
178
 
179
179
  decrypted_token = JSON::JWT.
180
- decode(encrypted_token, private_key).
181
- plain_text
180
+ decode(encrypted_token, private_key).
181
+ plain_text
182
182
 
183
183
  from_jws(decrypted_token, private_key: private_key)
184
184
  rescue *TRANSFORMATION_EXCEPTIONS
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Drillbit
3
- VERSION = '2.2.2'
3
+ VERSION = '2.3.0'
4
4
  end
@@ -19,7 +19,7 @@ describe Filtering do
19
19
  filter_params.call
20
20
 
21
21
  expect(params).to have_received(:permit).
22
- with(:sort, include(filter: include(:name, :age)))
22
+ with(:sort, include(filter: include(:name, :age)))
23
23
  end
24
24
 
25
25
  it 'can authorize parameters if they come in as arrays', verify: false do
@@ -39,7 +39,7 @@ describe Filtering do
39
39
  filter_params.call
40
40
 
41
41
  expect(params).to have_received(:permit).
42
- with(:sort, include(filter: include(:name, ary: [])))
42
+ with(:sort, include(filter: include(:name, ary: [])))
43
43
  end
44
44
 
45
45
  it 'has default authorized parameters', verify: false do
@@ -52,18 +52,18 @@ describe Filtering do
52
52
  filter_params.call
53
53
 
54
54
  expect(params).to have_received(:permit).
55
- with(:sort,
56
- page: %i{
57
- number
58
- size
59
- offset
60
- limit
61
- cursor
62
- },
63
- filter: [
64
- :query,
65
- {},
66
- ])
55
+ with(:sort,
56
+ page: %i{
57
+ number
58
+ size
59
+ offset
60
+ limit
61
+ cursor
62
+ },
63
+ filter: [
64
+ :query,
65
+ {},
66
+ ])
67
67
  end
68
68
  end
69
69
  end
@@ -160,7 +160,7 @@ describe ApiRequestValidator, singletons: Erratum::Configuration do
160
160
  _response = api_request_middleware.call(request)
161
161
 
162
162
  expect(app).to have_received(:call).
163
- with(a_hash_including('CONTENT_TYPE' => 'application/json'))
163
+ with(a_hash_including('CONTENT_TYPE' => 'application/json'))
164
164
  end
165
165
 
166
166
  it 'properly converts the content type for Rails when it is not the only one' do
@@ -178,7 +178,7 @@ describe ApiRequestValidator, singletons: Erratum::Configuration do
178
178
  _response = api_request_middleware.call(request)
179
179
 
180
180
  expect(app).to have_received(:call).
181
- with(a_hash_including('CONTENT_TYPE' => 'application/json;other'))
181
+ with(a_hash_including('CONTENT_TYPE' => 'application/json;other'))
182
182
  end
183
183
  end
184
184
  end
@@ -24,31 +24,31 @@ describe Model do
24
24
  })
25
25
 
26
26
  allow(resource).to receive(:single_arity).
27
- and_return(resource)
27
+ and_return(resource)
28
28
  allow(resource).to receive(:multiple_arity).
29
- with('multi').
30
- and_return(resource)
29
+ with('multi').
30
+ and_return(resource)
31
31
  allow(resource).to receive(:order).
32
- with('my_attribute' => 'asc').
33
- and_return(resource)
32
+ with('my_attribute' => 'asc').
33
+ and_return(resource)
34
34
  allow(resource).to receive(:page).
35
- with(10).
36
- and_return(resource)
35
+ with(10).
36
+ and_return(resource)
37
37
  allow(resource).to receive(:per).
38
- with(100).
39
- and_return(resource)
38
+ with(100).
39
+ and_return(resource)
40
40
  allow(resource).to receive(:for_query).
41
- with('my_query').
42
- and_return(processed_resource)
41
+ with('my_query').
42
+ and_return(processed_resource)
43
43
 
44
44
  allow(processed_resource).to receive(:total_pages).
45
- and_return(10)
45
+ and_return(10)
46
46
  allow(processed_resource).to receive(:current_page).
47
- and_return(5)
47
+ and_return(5)
48
48
  allow(processed_resource).to receive(:prev_page).
49
- and_return(4)
49
+ and_return(4)
50
50
  allow(processed_resource).to receive(:next_page).
51
- and_return(6)
51
+ and_return(6)
52
52
 
53
53
  expect(model.processed).to eql processed_resource
54
54
  expect(model.meta).to eql(
@@ -21,8 +21,8 @@ describe Filtering do
21
21
  })
22
22
 
23
23
  allow(filtering_resource).to receive(:for_stuff).
24
- with('blah').
25
- and_return 'stuffed'
24
+ with('blah').
25
+ and_return 'stuffed'
26
26
 
27
27
  expect(filtering.processed).to eql 'stuffed'
28
28
  end
@@ -43,7 +43,7 @@ describe Filtering do
43
43
  })
44
44
 
45
45
  allow(filtering_resource).to receive(:stuff).
46
- and_return 'stuffed'
46
+ and_return 'stuffed'
47
47
 
48
48
  expect(filtering.processed).to eql 'stuffed'
49
49
  end
@@ -56,10 +56,10 @@ describe Filtering do
56
56
  })
57
57
 
58
58
  allow(filtering_resource).to receive(:for_stuff).
59
- with('blah').
60
- and_return filtering_resource
59
+ with('blah').
60
+ and_return filtering_resource
61
61
  allow(filtering_resource).to receive(:other_stuff).
62
- and_return 'other_stuffed'
62
+ and_return 'other_stuffed'
63
63
 
64
64
  expect(filtering.processed).to eql 'other_stuffed'
65
65
  end
@@ -73,14 +73,14 @@ describe Filtering do
73
73
  })
74
74
 
75
75
  allow(filtering_resource).to receive(:for_stuff).
76
- with(100.0...200.0).
77
- and_return filtering_resource
76
+ with(100.0...200.0).
77
+ and_return filtering_resource
78
78
  allow(filtering_resource).to receive(:infinity).
79
- with(9.0...9_999_999).
80
- and_return filtering_resource
79
+ with(9.0...9_999_999).
80
+ and_return filtering_resource
81
81
  allow(filtering_resource).to receive(:other_stuff).
82
- with(3333.33..888.0).
83
- and_return 'other_stuffed'
82
+ with(3333.33..888.0).
83
+ and_return 'other_stuffed'
84
84
 
85
85
  expect(filtering.processed).to eql 'other_stuffed'
86
86
  end
@@ -93,10 +93,10 @@ describe Filtering do
93
93
  })
94
94
 
95
95
  allow(filtering_resource).to receive(:klass).
96
- and_return(resource_class)
96
+ and_return(resource_class)
97
97
  allow(resource_class).to receive(:stuff)
98
98
  allow(filtering_resource).to receive(:stuff).
99
- and_return 'stuffed'
99
+ and_return 'stuffed'
100
100
 
101
101
  expect(filtering.processed).to eql 'stuffed'
102
102
  end
@@ -35,8 +35,8 @@ describe Indexing do
35
35
  indexing = Indexing.new(indexing_resource)
36
36
 
37
37
  allow(indexing_resource).to receive(:for_query).
38
- with('*').
39
- and_return('blah')
38
+ with('*').
39
+ and_return('blah')
40
40
 
41
41
  expect(indexing.processed).to eql 'blah'
42
42
  end
@@ -21,11 +21,11 @@ describe Paging do
21
21
  allow(paging_resource).to receive(:next_page).and_return nil
22
22
 
23
23
  allow(paging_resource).to receive(:page).
24
- with(1).
25
- and_return paging_resource
24
+ with(1).
25
+ and_return paging_resource
26
26
  allow(paging_resource).to receive(:per).
27
- with(10).
28
- and_return processed_resource
27
+ with(10).
28
+ and_return processed_resource
29
29
 
30
30
  expect(paging.processed).to eql processed_resource
31
31
  expect(paging.meta).to eql(
@@ -44,11 +44,11 @@ describe Paging do
44
44
  })
45
45
 
46
46
  allow(paging_resource).to receive(:page).
47
- with(5).
48
- and_return paging_resource
47
+ with(5).
48
+ and_return paging_resource
49
49
  allow(paging_resource).to receive(:per).
50
- with(10).
51
- and_return processed_resource
50
+ with(10).
51
+ and_return processed_resource
52
52
 
53
53
  expect(paging.processed).to eql processed_resource
54
54
  end
@@ -12,8 +12,8 @@ describe Sorting do
12
12
  sorting = Sorting.new(sorting_resource, 'sort' => 'my_attribute')
13
13
 
14
14
  allow(sorting_resource).to receive(:order).
15
- with('my_attribute' => 'asc').
16
- and_return('sorted')
15
+ with('my_attribute' => 'asc').
16
+ and_return('sorted')
17
17
 
18
18
  expect(sorting.processed).to eql 'sorted'
19
19
  expect(sorting.meta).to eql(
@@ -27,8 +27,8 @@ describe Sorting do
27
27
  sorting = Sorting.new(sorting_resource, 'sort' => '-my_attribute')
28
28
 
29
29
  allow(sorting_resource).to receive(:order).
30
- with('my_attribute' => 'desc').
31
- and_return('sorted')
30
+ with('my_attribute' => 'desc').
31
+ and_return('sorted')
32
32
 
33
33
  expect(sorting.processed).to eql 'sorted'
34
34
  expect(sorting.meta).to eql(
@@ -42,9 +42,9 @@ describe Sorting do
42
42
  sorting = Sorting.new(sorting_resource, 'sort' => '-my_attribute,my_other_attribute')
43
43
 
44
44
  allow(sorting_resource).to receive(:order).
45
- with('my_attribute' => 'desc',
46
- 'my_other_attribute' => 'asc').
47
- and_return('sorted')
45
+ with('my_attribute' => 'desc',
46
+ 'my_other_attribute' => 'asc').
47
+ and_return('sorted')
48
48
 
49
49
  expect(sorting.processed).to eql 'sorted'
50
50
  expect(sorting.meta).to eql(
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.2.2
4
+ version: 2.3.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: 2016-07-02 00:00:00.000000000 Z
34
+ date: 2016-08-06 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: erratum
@@ -134,6 +134,7 @@ files:
134
134
  - lib/drillbit/authorizers/parameters/resource.rb
135
135
  - lib/drillbit/authorizers/query.rb
136
136
  - lib/drillbit/authorizers/scope.rb
137
+ - lib/drillbit/compatibility/controllers.rb
137
138
  - lib/drillbit/configuration.rb
138
139
  - lib/drillbit/errors/invalid_api_request.rb
139
140
  - lib/drillbit/errors/invalid_request_body.rb
@@ -268,3 +269,4 @@ test_files:
268
269
  - spec/fixtures/test_rsa_key.pub
269
270
  - spec/spec_helper.rb
270
271
  - spec/support/private_keys.rb
272
+ has_rdoc:
metadata.gz.sig CHANGED
Binary file