apill 4.1.0 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,18 +5,31 @@ def test_private_key
5
5
  OpenSSL::PKey::RSA.new File.read(File.expand_path('../fixtures/test_rsa_key', __dir__))
6
6
  end
7
7
 
8
- def valid_jwt_token(payload = { 'bar' => 'baz' })
9
- @valid_token ||= begin
10
- jwt = JSON::JWT.new(payload)
11
- jws = jwt.sign(test_private_key, :RS256)
12
- jwe = jws.encrypt(test_private_key, :'RSA-OAEP', :A256GCM)
13
-
14
- jwe.to_s
15
- end
8
+ def valid_jws_token(payload = { 'bar' => 'baz' })
9
+ @valid_jws_token ||= begin
10
+ jwt = JSON::JWT.new(payload)
11
+ jws = jwt.sign(test_private_key, :RS256)
12
+
13
+ jws.to_s
14
+ end
15
+ end
16
+
17
+ def valid_jwe_token(payload = { 'bar' => 'baz' })
18
+ @valid_jwe_token ||= begin
19
+ jwt = JSON::JWT.new(payload)
20
+ jws = jwt.sign(test_private_key, :RS256)
21
+ jwe = jws.encrypt(test_private_key, :'RSA-OAEP', :A256GCM)
22
+
23
+ jwe.to_s
24
+ end
25
+ end
26
+
27
+ def invalid_jws_token
28
+ @invalid_jws_token ||= valid_jws_token.tr('a', 'f')
16
29
  end
17
30
 
18
- def invalid_jwt_token
19
- @invalid_token ||= valid_jwt_token.tr('a', 'f')
31
+ def invalid_jwe_token
32
+ @invalid_jwe_token ||= valid_jwe_token.tr('a', 'f')
20
33
  end
21
34
 
22
35
  def valid_b64_token(payload = 'hereisacoollittlestring')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apill
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jfelchner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-23 00:00:00.000000000 Z
11
+ date: 2015-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: human_error
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.0'
19
+ version: '3.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.0'
26
+ version: '3.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json-jwt
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.50'
75
+ version: '0.70'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.50'
82
+ version: '0.70'
83
83
  description: ''
84
84
  email: accounts+git@thekompanee.com
85
85
  executables: []
@@ -91,6 +91,12 @@ files:
91
91
  - Rakefile
92
92
  - lib/apill.rb
93
93
  - lib/apill/accept_header.rb
94
+ - lib/apill/authorizable_resource.rb
95
+ - lib/apill/authorizers/parameters.rb
96
+ - lib/apill/authorizers/parameters/filtering.rb
97
+ - lib/apill/authorizers/parameters/resource.rb
98
+ - lib/apill/authorizers/query.rb
99
+ - lib/apill/authorizers/scope.rb
94
100
  - lib/apill/configuration.rb
95
101
  - lib/apill/errors/invalid_api_request.rb
96
102
  - lib/apill/errors/invalid_subdomain.rb
@@ -105,12 +111,12 @@ files:
105
111
  - lib/apill/parameters/index.rb
106
112
  - lib/apill/parameters/page.rb
107
113
  - lib/apill/parameters/sort.rb
108
- - lib/apill/processable_resource.rb
109
114
  - lib/apill/requests/base.rb
110
115
  - lib/apill/requests/rack.rb
111
116
  - lib/apill/requests/rails.rb
112
117
  - lib/apill/resource.rb
113
118
  - lib/apill/resource/model.rb
119
+ - lib/apill/resource/naming.rb
114
120
  - lib/apill/resource/processors/filtering.rb
115
121
  - lib/apill/resource/processors/indexing.rb
116
122
  - lib/apill/resource/processors/paging.rb
@@ -124,11 +130,19 @@ files:
124
130
  - lib/apill/tokens/base64s/null.rb
125
131
  - lib/apill/tokens/invalid.rb
126
132
  - lib/apill/tokens/json_web_token.rb
133
+ - lib/apill/tokens/json_web_token.rb.orig
127
134
  - lib/apill/tokens/json_web_tokens/invalid.rb
135
+ - lib/apill/tokens/json_web_tokens/invalid.rb.orig
128
136
  - lib/apill/tokens/json_web_tokens/null.rb
137
+ - lib/apill/tokens/json_web_tokens/null.rb.orig
129
138
  - lib/apill/tokens/null.rb
130
139
  - lib/apill/version.rb
131
140
  - spec/apill/accept_header_spec.rb
141
+ - spec/apill/authorizers/parameters/filtering_spec.rb
142
+ - spec/apill/authorizers/parameters/resource_spec.rb
143
+ - spec/apill/authorizers/parameters_spec.rb
144
+ - spec/apill/authorizers/query_spec.rb
145
+ - spec/apill/authorizers/scope_spec.rb
132
146
  - spec/apill/errors/invalid_api_request_spec.rb
133
147
  - spec/apill/errors/invalid_subdomain_spec.rb
134
148
  - spec/apill/errors/invalid_token_spec.rb
@@ -179,6 +193,11 @@ specification_version: 4
179
193
  summary: Common API functionality
180
194
  test_files:
181
195
  - spec/apill/accept_header_spec.rb
196
+ - spec/apill/authorizers/parameters/filtering_spec.rb
197
+ - spec/apill/authorizers/parameters/resource_spec.rb
198
+ - spec/apill/authorizers/parameters_spec.rb
199
+ - spec/apill/authorizers/query_spec.rb
200
+ - spec/apill/authorizers/scope_spec.rb
182
201
  - spec/apill/errors/invalid_api_request_spec.rb
183
202
  - spec/apill/errors/invalid_subdomain_spec.rb
184
203
  - spec/apill/errors/invalid_token_spec.rb
@@ -203,3 +222,4 @@ test_files:
203
222
  - spec/fixtures/test_rsa_key.pub
204
223
  - spec/spec_helper.rb
205
224
  - spec/support/private_keys.rb
225
+ has_rdoc:
@@ -1,65 +0,0 @@
1
- require 'apill/resource/model'
2
-
3
- module Apill
4
- module ProcessableResource
5
- module ClassMethods
6
- def plural_resource_name
7
- name[/(\w+)Controller\z/, 1].
8
- underscore.
9
- pluralize.
10
- downcase
11
- end
12
-
13
- def singular_resource_name
14
- name[/(\w+)Controller\z/, 1].
15
- underscore.
16
- singularize.
17
- downcase
18
- end
19
- end
20
-
21
- def self.included(base)
22
- base.extend ClassMethods
23
- end
24
-
25
- def api_resource
26
- @resource ||= Resource::Model.new(
27
- resource: public_send(self.class.plural_resource_name),
28
- parameters: api_resource_params)
29
- end
30
-
31
- def api_resource_params
32
- params.permit(:sort,
33
- page: %i{
34
- number
35
- size
36
- offset
37
- limit
38
- cursor
39
- },
40
- filter: api_filterable_parameters)
41
- end
42
-
43
- def api_filterable_parameters
44
- @api_filterable_parameters ||= begin
45
- filter_params = params.fetch(:filter, {})
46
- scalar_params = [:query]
47
- array_params = {}
48
-
49
- api_filterable_attributes.each do |api_filterable_attribute|
50
- if filter_params[api_filterable_attribute].class == Array
51
- array_params[api_filterable_attribute] = []
52
- else
53
- scalar_params << api_filterable_attribute
54
- end
55
- end
56
-
57
- scalar_params << array_params
58
- end
59
- end
60
-
61
- def api_filterable_attributes
62
- []
63
- end
64
- end
65
- end