rrx_api 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +109 -0
- data/.idea/.gitignore +8 -0
- data/.idea/inspectionProfiles/Project_Default.xml +6 -0
- data/.idea/modules.xml +8 -0
- data/.idea/rrx_api.iml +255 -0
- data/.idea/vcs.xml +6 -0
- data/.rspec +1 -0
- data/.rubocop.yml +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +402 -0
- data/LICENSE.txt +21 -0
- data/README.md +51 -0
- data/Rakefile +12 -0
- data/app/controllers/rrx_api/controller.rb +14 -0
- data/app/models/rrx_api/record.rb +12 -0
- data/exe/rrx_api_setup +37 -0
- data/exe/sources/config/initializers/cors.rb +21 -0
- data/exe/sources/config/initializers/generators.rb +6 -0
- data/lib/rrx_api/railtie.rb +44 -0
- data/lib/rrx_api/version.rb +6 -0
- data/lib/rrx_api.rb +12 -0
- data/sig/rrx_api.rbs +4 -0
- metadata +293 -0
data/Gemfile.lock
ADDED
@@ -0,0 +1,402 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ../rrx_dev
|
3
|
+
specs:
|
4
|
+
rrx_dev (0.1.0)
|
5
|
+
active_record_query_trace
|
6
|
+
activesupport (~> 7.1.0)
|
7
|
+
bootsnap
|
8
|
+
debug
|
9
|
+
factory_bot_rails
|
10
|
+
listen
|
11
|
+
railties (~> 7.1.0)
|
12
|
+
rake (>= 13.0)
|
13
|
+
rspec (>= 3.0)
|
14
|
+
rspec-parameterized
|
15
|
+
rspec-rails
|
16
|
+
rswag-specs
|
17
|
+
rubocop (>= 1.21)
|
18
|
+
rubocop-rails
|
19
|
+
spring
|
20
|
+
thor
|
21
|
+
|
22
|
+
PATH
|
23
|
+
remote: ../rrx_logging
|
24
|
+
specs:
|
25
|
+
rrx_logging (0.1.0)
|
26
|
+
activesupport
|
27
|
+
railties
|
28
|
+
rrx_config
|
29
|
+
|
30
|
+
PATH
|
31
|
+
remote: .
|
32
|
+
specs:
|
33
|
+
rrx_api (0.1.0)
|
34
|
+
actionpack-action_caching
|
35
|
+
bootsnap
|
36
|
+
faraday
|
37
|
+
faraday_middleware
|
38
|
+
jbuilder
|
39
|
+
kaminari
|
40
|
+
puma
|
41
|
+
rack-cors
|
42
|
+
rails (~> 7.0)
|
43
|
+
rails-healthcheck
|
44
|
+
rrx_config
|
45
|
+
rrx_logging
|
46
|
+
rswag-api
|
47
|
+
rswag-ui
|
48
|
+
tzinfo-data
|
49
|
+
|
50
|
+
GEM
|
51
|
+
remote: https://rubygems.org/
|
52
|
+
specs:
|
53
|
+
actioncable (7.1.2)
|
54
|
+
actionpack (= 7.1.2)
|
55
|
+
activesupport (= 7.1.2)
|
56
|
+
nio4r (~> 2.0)
|
57
|
+
websocket-driver (>= 0.6.1)
|
58
|
+
zeitwerk (~> 2.6)
|
59
|
+
actionmailbox (7.1.2)
|
60
|
+
actionpack (= 7.1.2)
|
61
|
+
activejob (= 7.1.2)
|
62
|
+
activerecord (= 7.1.2)
|
63
|
+
activestorage (= 7.1.2)
|
64
|
+
activesupport (= 7.1.2)
|
65
|
+
mail (>= 2.7.1)
|
66
|
+
net-imap
|
67
|
+
net-pop
|
68
|
+
net-smtp
|
69
|
+
actionmailer (7.1.2)
|
70
|
+
actionpack (= 7.1.2)
|
71
|
+
actionview (= 7.1.2)
|
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
|
78
|
+
rails-dom-testing (~> 2.2)
|
79
|
+
actionpack (7.1.2)
|
80
|
+
actionview (= 7.1.2)
|
81
|
+
activesupport (= 7.1.2)
|
82
|
+
nokogiri (>= 1.8.5)
|
83
|
+
racc
|
84
|
+
rack (>= 2.2.4)
|
85
|
+
rack-session (>= 1.0.1)
|
86
|
+
rack-test (>= 0.6.3)
|
87
|
+
rails-dom-testing (~> 2.2)
|
88
|
+
rails-html-sanitizer (~> 1.6)
|
89
|
+
actionpack-action_caching (1.2.2)
|
90
|
+
actionpack (>= 4.0.0)
|
91
|
+
actiontext (7.1.2)
|
92
|
+
actionpack (= 7.1.2)
|
93
|
+
activerecord (= 7.1.2)
|
94
|
+
activestorage (= 7.1.2)
|
95
|
+
activesupport (= 7.1.2)
|
96
|
+
globalid (>= 0.6.0)
|
97
|
+
nokogiri (>= 1.8.5)
|
98
|
+
actionview (7.1.2)
|
99
|
+
activesupport (= 7.1.2)
|
100
|
+
builder (~> 3.1)
|
101
|
+
erubi (~> 1.11)
|
102
|
+
rails-dom-testing (~> 2.2)
|
103
|
+
rails-html-sanitizer (~> 1.6)
|
104
|
+
active_record_query_trace (1.8.2)
|
105
|
+
activerecord (>= 6.0.0)
|
106
|
+
activejob (7.1.2)
|
107
|
+
activesupport (= 7.1.2)
|
108
|
+
globalid (>= 0.3.6)
|
109
|
+
activemodel (7.1.2)
|
110
|
+
activesupport (= 7.1.2)
|
111
|
+
activerecord (7.1.2)
|
112
|
+
activemodel (= 7.1.2)
|
113
|
+
activesupport (= 7.1.2)
|
114
|
+
timeout (>= 0.4.0)
|
115
|
+
activestorage (7.1.2)
|
116
|
+
actionpack (= 7.1.2)
|
117
|
+
activejob (= 7.1.2)
|
118
|
+
activerecord (= 7.1.2)
|
119
|
+
activesupport (= 7.1.2)
|
120
|
+
marcel (~> 1.0)
|
121
|
+
activesupport (7.1.2)
|
122
|
+
base64
|
123
|
+
bigdecimal
|
124
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
125
|
+
connection_pool (>= 2.2.5)
|
126
|
+
drb
|
127
|
+
i18n (>= 1.6, < 2)
|
128
|
+
minitest (>= 5.1)
|
129
|
+
mutex_m
|
130
|
+
tzinfo (~> 2.0)
|
131
|
+
addressable (2.8.6)
|
132
|
+
public_suffix (>= 2.0.2, < 6.0)
|
133
|
+
ast (2.4.2)
|
134
|
+
base64 (0.2.0)
|
135
|
+
bigdecimal (3.1.5)
|
136
|
+
binding_of_caller (1.0.0)
|
137
|
+
debug_inspector (>= 0.0.1)
|
138
|
+
bootsnap (1.17.0)
|
139
|
+
msgpack (~> 1.2)
|
140
|
+
builder (3.2.4)
|
141
|
+
coderay (1.1.3)
|
142
|
+
concurrent-ruby (1.2.2)
|
143
|
+
connection_pool (2.4.1)
|
144
|
+
crass (1.0.6)
|
145
|
+
date (3.3.4)
|
146
|
+
debug (1.9.1)
|
147
|
+
irb (~> 1.10)
|
148
|
+
reline (>= 0.3.8)
|
149
|
+
debug_inspector (1.2.0)
|
150
|
+
diff-lcs (1.5.0)
|
151
|
+
drb (2.2.0)
|
152
|
+
ruby2_keywords
|
153
|
+
erubi (1.12.0)
|
154
|
+
factory_bot (6.4.5)
|
155
|
+
activesupport (>= 5.0.0)
|
156
|
+
factory_bot_rails (6.4.3)
|
157
|
+
factory_bot (~> 6.4)
|
158
|
+
railties (>= 5.0.0)
|
159
|
+
faraday (1.10.3)
|
160
|
+
faraday-em_http (~> 1.0)
|
161
|
+
faraday-em_synchrony (~> 1.0)
|
162
|
+
faraday-excon (~> 1.1)
|
163
|
+
faraday-httpclient (~> 1.0)
|
164
|
+
faraday-multipart (~> 1.0)
|
165
|
+
faraday-net_http (~> 1.0)
|
166
|
+
faraday-net_http_persistent (~> 1.0)
|
167
|
+
faraday-patron (~> 1.0)
|
168
|
+
faraday-rack (~> 1.0)
|
169
|
+
faraday-retry (~> 1.0)
|
170
|
+
ruby2_keywords (>= 0.0.4)
|
171
|
+
faraday-em_http (1.0.0)
|
172
|
+
faraday-em_synchrony (1.0.0)
|
173
|
+
faraday-excon (1.1.0)
|
174
|
+
faraday-httpclient (1.0.1)
|
175
|
+
faraday-multipart (1.0.4)
|
176
|
+
multipart-post (~> 2)
|
177
|
+
faraday-net_http (1.0.1)
|
178
|
+
faraday-net_http_persistent (1.2.0)
|
179
|
+
faraday-patron (1.0.0)
|
180
|
+
faraday-rack (1.0.0)
|
181
|
+
faraday-retry (1.0.3)
|
182
|
+
faraday_middleware (1.2.0)
|
183
|
+
faraday (~> 1.0)
|
184
|
+
ffi (1.16.3)
|
185
|
+
globalid (1.2.1)
|
186
|
+
activesupport (>= 6.1)
|
187
|
+
i18n (1.14.1)
|
188
|
+
concurrent-ruby (~> 1.0)
|
189
|
+
io-console (0.7.1)
|
190
|
+
irb (1.11.0)
|
191
|
+
rdoc
|
192
|
+
reline (>= 0.3.8)
|
193
|
+
jbuilder (2.11.5)
|
194
|
+
actionview (>= 5.0.0)
|
195
|
+
activesupport (>= 5.0.0)
|
196
|
+
json (2.7.1)
|
197
|
+
json-schema (4.1.1)
|
198
|
+
addressable (>= 2.8)
|
199
|
+
kaminari (1.2.2)
|
200
|
+
activesupport (>= 4.1.0)
|
201
|
+
kaminari-actionview (= 1.2.2)
|
202
|
+
kaminari-activerecord (= 1.2.2)
|
203
|
+
kaminari-core (= 1.2.2)
|
204
|
+
kaminari-actionview (1.2.2)
|
205
|
+
actionview
|
206
|
+
kaminari-core (= 1.2.2)
|
207
|
+
kaminari-activerecord (1.2.2)
|
208
|
+
activerecord
|
209
|
+
kaminari-core (= 1.2.2)
|
210
|
+
kaminari-core (1.2.2)
|
211
|
+
language_server-protocol (3.17.0.3)
|
212
|
+
listen (3.8.0)
|
213
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
214
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
215
|
+
loofah (2.22.0)
|
216
|
+
crass (~> 1.0.2)
|
217
|
+
nokogiri (>= 1.12.0)
|
218
|
+
mail (2.8.1)
|
219
|
+
mini_mime (>= 0.1.1)
|
220
|
+
net-imap
|
221
|
+
net-pop
|
222
|
+
net-smtp
|
223
|
+
marcel (1.0.2)
|
224
|
+
mini_mime (1.1.5)
|
225
|
+
minitest (5.20.0)
|
226
|
+
msgpack (1.7.2)
|
227
|
+
multipart-post (2.3.0)
|
228
|
+
mutex_m (0.2.0)
|
229
|
+
net-imap (0.4.9)
|
230
|
+
date
|
231
|
+
net-protocol
|
232
|
+
net-pop (0.1.2)
|
233
|
+
net-protocol
|
234
|
+
net-protocol (0.2.2)
|
235
|
+
timeout
|
236
|
+
net-smtp (0.4.0)
|
237
|
+
net-protocol
|
238
|
+
nio4r (2.7.0)
|
239
|
+
nokogiri (1.16.0-x86_64-linux)
|
240
|
+
racc (~> 1.4)
|
241
|
+
parallel (1.24.0)
|
242
|
+
parser (3.2.2.4)
|
243
|
+
ast (~> 2.4.1)
|
244
|
+
racc
|
245
|
+
proc_to_ast (0.1.0)
|
246
|
+
coderay
|
247
|
+
parser
|
248
|
+
unparser
|
249
|
+
psych (5.1.2)
|
250
|
+
stringio
|
251
|
+
public_suffix (5.0.4)
|
252
|
+
puma (6.4.0)
|
253
|
+
nio4r (~> 2.0)
|
254
|
+
racc (1.7.3)
|
255
|
+
rack (3.0.8)
|
256
|
+
rack-cors (2.0.1)
|
257
|
+
rack (>= 2.0.0)
|
258
|
+
rack-session (2.0.0)
|
259
|
+
rack (>= 3.0.0)
|
260
|
+
rack-test (2.1.0)
|
261
|
+
rack (>= 1.3)
|
262
|
+
rackup (2.1.0)
|
263
|
+
rack (>= 3)
|
264
|
+
webrick (~> 1.8)
|
265
|
+
rails (7.1.2)
|
266
|
+
actioncable (= 7.1.2)
|
267
|
+
actionmailbox (= 7.1.2)
|
268
|
+
actionmailer (= 7.1.2)
|
269
|
+
actionpack (= 7.1.2)
|
270
|
+
actiontext (= 7.1.2)
|
271
|
+
actionview (= 7.1.2)
|
272
|
+
activejob (= 7.1.2)
|
273
|
+
activemodel (= 7.1.2)
|
274
|
+
activerecord (= 7.1.2)
|
275
|
+
activestorage (= 7.1.2)
|
276
|
+
activesupport (= 7.1.2)
|
277
|
+
bundler (>= 1.15.0)
|
278
|
+
railties (= 7.1.2)
|
279
|
+
rails-dom-testing (2.2.0)
|
280
|
+
activesupport (>= 5.0.0)
|
281
|
+
minitest
|
282
|
+
nokogiri (>= 1.6)
|
283
|
+
rails-healthcheck (1.4.0)
|
284
|
+
actionpack
|
285
|
+
railties
|
286
|
+
rails-html-sanitizer (1.6.0)
|
287
|
+
loofah (~> 2.21)
|
288
|
+
nokogiri (~> 1.14)
|
289
|
+
railties (7.1.2)
|
290
|
+
actionpack (= 7.1.2)
|
291
|
+
activesupport (= 7.1.2)
|
292
|
+
irb
|
293
|
+
rackup (>= 1.0.0)
|
294
|
+
rake (>= 12.2)
|
295
|
+
thor (~> 1.0, >= 1.2.2)
|
296
|
+
zeitwerk (~> 2.6)
|
297
|
+
rainbow (3.1.1)
|
298
|
+
rake (13.1.0)
|
299
|
+
rb-fsevent (0.11.2)
|
300
|
+
rb-inotify (0.10.1)
|
301
|
+
ffi (~> 1.0)
|
302
|
+
rdoc (6.6.2)
|
303
|
+
psych (>= 4.0.0)
|
304
|
+
regexp_parser (2.8.3)
|
305
|
+
reline (0.4.1)
|
306
|
+
io-console (~> 0.5)
|
307
|
+
rexml (3.2.6)
|
308
|
+
rrx_config (0.1.0)
|
309
|
+
railties
|
310
|
+
rspec (3.12.0)
|
311
|
+
rspec-core (~> 3.12.0)
|
312
|
+
rspec-expectations (~> 3.12.0)
|
313
|
+
rspec-mocks (~> 3.12.0)
|
314
|
+
rspec-core (3.12.2)
|
315
|
+
rspec-support (~> 3.12.0)
|
316
|
+
rspec-expectations (3.12.3)
|
317
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
318
|
+
rspec-support (~> 3.12.0)
|
319
|
+
rspec-mocks (3.12.6)
|
320
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
321
|
+
rspec-support (~> 3.12.0)
|
322
|
+
rspec-parameterized (1.0.0)
|
323
|
+
rspec-parameterized-core (< 2)
|
324
|
+
rspec-parameterized-table_syntax (< 2)
|
325
|
+
rspec-parameterized-core (1.0.0)
|
326
|
+
parser
|
327
|
+
proc_to_ast
|
328
|
+
rspec (>= 2.13, < 4)
|
329
|
+
unparser
|
330
|
+
rspec-parameterized-table_syntax (1.0.1)
|
331
|
+
binding_of_caller
|
332
|
+
rspec-parameterized-core (< 2)
|
333
|
+
rspec-rails (6.1.0)
|
334
|
+
actionpack (>= 6.1)
|
335
|
+
activesupport (>= 6.1)
|
336
|
+
railties (>= 6.1)
|
337
|
+
rspec-core (~> 3.12)
|
338
|
+
rspec-expectations (~> 3.12)
|
339
|
+
rspec-mocks (~> 3.12)
|
340
|
+
rspec-support (~> 3.12)
|
341
|
+
rspec-support (3.12.1)
|
342
|
+
rswag-api (2.13.0)
|
343
|
+
activesupport (>= 3.1, < 7.2)
|
344
|
+
railties (>= 3.1, < 7.2)
|
345
|
+
rswag-specs (2.13.0)
|
346
|
+
activesupport (>= 3.1, < 7.2)
|
347
|
+
json-schema (>= 2.2, < 5.0)
|
348
|
+
railties (>= 3.1, < 7.2)
|
349
|
+
rspec-core (>= 2.14)
|
350
|
+
rswag-ui (2.13.0)
|
351
|
+
actionpack (>= 3.1, < 7.2)
|
352
|
+
railties (>= 3.1, < 7.2)
|
353
|
+
rubocop (1.59.0)
|
354
|
+
json (~> 2.3)
|
355
|
+
language_server-protocol (>= 3.17.0)
|
356
|
+
parallel (~> 1.10)
|
357
|
+
parser (>= 3.2.2.4)
|
358
|
+
rainbow (>= 2.2.2, < 4.0)
|
359
|
+
regexp_parser (>= 1.8, < 3.0)
|
360
|
+
rexml (>= 3.2.5, < 4.0)
|
361
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
362
|
+
ruby-progressbar (~> 1.7)
|
363
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
364
|
+
rubocop-ast (1.30.0)
|
365
|
+
parser (>= 3.2.1.0)
|
366
|
+
rubocop-rails (2.23.1)
|
367
|
+
activesupport (>= 4.2.0)
|
368
|
+
rack (>= 1.1)
|
369
|
+
rubocop (>= 1.33.0, < 2.0)
|
370
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
371
|
+
ruby-progressbar (1.13.0)
|
372
|
+
ruby2_keywords (0.0.5)
|
373
|
+
spring (4.1.3)
|
374
|
+
sqlite3 (1.7.0-x86_64-linux)
|
375
|
+
stringio (3.1.0)
|
376
|
+
thor (1.3.0)
|
377
|
+
timeout (0.4.1)
|
378
|
+
tzinfo (2.0.6)
|
379
|
+
concurrent-ruby (~> 1.0)
|
380
|
+
tzinfo-data (1.2023.4)
|
381
|
+
tzinfo (>= 1.0.0)
|
382
|
+
unicode-display_width (2.5.0)
|
383
|
+
unparser (0.6.10)
|
384
|
+
diff-lcs (~> 1.3)
|
385
|
+
parser (>= 3.2.2.4)
|
386
|
+
webrick (1.8.1)
|
387
|
+
websocket-driver (0.7.6)
|
388
|
+
websocket-extensions (>= 0.1.0)
|
389
|
+
websocket-extensions (0.1.5)
|
390
|
+
zeitwerk (2.6.12)
|
391
|
+
|
392
|
+
PLATFORMS
|
393
|
+
x86_64-linux
|
394
|
+
|
395
|
+
DEPENDENCIES
|
396
|
+
rrx_api!
|
397
|
+
rrx_dev!
|
398
|
+
rrx_logging!
|
399
|
+
sqlite3
|
400
|
+
|
401
|
+
BUNDLED WITH
|
402
|
+
2.4.10
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 Dan Drew
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# RrxApi
|
2
|
+
|
3
|
+
Opinionated base library for simplifying development of Rails API projects.
|
4
|
+
|
5
|
+
Note that this gem expects the [rrx_dev](https://github.com/rails-rrx/rrx_api/blob/main/CODE_OF_CONDUCT.md) but does
|
6
|
+
not list it as a dependency as it is only needed for development and tests. Please add it to your Gemfile manually
|
7
|
+
or as described below with the `bundle add` command.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Install the gem and add to the application's Gemfile by executing:
|
12
|
+
|
13
|
+
```shell
|
14
|
+
$ bundle add rrx_dev --group "development, test"
|
15
|
+
$ bundle add rrx_api
|
16
|
+
```
|
17
|
+
|
18
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
19
|
+
|
20
|
+
```shell
|
21
|
+
$ gem install rrx_dev rrx_api
|
22
|
+
```
|
23
|
+
|
24
|
+
After installing, initialize your project with `rrx_api_setup`. Note this will also invoke `rrx_dev_setup app` to
|
25
|
+
perform development and test setup.
|
26
|
+
|
27
|
+
```shell
|
28
|
+
$ rrx_api_setup
|
29
|
+
```
|
30
|
+
|
31
|
+
## Usage
|
32
|
+
|
33
|
+
TODO
|
34
|
+
|
35
|
+
## Development
|
36
|
+
|
37
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
38
|
+
|
39
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/rails-rrx/rrx_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/rails-rrx/rrx_api/blob/main/CODE_OF_CONDUCT.md).
|
44
|
+
|
45
|
+
## License
|
46
|
+
|
47
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
48
|
+
|
49
|
+
## Code of Conduct
|
50
|
+
|
51
|
+
Everyone interacting in the RrxApi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/rrx_api/blob/main/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/exe/rrx_api_setup
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'
|
3
|
+
require 'thor'
|
4
|
+
require 'pathname'
|
5
|
+
|
6
|
+
class Setup < Thor
|
7
|
+
include Thor::Actions
|
8
|
+
|
9
|
+
default_command :app
|
10
|
+
|
11
|
+
#noinspection RubyMismatchedArgumentType
|
12
|
+
source_root Pathname(__dir__).join('sources')
|
13
|
+
|
14
|
+
desc 'app', 'Setup a new API app'
|
15
|
+
def app
|
16
|
+
rrx_dev
|
17
|
+
update_base_classes
|
18
|
+
rails
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def rails
|
24
|
+
directory 'config/initializers'
|
25
|
+
end
|
26
|
+
|
27
|
+
def rrx_dev
|
28
|
+
run 'bundle exec rrx_dev_setup app'
|
29
|
+
end
|
30
|
+
|
31
|
+
def update_base_classes
|
32
|
+
gsub_file 'app/models/application_record.rb', /ApplicationRecord.*/, 'ApplicationRecord < RrxApi::Record'
|
33
|
+
gsub_file 'app/controllers/application_controller.rb', /ApplicationController.*/, 'ApplicationController < RrxApi::Controller'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
Setup.start
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rack/cors'
|
2
|
+
|
3
|
+
LOCALHOST_PATTERN = /\Ahttp:\/\/localhost(?::\d{4})?\z/.freeze
|
4
|
+
|
5
|
+
Rails.application.config.middleware.insert_before 0, Rack::Cors do
|
6
|
+
allow do
|
7
|
+
origins do |source, env|
|
8
|
+
if Rails.env.development?
|
9
|
+
LOCALHOST_PATTERN.match? source
|
10
|
+
else
|
11
|
+
# TODO
|
12
|
+
true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
resource '*',
|
17
|
+
headers: :any,
|
18
|
+
credentials: true,
|
19
|
+
methods: [:get, :post, :put, :patch, :delete, :options, :head]
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rails'
|
2
|
+
require 'active_model/railtie'
|
3
|
+
require 'active_record/railtie'
|
4
|
+
require 'action_controller/railtie'
|
5
|
+
require 'action_text/engine'
|
6
|
+
require 'action_view/railtie'
|
7
|
+
require 'jbuilder'
|
8
|
+
require 'rack/cors'
|
9
|
+
require 'actionpack/action_caching'
|
10
|
+
|
11
|
+
module RrxApi
|
12
|
+
class Railtie < ::Rails::Engine
|
13
|
+
initializer 'rrx.api_docs_config', before: :load_config_initializers do |_app|
|
14
|
+
Rails.configuration.api_docs = { 'API' => 'swagger.yaml' }
|
15
|
+
end
|
16
|
+
|
17
|
+
initializer 'rrx.api_docs', after: :load_config_initializers do |app|
|
18
|
+
# Setup Swagger endpoints if docs exist
|
19
|
+
if swagger_root?
|
20
|
+
require 'rswag/api'
|
21
|
+
require 'rswag/ui'
|
22
|
+
|
23
|
+
Rswag::Api.configure do |c|
|
24
|
+
c.swagger_root = Rails.root.join('swagger')
|
25
|
+
end
|
26
|
+
Rswag::Ui.configure do |c|
|
27
|
+
app.config.api_docs.each_pair do |name, file|
|
28
|
+
c.swagger_endpoint "/api-docs/#{file}", name
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def swagger_root
|
37
|
+
@swagger_root ||= Rails.root.join('swagger')
|
38
|
+
end
|
39
|
+
|
40
|
+
def swagger_root?
|
41
|
+
swagger_root.exist?
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/lib/rrx_api.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'rrx_api/version'
|
4
|
+
require_relative 'rrx_api/railtie'
|
5
|
+
require 'rrx_config'
|
6
|
+
require 'rrx_logging'
|
7
|
+
require 'rack/cors'
|
8
|
+
|
9
|
+
module RrxApi
|
10
|
+
class Error < StandardError; end
|
11
|
+
# Your code goes here...
|
12
|
+
end
|
data/sig/rrx_api.rbs
ADDED