rrx_api 0.1.0 → 8.0.3
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/.rspec +1 -1
- data/Gemfile +3 -4
- data/Gemfile.lock +127 -118
- data/README.md +1 -1
- data/app/controllers/concerns/rrx_api/authenticatable.rb +79 -0
- data/app/controllers/rrx_api/controller.rb +1 -0
- data/app/controllers/rrx_api/health_controller.rb +33 -0
- data/app/models/concerns/arel_query.rb +189 -0
- data/app/models/rrx_api/record.rb +12 -0
- data/config/routes.rb +13 -0
- data/lib/generators/rrx_api/base.rb +95 -0
- data/lib/generators/rrx_api/docker_generator.rb +19 -0
- data/lib/generators/rrx_api/github_generator.rb +83 -0
- data/lib/generators/rrx_api/install_generator.rb +120 -0
- data/lib/generators/rrx_api/templates/docker/Dockerfile.tt +1 -0
- data/lib/generators/rrx_api/templates/github/build/workflows/build.yml.tt +71 -0
- data/lib/generators/rrx_api/templates/github/deploy/workflows/deploy.yml.tt +62 -0
- data/lib/generators/rrx_api/templates/terraform/aws/iam.tf.tt +37 -0
- data/lib/generators/rrx_api/templates/terraform/aws/main.tf.tt +44 -0
- data/lib/generators/rrx_api/templates/terraform/aws/service.tf.tt +67 -0
- data/lib/generators/rrx_api/terraform_generator.rb +76 -0
- data/lib/rrx_api/auth/base.rb +29 -0
- data/lib/rrx_api/auth/firebase.rb +70 -0
- data/lib/rrx_api/engine.rb +111 -0
- data/lib/rrx_api/version.rb +3 -2
- data/lib/rrx_api.rb +1 -1
- metadata +69 -37
- data/.idea/.gitignore +0 -8
- data/.idea/inspectionProfiles/Project_Default.xml +0 -6
- data/.idea/modules.xml +0 -8
- data/.idea/rrx_api.iml +0 -255
- data/.idea/vcs.xml +0 -6
- data/exe/rrx_api_setup +0 -37
- data/exe/sources/config/initializers/cors.rb +0 -21
- data/exe/sources/config/initializers/generators.rb +0 -6
- data/lib/rrx_api/railtie.rb +0 -44
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 704fe355ce80b8309eda6e6efe7ea7cf554a3a4925ba6877079a3083380227dd
|
|
4
|
+
data.tar.gz: 78e69441af925e8d2144d894c57668c133d3e80c67b4d2bd14bc4f84cb0d6a33
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d8fe108896f5647852a600926980dc037c4e9e564dceb7cb13ae5ff9f7917a21c7e88930537f2c440cc7f01938120fdfc0ed8c1defd60d62b312b2982316a3ba
|
|
7
|
+
data.tar.gz: 5045a736b9da7313a3993d8da3328408f10e0a7ec2ae1b1819dd252e3cd097b4fa01e30d3299a9f97b98c0f8415bd8f265ab6a1a53ee3501b36ffdb693ffd24a
|
data/.rspec
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
--require
|
|
1
|
+
--require spec_helper
|
data/Gemfile
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
source "https://rubygems.org"
|
|
4
4
|
gemspec
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
gem '
|
|
9
|
-
gem 'rrx_logging', path: '~/dev/rrx/rrx_logging'
|
|
6
|
+
PARENT_FOLDER = Pathname(__FILE__).parent.parent
|
|
7
|
+
gem 'rrx_dev', path: PARENT_FOLDER.join('rrx_dev') if PARENT_FOLDER.join('rrx_dev').exist?
|
|
8
|
+
gem 'rrx_logging', path: PARENT_FOLDER.join('rrx_logging') if PARENT_FOLDER.join('rrx_logging').exist?
|
data/Gemfile.lock
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ../rrx_dev
|
|
3
3
|
specs:
|
|
4
|
-
rrx_dev (0.
|
|
4
|
+
rrx_dev (8.0.2)
|
|
5
5
|
active_record_query_trace
|
|
6
|
-
activesupport (~>
|
|
6
|
+
activesupport (~> 8.0.2)
|
|
7
7
|
bootsnap
|
|
8
8
|
debug
|
|
9
|
+
factory_bot
|
|
9
10
|
factory_bot_rails
|
|
10
11
|
listen
|
|
11
|
-
railties (~>
|
|
12
|
+
railties (~> 8.0.2)
|
|
12
13
|
rake (>= 13.0)
|
|
13
14
|
rspec (>= 3.0)
|
|
14
15
|
rspec-parameterized
|
|
@@ -22,125 +23,123 @@ PATH
|
|
|
22
23
|
PATH
|
|
23
24
|
remote: ../rrx_logging
|
|
24
25
|
specs:
|
|
25
|
-
rrx_logging (0.
|
|
26
|
-
activesupport
|
|
27
|
-
railties
|
|
28
|
-
rrx_config
|
|
26
|
+
rrx_logging (8.0.2)
|
|
27
|
+
activesupport (~> 8.0.2)
|
|
28
|
+
railties (~> 8.0.2)
|
|
29
|
+
rrx_config (~> 8.0.2)
|
|
29
30
|
|
|
30
31
|
PATH
|
|
31
32
|
remote: .
|
|
32
33
|
specs:
|
|
33
|
-
rrx_api (0.
|
|
34
|
+
rrx_api (8.0.2)
|
|
34
35
|
actionpack-action_caching
|
|
35
36
|
bootsnap
|
|
36
37
|
faraday
|
|
37
38
|
faraday_middleware
|
|
38
|
-
jbuilder
|
|
39
|
+
jbuilder (~> 2.13)
|
|
39
40
|
kaminari
|
|
40
41
|
puma
|
|
41
42
|
rack-cors
|
|
42
|
-
rails (~>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
rrx_logging
|
|
43
|
+
rails (~> 8.0.2)
|
|
44
|
+
rrx_config (~> 8.0.2)
|
|
45
|
+
rrx_logging (~> 8.0.2)
|
|
46
46
|
rswag-api
|
|
47
47
|
rswag-ui
|
|
48
|
+
thor
|
|
48
49
|
tzinfo-data
|
|
49
50
|
|
|
50
51
|
GEM
|
|
51
52
|
remote: https://rubygems.org/
|
|
52
53
|
specs:
|
|
53
|
-
actioncable (
|
|
54
|
-
actionpack (=
|
|
55
|
-
activesupport (=
|
|
54
|
+
actioncable (8.0.2)
|
|
55
|
+
actionpack (= 8.0.2)
|
|
56
|
+
activesupport (= 8.0.2)
|
|
56
57
|
nio4r (~> 2.0)
|
|
57
58
|
websocket-driver (>= 0.6.1)
|
|
58
59
|
zeitwerk (~> 2.6)
|
|
59
|
-
actionmailbox (
|
|
60
|
-
actionpack (=
|
|
61
|
-
activejob (=
|
|
62
|
-
activerecord (=
|
|
63
|
-
activestorage (=
|
|
64
|
-
activesupport (=
|
|
65
|
-
mail (>= 2.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
activejob (= 7.1.2)
|
|
73
|
-
activesupport (= 7.1.2)
|
|
74
|
-
mail (~> 2.5, >= 2.5.4)
|
|
75
|
-
net-imap
|
|
76
|
-
net-pop
|
|
77
|
-
net-smtp
|
|
60
|
+
actionmailbox (8.0.2)
|
|
61
|
+
actionpack (= 8.0.2)
|
|
62
|
+
activejob (= 8.0.2)
|
|
63
|
+
activerecord (= 8.0.2)
|
|
64
|
+
activestorage (= 8.0.2)
|
|
65
|
+
activesupport (= 8.0.2)
|
|
66
|
+
mail (>= 2.8.0)
|
|
67
|
+
actionmailer (8.0.2)
|
|
68
|
+
actionpack (= 8.0.2)
|
|
69
|
+
actionview (= 8.0.2)
|
|
70
|
+
activejob (= 8.0.2)
|
|
71
|
+
activesupport (= 8.0.2)
|
|
72
|
+
mail (>= 2.8.0)
|
|
78
73
|
rails-dom-testing (~> 2.2)
|
|
79
|
-
actionpack (
|
|
80
|
-
actionview (=
|
|
81
|
-
activesupport (=
|
|
74
|
+
actionpack (8.0.2)
|
|
75
|
+
actionview (= 8.0.2)
|
|
76
|
+
activesupport (= 8.0.2)
|
|
82
77
|
nokogiri (>= 1.8.5)
|
|
83
|
-
racc
|
|
84
78
|
rack (>= 2.2.4)
|
|
85
79
|
rack-session (>= 1.0.1)
|
|
86
80
|
rack-test (>= 0.6.3)
|
|
87
81
|
rails-dom-testing (~> 2.2)
|
|
88
82
|
rails-html-sanitizer (~> 1.6)
|
|
83
|
+
useragent (~> 0.16)
|
|
89
84
|
actionpack-action_caching (1.2.2)
|
|
90
85
|
actionpack (>= 4.0.0)
|
|
91
|
-
actiontext (
|
|
92
|
-
actionpack (=
|
|
93
|
-
activerecord (=
|
|
94
|
-
activestorage (=
|
|
95
|
-
activesupport (=
|
|
86
|
+
actiontext (8.0.2)
|
|
87
|
+
actionpack (= 8.0.2)
|
|
88
|
+
activerecord (= 8.0.2)
|
|
89
|
+
activestorage (= 8.0.2)
|
|
90
|
+
activesupport (= 8.0.2)
|
|
96
91
|
globalid (>= 0.6.0)
|
|
97
92
|
nokogiri (>= 1.8.5)
|
|
98
|
-
actionview (
|
|
99
|
-
activesupport (=
|
|
93
|
+
actionview (8.0.2)
|
|
94
|
+
activesupport (= 8.0.2)
|
|
100
95
|
builder (~> 3.1)
|
|
101
96
|
erubi (~> 1.11)
|
|
102
97
|
rails-dom-testing (~> 2.2)
|
|
103
98
|
rails-html-sanitizer (~> 1.6)
|
|
104
|
-
active_record_query_trace (1.
|
|
99
|
+
active_record_query_trace (1.9)
|
|
105
100
|
activerecord (>= 6.0.0)
|
|
106
|
-
activejob (
|
|
107
|
-
activesupport (=
|
|
101
|
+
activejob (8.0.2)
|
|
102
|
+
activesupport (= 8.0.2)
|
|
108
103
|
globalid (>= 0.3.6)
|
|
109
|
-
activemodel (
|
|
110
|
-
activesupport (=
|
|
111
|
-
activerecord (
|
|
112
|
-
activemodel (=
|
|
113
|
-
activesupport (=
|
|
104
|
+
activemodel (8.0.2)
|
|
105
|
+
activesupport (= 8.0.2)
|
|
106
|
+
activerecord (8.0.2)
|
|
107
|
+
activemodel (= 8.0.2)
|
|
108
|
+
activesupport (= 8.0.2)
|
|
114
109
|
timeout (>= 0.4.0)
|
|
115
|
-
activestorage (
|
|
116
|
-
actionpack (=
|
|
117
|
-
activejob (=
|
|
118
|
-
activerecord (=
|
|
119
|
-
activesupport (=
|
|
110
|
+
activestorage (8.0.2)
|
|
111
|
+
actionpack (= 8.0.2)
|
|
112
|
+
activejob (= 8.0.2)
|
|
113
|
+
activerecord (= 8.0.2)
|
|
114
|
+
activesupport (= 8.0.2)
|
|
120
115
|
marcel (~> 1.0)
|
|
121
|
-
activesupport (
|
|
116
|
+
activesupport (8.0.2)
|
|
122
117
|
base64
|
|
118
|
+
benchmark (>= 0.3)
|
|
123
119
|
bigdecimal
|
|
124
|
-
concurrent-ruby (~> 1.0, >= 1.
|
|
120
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
125
121
|
connection_pool (>= 2.2.5)
|
|
126
122
|
drb
|
|
127
123
|
i18n (>= 1.6, < 2)
|
|
124
|
+
logger (>= 1.4.2)
|
|
128
125
|
minitest (>= 5.1)
|
|
129
|
-
|
|
130
|
-
tzinfo (~> 2.0)
|
|
126
|
+
securerandom (>= 0.3)
|
|
127
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
128
|
+
uri (>= 0.13.1)
|
|
131
129
|
addressable (2.8.6)
|
|
132
130
|
public_suffix (>= 2.0.2, < 6.0)
|
|
133
131
|
ast (2.4.2)
|
|
134
|
-
base64 (0.
|
|
135
|
-
|
|
132
|
+
base64 (0.3.0)
|
|
133
|
+
benchmark (0.4.1)
|
|
134
|
+
bigdecimal (3.2.2)
|
|
136
135
|
binding_of_caller (1.0.0)
|
|
137
136
|
debug_inspector (>= 0.0.1)
|
|
138
137
|
bootsnap (1.17.0)
|
|
139
138
|
msgpack (~> 1.2)
|
|
140
|
-
builder (3.
|
|
139
|
+
builder (3.3.0)
|
|
141
140
|
coderay (1.1.3)
|
|
142
|
-
concurrent-ruby (1.
|
|
143
|
-
connection_pool (2.
|
|
141
|
+
concurrent-ruby (1.3.5)
|
|
142
|
+
connection_pool (2.5.3)
|
|
144
143
|
crass (1.0.6)
|
|
145
144
|
date (3.3.4)
|
|
146
145
|
debug (1.9.1)
|
|
@@ -148,9 +147,9 @@ GEM
|
|
|
148
147
|
reline (>= 0.3.8)
|
|
149
148
|
debug_inspector (1.2.0)
|
|
150
149
|
diff-lcs (1.5.0)
|
|
151
|
-
drb (2.2.
|
|
152
|
-
|
|
153
|
-
erubi (1.
|
|
150
|
+
drb (2.2.3)
|
|
151
|
+
erb (5.0.2)
|
|
152
|
+
erubi (1.13.1)
|
|
154
153
|
factory_bot (6.4.5)
|
|
155
154
|
activesupport (>= 5.0.0)
|
|
156
155
|
factory_bot_rails (6.4.3)
|
|
@@ -182,15 +181,19 @@ GEM
|
|
|
182
181
|
faraday_middleware (1.2.0)
|
|
183
182
|
faraday (~> 1.0)
|
|
184
183
|
ffi (1.16.3)
|
|
184
|
+
generator_spec (0.10.0)
|
|
185
|
+
activesupport (>= 3.0.0)
|
|
186
|
+
railties (>= 3.0.0)
|
|
185
187
|
globalid (1.2.1)
|
|
186
188
|
activesupport (>= 6.1)
|
|
187
|
-
i18n (1.14.
|
|
189
|
+
i18n (1.14.7)
|
|
188
190
|
concurrent-ruby (~> 1.0)
|
|
189
191
|
io-console (0.7.1)
|
|
190
|
-
irb (1.
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
irb (1.15.2)
|
|
193
|
+
pp (>= 0.6.0)
|
|
194
|
+
rdoc (>= 4.0.0)
|
|
195
|
+
reline (>= 0.4.2)
|
|
196
|
+
jbuilder (2.13.0)
|
|
194
197
|
actionview (>= 5.0.0)
|
|
195
198
|
activesupport (>= 5.0.0)
|
|
196
199
|
json (2.7.1)
|
|
@@ -212,7 +215,8 @@ GEM
|
|
|
212
215
|
listen (3.8.0)
|
|
213
216
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
214
217
|
rb-inotify (~> 0.9, >= 0.9.10)
|
|
215
|
-
|
|
218
|
+
logger (1.7.0)
|
|
219
|
+
loofah (2.24.1)
|
|
216
220
|
crass (~> 1.0.2)
|
|
217
221
|
nokogiri (>= 1.12.0)
|
|
218
222
|
mail (2.8.1)
|
|
@@ -222,10 +226,9 @@ GEM
|
|
|
222
226
|
net-smtp
|
|
223
227
|
marcel (1.0.2)
|
|
224
228
|
mini_mime (1.1.5)
|
|
225
|
-
minitest (5.
|
|
229
|
+
minitest (5.25.5)
|
|
226
230
|
msgpack (1.7.2)
|
|
227
231
|
multipart-post (2.3.0)
|
|
228
|
-
mutex_m (0.2.0)
|
|
229
232
|
net-imap (0.4.9)
|
|
230
233
|
date
|
|
231
234
|
net-protocol
|
|
@@ -236,12 +239,15 @@ GEM
|
|
|
236
239
|
net-smtp (0.4.0)
|
|
237
240
|
net-protocol
|
|
238
241
|
nio4r (2.7.0)
|
|
239
|
-
nokogiri (1.
|
|
242
|
+
nokogiri (1.18.8-x86_64-linux-gnu)
|
|
240
243
|
racc (~> 1.4)
|
|
241
244
|
parallel (1.24.0)
|
|
242
245
|
parser (3.2.2.4)
|
|
243
246
|
ast (~> 2.4.1)
|
|
244
247
|
racc
|
|
248
|
+
pp (0.6.2)
|
|
249
|
+
prettyprint
|
|
250
|
+
prettyprint (0.2.0)
|
|
245
251
|
proc_to_ast (0.1.0)
|
|
246
252
|
coderay
|
|
247
253
|
parser
|
|
@@ -251,7 +257,7 @@ GEM
|
|
|
251
257
|
public_suffix (5.0.4)
|
|
252
258
|
puma (6.4.0)
|
|
253
259
|
nio4r (~> 2.0)
|
|
254
|
-
racc (1.
|
|
260
|
+
racc (1.8.1)
|
|
255
261
|
rack (3.0.8)
|
|
256
262
|
rack-cors (2.0.1)
|
|
257
263
|
rack (>= 2.0.0)
|
|
@@ -262,34 +268,31 @@ GEM
|
|
|
262
268
|
rackup (2.1.0)
|
|
263
269
|
rack (>= 3)
|
|
264
270
|
webrick (~> 1.8)
|
|
265
|
-
rails (
|
|
266
|
-
actioncable (=
|
|
267
|
-
actionmailbox (=
|
|
268
|
-
actionmailer (=
|
|
269
|
-
actionpack (=
|
|
270
|
-
actiontext (=
|
|
271
|
-
actionview (=
|
|
272
|
-
activejob (=
|
|
273
|
-
activemodel (=
|
|
274
|
-
activerecord (=
|
|
275
|
-
activestorage (=
|
|
276
|
-
activesupport (=
|
|
271
|
+
rails (8.0.2)
|
|
272
|
+
actioncable (= 8.0.2)
|
|
273
|
+
actionmailbox (= 8.0.2)
|
|
274
|
+
actionmailer (= 8.0.2)
|
|
275
|
+
actionpack (= 8.0.2)
|
|
276
|
+
actiontext (= 8.0.2)
|
|
277
|
+
actionview (= 8.0.2)
|
|
278
|
+
activejob (= 8.0.2)
|
|
279
|
+
activemodel (= 8.0.2)
|
|
280
|
+
activerecord (= 8.0.2)
|
|
281
|
+
activestorage (= 8.0.2)
|
|
282
|
+
activesupport (= 8.0.2)
|
|
277
283
|
bundler (>= 1.15.0)
|
|
278
|
-
railties (=
|
|
279
|
-
rails-dom-testing (2.
|
|
284
|
+
railties (= 8.0.2)
|
|
285
|
+
rails-dom-testing (2.3.0)
|
|
280
286
|
activesupport (>= 5.0.0)
|
|
281
287
|
minitest
|
|
282
288
|
nokogiri (>= 1.6)
|
|
283
|
-
rails-
|
|
284
|
-
actionpack
|
|
285
|
-
railties
|
|
286
|
-
rails-html-sanitizer (1.6.0)
|
|
289
|
+
rails-html-sanitizer (1.6.2)
|
|
287
290
|
loofah (~> 2.21)
|
|
288
|
-
nokogiri (
|
|
289
|
-
railties (
|
|
290
|
-
actionpack (=
|
|
291
|
-
activesupport (=
|
|
292
|
-
irb
|
|
291
|
+
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
|
292
|
+
railties (8.0.2)
|
|
293
|
+
actionpack (= 8.0.2)
|
|
294
|
+
activesupport (= 8.0.2)
|
|
295
|
+
irb (~> 1.13)
|
|
293
296
|
rackup (>= 1.0.0)
|
|
294
297
|
rake (>= 12.2)
|
|
295
298
|
thor (~> 1.0, >= 1.2.2)
|
|
@@ -299,13 +302,15 @@ GEM
|
|
|
299
302
|
rb-fsevent (0.11.2)
|
|
300
303
|
rb-inotify (0.10.1)
|
|
301
304
|
ffi (~> 1.0)
|
|
302
|
-
rdoc (6.
|
|
305
|
+
rdoc (6.14.2)
|
|
306
|
+
erb
|
|
303
307
|
psych (>= 4.0.0)
|
|
304
308
|
regexp_parser (2.8.3)
|
|
305
|
-
reline (0.
|
|
309
|
+
reline (0.6.1)
|
|
306
310
|
io-console (~> 0.5)
|
|
307
311
|
rexml (3.2.6)
|
|
308
|
-
rrx_config (0.
|
|
312
|
+
rrx_config (8.0.2)
|
|
313
|
+
activesupport
|
|
309
314
|
railties
|
|
310
315
|
rspec (3.12.0)
|
|
311
316
|
rspec-core (~> 3.12.0)
|
|
@@ -339,17 +344,17 @@ GEM
|
|
|
339
344
|
rspec-mocks (~> 3.12)
|
|
340
345
|
rspec-support (~> 3.12)
|
|
341
346
|
rspec-support (3.12.1)
|
|
342
|
-
rswag-api (2.
|
|
343
|
-
activesupport (>=
|
|
344
|
-
railties (>=
|
|
345
|
-
rswag-specs (2.
|
|
346
|
-
activesupport (>=
|
|
347
|
-
json-schema (>= 2.2, <
|
|
348
|
-
railties (>=
|
|
347
|
+
rswag-api (2.16.0)
|
|
348
|
+
activesupport (>= 5.2, < 8.1)
|
|
349
|
+
railties (>= 5.2, < 8.1)
|
|
350
|
+
rswag-specs (2.16.0)
|
|
351
|
+
activesupport (>= 5.2, < 8.1)
|
|
352
|
+
json-schema (>= 2.2, < 6.0)
|
|
353
|
+
railties (>= 5.2, < 8.1)
|
|
349
354
|
rspec-core (>= 2.14)
|
|
350
|
-
rswag-ui (2.
|
|
351
|
-
actionpack (>=
|
|
352
|
-
railties (>=
|
|
355
|
+
rswag-ui (2.16.0)
|
|
356
|
+
actionpack (>= 5.2, < 8.1)
|
|
357
|
+
railties (>= 5.2, < 8.1)
|
|
353
358
|
rubocop (1.59.0)
|
|
354
359
|
json (~> 2.3)
|
|
355
360
|
language_server-protocol (>= 3.17.0)
|
|
@@ -370,8 +375,9 @@ GEM
|
|
|
370
375
|
rubocop-ast (>= 1.30.0, < 2.0)
|
|
371
376
|
ruby-progressbar (1.13.0)
|
|
372
377
|
ruby2_keywords (0.0.5)
|
|
378
|
+
securerandom (0.4.1)
|
|
373
379
|
spring (4.1.3)
|
|
374
|
-
sqlite3 (
|
|
380
|
+
sqlite3 (2.7.3-x86_64-linux-gnu)
|
|
375
381
|
stringio (3.1.0)
|
|
376
382
|
thor (1.3.0)
|
|
377
383
|
timeout (0.4.1)
|
|
@@ -383,6 +389,8 @@ GEM
|
|
|
383
389
|
unparser (0.6.10)
|
|
384
390
|
diff-lcs (~> 1.3)
|
|
385
391
|
parser (>= 3.2.2.4)
|
|
392
|
+
uri (1.0.3)
|
|
393
|
+
useragent (0.16.11)
|
|
386
394
|
webrick (1.8.1)
|
|
387
395
|
websocket-driver (0.7.6)
|
|
388
396
|
websocket-extensions (>= 0.1.0)
|
|
@@ -393,6 +401,7 @@ PLATFORMS
|
|
|
393
401
|
x86_64-linux
|
|
394
402
|
|
|
395
403
|
DEPENDENCIES
|
|
404
|
+
generator_spec
|
|
396
405
|
rrx_api!
|
|
397
406
|
rrx_dev!
|
|
398
407
|
rrx_logging!
|
data/README.md
CHANGED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RrxApi
|
|
4
|
+
# Controller concern providing authentication plumbing.
|
|
5
|
+
#
|
|
6
|
+
# Include this in your ApplicationController (it is included in RrxApi::Controller
|
|
7
|
+
# by default). Then call +authenticate!+ on any controller that requires auth:
|
|
8
|
+
#
|
|
9
|
+
# class Api::V1::PostsController < ApplicationController
|
|
10
|
+
# authenticate!
|
|
11
|
+
# end
|
|
12
|
+
#
|
|
13
|
+
# Override +authenticated_user+ in your ApplicationController to resolve the
|
|
14
|
+
# current user from the request (token, API key, etc.). The default implementation
|
|
15
|
+
# returns +nil+, which means all requests are unauthenticated unless overridden.
|
|
16
|
+
#
|
|
17
|
+
# In test environments, requests may pass an +X-Test-User-Id+ header instead of
|
|
18
|
+
# a real token. Override +test_user+ if your User model has a different lookup.
|
|
19
|
+
module Authenticatable
|
|
20
|
+
extend ActiveSupport::Concern
|
|
21
|
+
|
|
22
|
+
AUTH_HEADER = 'Authorization'
|
|
23
|
+
BEARER_TOKEN = 'Bearer'
|
|
24
|
+
|
|
25
|
+
included do
|
|
26
|
+
rescue_from RrxApi::Auth::TokenExpiredError do
|
|
27
|
+
render json: { error: 'token_expired' }, status: :unauthorized
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
class_methods do
|
|
32
|
+
# Prepend a before_action that calls +authenticate_user!+.
|
|
33
|
+
# @param only [Array<Symbol>, nil]
|
|
34
|
+
# @param except [Array<Symbol>, nil]
|
|
35
|
+
def authenticate!(only: nil, except: nil)
|
|
36
|
+
prepend_before_action :authenticate_user!, only: only, except: except
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Returns the authenticated user or +nil+.
|
|
41
|
+
# In test env the +X-Test-User-Id+ header short-circuits real auth.
|
|
42
|
+
def current_user
|
|
43
|
+
@current_user ||= (Rails.env.test? ? test_user : nil) || authenticated_user
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
private
|
|
47
|
+
|
|
48
|
+
# Render 401 unless current_user is present.
|
|
49
|
+
def authenticate_user!
|
|
50
|
+
unauthorized! unless current_user
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Render a standardised 401 response.
|
|
54
|
+
# @param message [String]
|
|
55
|
+
def unauthorized!(message: 'Not authenticated')
|
|
56
|
+
render json: { error: message }, status: :unauthorized
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Resolve the current user from the request. Override this in your
|
|
60
|
+
# ApplicationController — e.g. look up by API key or bearer token.
|
|
61
|
+
# @return [Object, nil]
|
|
62
|
+
def authenticated_user
|
|
63
|
+
nil
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Yields the bearer token string if an +Authorization: Bearer <token>+ header is present.
|
|
67
|
+
def with_bearer_token
|
|
68
|
+
parts = request.headers[AUTH_HEADER]&.split(' ', 2)
|
|
69
|
+
yield parts[1] if parts&.first == BEARER_TOKEN
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Returns a user identified by the +X-Test-User-Id+ request header.
|
|
73
|
+
# Only active in the test environment. Override if your lookup differs.
|
|
74
|
+
# @return [Object, nil]
|
|
75
|
+
def test_user
|
|
76
|
+
nil
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RrxApi
|
|
4
|
+
# Replaces the default Rails health check controller
|
|
5
|
+
class HealthController < RrxApi::Controller
|
|
6
|
+
rescue_from(Exception) { |error| render_down(error) }
|
|
7
|
+
|
|
8
|
+
def show
|
|
9
|
+
check
|
|
10
|
+
render_up
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
protected
|
|
14
|
+
|
|
15
|
+
def check
|
|
16
|
+
healthcheck = Rails.application.config.healthcheck
|
|
17
|
+
instance_exec(&healthcheck) if healthcheck.respond_to?(:call)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def render_up
|
|
21
|
+
render json: { status: 'up' }, status: :ok
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# @param [Exception] error
|
|
25
|
+
def render_down(error)
|
|
26
|
+
render json: {
|
|
27
|
+
status: 'down',
|
|
28
|
+
message: error.message,
|
|
29
|
+
full_message: error.full_message(order: :top)
|
|
30
|
+
}, status: :internal_server_error
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|