power_api 0.2.0 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +104 -0
- data/.circleci/setup-rubygems.sh +3 -0
- data/.rubocop.yml +0 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +19 -1
- data/Gemfile +2 -0
- data/Gemfile.lock +189 -166
- data/README.md +365 -103
- data/app/controllers/power_api/base_controller.rb +0 -1
- data/app/helpers/power_api/application_helper.rb +57 -0
- data/bin/clean_test_app +2 -0
- data/lib/generators/power_api/controller/controller_generator.rb +27 -15
- data/lib/generators/power_api/exposed_api_config/USAGE +5 -0
- data/lib/generators/power_api/exposed_api_config/exposed_api_config_generator.rb +58 -0
- data/lib/generators/power_api/install/install_generator.rb +2 -44
- data/lib/generators/power_api/internal_api_config/USAGE +5 -0
- data/lib/generators/power_api/internal_api_config/internal_api_config_generator.rb +31 -0
- data/lib/generators/power_api/version/version_generator.rb +2 -2
- data/lib/power_api/engine.rb +6 -1
- data/lib/power_api/errors.rb +2 -0
- data/lib/power_api/generator_helper/active_record_resource.rb +10 -6
- data/lib/power_api/generator_helper/ams_helper.rb +5 -11
- data/lib/power_api/generator_helper/api_helper.rb +61 -0
- data/lib/power_api/generator_helper/controller_helper.rb +45 -15
- data/lib/power_api/generator_helper/routes_helper.rb +22 -7
- data/lib/power_api/generator_helper/rspec_controller_helper.rb +306 -0
- data/lib/power_api/generator_helper/swagger_helper.rb +14 -24
- data/lib/power_api/generator_helpers.rb +2 -1
- data/lib/power_api/version.rb +1 -1
- data/power_api.gemspec +3 -2
- data/spec/dummy/Rakefile +1 -1
- data/spec/dummy/app/assets/config/manifest.js +0 -2
- data/spec/dummy/app/controllers/api/base_controller.rb +2 -0
- data/spec/dummy/app/controllers/api/internal/base_controller.rb +5 -0
- data/spec/dummy/app/controllers/api/internal/blogs_controller.rb +36 -0
- data/spec/dummy/app/controllers/application_controller.rb +0 -1
- data/spec/dummy/app/{assets/javascripts → javascript/packs}/application.js +2 -0
- data/spec/dummy/app/jobs/application_job.rb +5 -0
- data/spec/dummy/app/serializers/api/internal/blog_serializer.rb +12 -0
- data/spec/dummy/app/views/layouts/application.html.erb +3 -2
- data/spec/dummy/bin/rails +2 -2
- data/spec/dummy/bin/rake +2 -2
- data/spec/dummy/bin/setup +7 -12
- data/spec/dummy/config/application.rb +12 -16
- data/spec/dummy/config/boot.rb +1 -1
- data/spec/dummy/config/cable.yml +2 -2
- data/spec/dummy/config/database.yml +8 -16
- data/spec/dummy/config/environment.rb +1 -1
- data/spec/dummy/config/environments/development.rb +28 -6
- data/spec/dummy/config/environments/production.rb +45 -16
- data/spec/dummy/config/environments/test.rb +24 -7
- data/spec/dummy/config/initializers/active_model_serializers.rb +1 -0
- data/spec/dummy/config/initializers/api_pagination.rb +32 -0
- data/spec/dummy/config/initializers/assets.rb +0 -2
- data/spec/dummy/config/initializers/backtrace_silencers.rb +4 -3
- data/spec/dummy/config/initializers/content_security_policy.rb +28 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +3 -1
- data/spec/dummy/config/initializers/permissions_policy.rb +11 -0
- data/spec/dummy/config/locales/en.yml +1 -1
- data/spec/dummy/config/puma.rb +14 -27
- data/spec/dummy/config/routes.rb +2 -7
- data/spec/dummy/config/storage.yml +34 -0
- data/spec/dummy/config.ru +2 -1
- data/spec/dummy/spec/helpers/power_api/application_helper_spec.rb +171 -0
- data/spec/dummy/spec/lib/power_api/generator_helper/ams_helper_spec.rb +50 -12
- data/spec/dummy/spec/lib/power_api/generator_helper/api_helper_spec.rb +115 -0
- data/spec/dummy/spec/lib/power_api/generator_helper/controller_helper_spec.rb +126 -34
- data/spec/dummy/spec/lib/power_api/generator_helper/routes_helper_spec.rb +29 -5
- data/spec/dummy/spec/lib/power_api/generator_helper/rspec_controller_helper_spec.rb +559 -0
- data/spec/dummy/spec/lib/power_api/generator_helper/swagger_helper_spec.rb +10 -20
- data/spec/dummy/spec/support/shared_examples/active_record_resource_atrributes.rb +22 -3
- metadata +114 -87
- data/.hound.yml +0 -4
- data/.travis.yml +0 -16
- data/app/controllers/concerns/api/versioned.rb +0 -36
- data/lib/power_api/generator_helper/version_helper.rb +0 -16
- data/spec/dummy/app/assets/javascripts/cable.js +0 -13
- data/spec/dummy/app/controllers/concerns/api/versioned_spec.rb +0 -64
- data/spec/dummy/bin/bundle +0 -3
- data/spec/dummy/bin/update +0 -29
- data/spec/dummy/bin/yarn +0 -11
- data/spec/dummy/config/secrets.yml +0 -32
- data/spec/dummy/config/spring.rb +0 -6
- data/spec/dummy/spec/lib/power_api/generator_helper/version_helper_spec.rb +0 -55
@@ -3,6 +3,7 @@ shared_examples 'ActiveRecord resource attributes' do |attributes_key|
|
|
3
3
|
describe "#resource_attributes" do
|
4
4
|
let(:expected_attributes) do
|
5
5
|
[
|
6
|
+
{ name: :id, type: :integer, swagger_type: :integer, example: kind_of(Integer), required: false },
|
6
7
|
{ name: :title, type: :string, swagger_type: :string, example: "'Some title'", required: true },
|
7
8
|
{ name: :body, type: :text, swagger_type: :string, example: "'Some body'", required: true },
|
8
9
|
{ name: :created_at, type: :datetime, swagger_type: :string, example: "'1984-06-04 09:00'", required: false },
|
@@ -21,27 +22,30 @@ shared_examples 'ActiveRecord resource attributes' do |attributes_key|
|
|
21
22
|
let(attributes_key) { %w{title body} }
|
22
23
|
let(:expected_attributes) do
|
23
24
|
[
|
25
|
+
{ name: :id, type: :integer, swagger_type: :integer, example: kind_of(Integer), required: false },
|
24
26
|
{ name: :title, type: :string, swagger_type: :string, example: "'Some title'", required: true },
|
25
27
|
{ name: :body, type: :text, swagger_type: :string, example: "'Some body'", required: true }
|
26
28
|
]
|
27
29
|
end
|
28
30
|
|
29
|
-
it { expect(perform).to
|
31
|
+
it { expect(perform).to match(expected_attributes) }
|
30
32
|
end
|
31
33
|
|
32
34
|
context "with attributes not present in model" do
|
33
35
|
let(attributes_key) { %w{title bloody} }
|
34
36
|
let(:expected_attributes) do
|
35
37
|
[
|
38
|
+
{ name: :id, type: :integer, swagger_type: :integer, example: kind_of(Integer), required: false },
|
36
39
|
{ name: :title, type: :string, swagger_type: :string, example: "'Some title'", required: true }
|
37
40
|
]
|
38
41
|
end
|
39
42
|
|
40
|
-
it { expect(perform).to
|
43
|
+
it { expect(perform).to match(expected_attributes) }
|
41
44
|
end
|
42
45
|
end
|
43
46
|
|
44
47
|
describe "#required_resource_attributes" do
|
48
|
+
let(:include_id) { false }
|
45
49
|
let(:expected_attributes) do
|
46
50
|
[
|
47
51
|
{ name: :title, type: :string, swagger_type: :string, example: "'Some title'", required: true },
|
@@ -50,10 +54,23 @@ shared_examples 'ActiveRecord resource attributes' do |attributes_key|
|
|
50
54
|
end
|
51
55
|
|
52
56
|
def perform
|
53
|
-
resource.required_resource_attributes
|
57
|
+
resource.required_resource_attributes(include_id: include_id)
|
54
58
|
end
|
55
59
|
|
56
60
|
it { expect(perform).to eq(expected_attributes) }
|
61
|
+
|
62
|
+
context "with included id" do
|
63
|
+
let(:include_id) { true }
|
64
|
+
let(:expected_attributes) do
|
65
|
+
[
|
66
|
+
{ name: :id, type: :integer, swagger_type: :integer, example: kind_of(Integer), required: false },
|
67
|
+
{ name: :title, type: :string, swagger_type: :string, example: "'Some title'", required: true },
|
68
|
+
{ name: :body, type: :text, swagger_type: :string, example: "'Some body'", required: true }
|
69
|
+
]
|
70
|
+
end
|
71
|
+
|
72
|
+
it { expect(perform).to match(expected_attributes) }
|
73
|
+
end
|
57
74
|
end
|
58
75
|
|
59
76
|
describe "#required_attributes_names" do
|
@@ -88,6 +105,7 @@ shared_examples 'ActiveRecord resource attributes' do |attributes_key|
|
|
88
105
|
describe "#attributes_names" do
|
89
106
|
let(:expected_attributes) do
|
90
107
|
[
|
108
|
+
:id,
|
91
109
|
:title,
|
92
110
|
:body,
|
93
111
|
:created_at,
|
@@ -138,6 +156,7 @@ shared_examples 'ActiveRecord resource attributes' do |attributes_key|
|
|
138
156
|
describe "#attributes_symbols_text_list" do
|
139
157
|
let(:expected_result) do
|
140
158
|
<<~ATTRS
|
159
|
+
:id,
|
141
160
|
:title,
|
142
161
|
:body,
|
143
162
|
:created_at,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: power_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Platanus
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-02-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: '6.0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
27
|
+
version: '6.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: active_model_serializers
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -235,6 +235,20 @@ dependencies:
|
|
235
235
|
- - ">="
|
236
236
|
- !ruby/object:Gem::Version
|
237
237
|
version: '0'
|
238
|
+
- !ruby/object:Gem::Dependency
|
239
|
+
name: rspec_junit_formatter
|
240
|
+
requirement: !ruby/object:Gem::Requirement
|
241
|
+
requirements:
|
242
|
+
- - ">="
|
243
|
+
- !ruby/object:Gem::Version
|
244
|
+
version: '0'
|
245
|
+
type: :development
|
246
|
+
prerelease: false
|
247
|
+
version_requirements: !ruby/object:Gem::Requirement
|
248
|
+
requirements:
|
249
|
+
- - ">="
|
250
|
+
- !ruby/object:Gem::Version
|
251
|
+
version: '0'
|
238
252
|
- !ruby/object:Gem::Dependency
|
239
253
|
name: rswag-specs
|
240
254
|
requirement: !ruby/object:Gem::Requirement
|
@@ -283,14 +297,14 @@ dependencies:
|
|
283
297
|
requirements:
|
284
298
|
- - "~>"
|
285
299
|
- !ruby/object:Gem::Version
|
286
|
-
version: 1.
|
300
|
+
version: 1.4.2
|
287
301
|
type: :development
|
288
302
|
prerelease: false
|
289
303
|
version_requirements: !ruby/object:Gem::Requirement
|
290
304
|
requirements:
|
291
305
|
- - "~>"
|
292
306
|
- !ruby/object:Gem::Version
|
293
|
-
version: 1.
|
307
|
+
version: 1.4.2
|
294
308
|
description: It is a Rails engine that gathers a set of other gems and configurations
|
295
309
|
designed to build incredible APIs
|
296
310
|
email:
|
@@ -300,13 +314,13 @@ executables: []
|
|
300
314
|
extensions: []
|
301
315
|
extra_rdoc_files: []
|
302
316
|
files:
|
317
|
+
- ".circleci/config.yml"
|
318
|
+
- ".circleci/setup-rubygems.sh"
|
303
319
|
- ".coveralls.yml"
|
304
320
|
- ".gitignore"
|
305
|
-
- ".hound.yml"
|
306
321
|
- ".rspec"
|
307
322
|
- ".rubocop.yml"
|
308
323
|
- ".ruby-version"
|
309
|
-
- ".travis.yml"
|
310
324
|
- CHANGELOG.md
|
311
325
|
- Gemfile
|
312
326
|
- Gemfile.lock
|
@@ -321,7 +335,6 @@ files:
|
|
321
335
|
- app/controllers/concerns/api/deprecated.rb
|
322
336
|
- app/controllers/concerns/api/error.rb
|
323
337
|
- app/controllers/concerns/api/filtered.rb
|
324
|
-
- app/controllers/concerns/api/versioned.rb
|
325
338
|
- app/controllers/power_api/base_controller.rb
|
326
339
|
- app/helpers/power_api/application_helper.rb
|
327
340
|
- app/jobs/power_api/application_job.rb
|
@@ -329,12 +342,17 @@ files:
|
|
329
342
|
- app/models/power_api/application_record.rb
|
330
343
|
- app/responders/api_responder.rb
|
331
344
|
- app/views/layouts/power_api/application.html.erb
|
345
|
+
- bin/clean_test_app
|
332
346
|
- bin/rails
|
333
347
|
- config/routes.rb
|
334
348
|
- lib/generators/power_api/controller/USAGE
|
335
349
|
- lib/generators/power_api/controller/controller_generator.rb
|
350
|
+
- lib/generators/power_api/exposed_api_config/USAGE
|
351
|
+
- lib/generators/power_api/exposed_api_config/exposed_api_config_generator.rb
|
336
352
|
- lib/generators/power_api/install/USAGE
|
337
353
|
- lib/generators/power_api/install/install_generator.rb
|
354
|
+
- lib/generators/power_api/internal_api_config/USAGE
|
355
|
+
- lib/generators/power_api/internal_api_config/internal_api_config_generator.rb
|
338
356
|
- lib/generators/power_api/version/USAGE
|
339
357
|
- lib/generators/power_api/version/version_generator.rb
|
340
358
|
- lib/power_api.rb
|
@@ -342,48 +360,48 @@ files:
|
|
342
360
|
- lib/power_api/errors.rb
|
343
361
|
- lib/power_api/generator_helper/active_record_resource.rb
|
344
362
|
- lib/power_api/generator_helper/ams_helper.rb
|
363
|
+
- lib/power_api/generator_helper/api_helper.rb
|
345
364
|
- lib/power_api/generator_helper/controller_actions_helper.rb
|
346
365
|
- lib/power_api/generator_helper/controller_helper.rb
|
347
366
|
- lib/power_api/generator_helper/pagination_helper.rb
|
348
367
|
- lib/power_api/generator_helper/resource_helper.rb
|
349
368
|
- lib/power_api/generator_helper/routes_helper.rb
|
369
|
+
- lib/power_api/generator_helper/rspec_controller_helper.rb
|
350
370
|
- lib/power_api/generator_helper/rubocop_helper.rb
|
351
371
|
- lib/power_api/generator_helper/simple_token_auth_helper.rb
|
352
372
|
- lib/power_api/generator_helper/swagger_helper.rb
|
353
373
|
- lib/power_api/generator_helper/template_builder_helper.rb
|
354
|
-
- lib/power_api/generator_helper/version_helper.rb
|
355
374
|
- lib/power_api/generator_helpers.rb
|
356
375
|
- lib/power_api/version.rb
|
357
376
|
- lib/tasks/power_api_tasks.rake
|
358
377
|
- power_api.gemspec
|
359
378
|
- spec/dummy/Rakefile
|
360
379
|
- spec/dummy/app/assets/config/manifest.js
|
361
|
-
- spec/dummy/app/assets/javascripts/application.js
|
362
|
-
- spec/dummy/app/assets/javascripts/cable.js
|
363
380
|
- spec/dummy/app/assets/stylesheets/application.css
|
364
381
|
- spec/dummy/app/channels/application_cable/channel.rb
|
365
382
|
- spec/dummy/app/channels/application_cable/connection.rb
|
383
|
+
- spec/dummy/app/controllers/api/base_controller.rb
|
384
|
+
- spec/dummy/app/controllers/api/internal/base_controller.rb
|
385
|
+
- spec/dummy/app/controllers/api/internal/blogs_controller.rb
|
366
386
|
- spec/dummy/app/controllers/application_controller.rb
|
367
387
|
- spec/dummy/app/controllers/concerns/api/deprecated_spec.rb
|
368
388
|
- spec/dummy/app/controllers/concerns/api/error_spec.rb
|
369
389
|
- spec/dummy/app/controllers/concerns/api/filtered_spec.rb
|
370
|
-
- spec/dummy/app/controllers/concerns/api/versioned_spec.rb
|
371
390
|
- spec/dummy/app/helpers/application_helper.rb
|
391
|
+
- spec/dummy/app/javascript/packs/application.js
|
372
392
|
- spec/dummy/app/jobs/application_job.rb
|
373
393
|
- spec/dummy/app/mailers/application_mailer.rb
|
374
394
|
- spec/dummy/app/models/application_record.rb
|
375
395
|
- spec/dummy/app/models/blog.rb
|
376
396
|
- spec/dummy/app/models/portfolio.rb
|
377
397
|
- spec/dummy/app/models/user.rb
|
398
|
+
- spec/dummy/app/serializers/api/internal/blog_serializer.rb
|
378
399
|
- spec/dummy/app/views/layouts/application.html.erb
|
379
400
|
- spec/dummy/app/views/layouts/mailer.html.erb
|
380
401
|
- spec/dummy/app/views/layouts/mailer.text.erb
|
381
|
-
- spec/dummy/bin/bundle
|
382
402
|
- spec/dummy/bin/rails
|
383
403
|
- spec/dummy/bin/rake
|
384
404
|
- spec/dummy/bin/setup
|
385
|
-
- spec/dummy/bin/update
|
386
|
-
- spec/dummy/bin/yarn
|
387
405
|
- spec/dummy/config.ru
|
388
406
|
- spec/dummy/config/application.rb
|
389
407
|
- spec/dummy/config/boot.rb
|
@@ -393,19 +411,22 @@ files:
|
|
393
411
|
- spec/dummy/config/environments/development.rb
|
394
412
|
- spec/dummy/config/environments/production.rb
|
395
413
|
- spec/dummy/config/environments/test.rb
|
414
|
+
- spec/dummy/config/initializers/active_model_serializers.rb
|
415
|
+
- spec/dummy/config/initializers/api_pagination.rb
|
396
416
|
- spec/dummy/config/initializers/application_controller_renderer.rb
|
397
417
|
- spec/dummy/config/initializers/assets.rb
|
398
418
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
419
|
+
- spec/dummy/config/initializers/content_security_policy.rb
|
399
420
|
- spec/dummy/config/initializers/cookies_serializer.rb
|
400
421
|
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
401
422
|
- spec/dummy/config/initializers/inflections.rb
|
402
423
|
- spec/dummy/config/initializers/mime_types.rb
|
424
|
+
- spec/dummy/config/initializers/permissions_policy.rb
|
403
425
|
- spec/dummy/config/initializers/wrap_parameters.rb
|
404
426
|
- spec/dummy/config/locales/en.yml
|
405
427
|
- spec/dummy/config/puma.rb
|
406
428
|
- spec/dummy/config/routes.rb
|
407
|
-
- spec/dummy/config/
|
408
|
-
- spec/dummy/config/spring.rb
|
429
|
+
- spec/dummy/config/storage.yml
|
409
430
|
- spec/dummy/db/migrate/20190322205209_create_blogs.rb
|
410
431
|
- spec/dummy/db/migrate/20200215225917_create_users.rb
|
411
432
|
- spec/dummy/db/migrate/20200227150449_create_portfolios.rb
|
@@ -423,15 +444,17 @@ files:
|
|
423
444
|
- spec/dummy/spec/factories/blogs.rb
|
424
445
|
- spec/dummy/spec/factories/portfolios.rb
|
425
446
|
- spec/dummy/spec/factories/users.rb
|
447
|
+
- spec/dummy/spec/helpers/power_api/application_helper_spec.rb
|
426
448
|
- spec/dummy/spec/lib/power_api/generator_helper/ams_helper_spec.rb
|
449
|
+
- spec/dummy/spec/lib/power_api/generator_helper/api_helper_spec.rb
|
427
450
|
- spec/dummy/spec/lib/power_api/generator_helper/controller_actions_helper_spec.rb
|
428
451
|
- spec/dummy/spec/lib/power_api/generator_helper/controller_helper_spec.rb
|
429
452
|
- spec/dummy/spec/lib/power_api/generator_helper/pagination_helper_spec.rb
|
430
453
|
- spec/dummy/spec/lib/power_api/generator_helper/resource_helper_spec.rb
|
431
454
|
- spec/dummy/spec/lib/power_api/generator_helper/routes_helper_spec.rb
|
455
|
+
- spec/dummy/spec/lib/power_api/generator_helper/rspec_controller_helper_spec.rb
|
432
456
|
- spec/dummy/spec/lib/power_api/generator_helper/simple_token_auth_helper_spec.rb
|
433
457
|
- spec/dummy/spec/lib/power_api/generator_helper/swagger_helper_spec.rb
|
434
|
-
- spec/dummy/spec/lib/power_api/generator_helper/version_helper_spec.rb
|
435
458
|
- spec/dummy/spec/support/shared_examples/active_record_resource.rb
|
436
459
|
- spec/dummy/spec/support/shared_examples/active_record_resource_atrributes.rb
|
437
460
|
- spec/dummy/spec/support/test_generator_helpers.rb
|
@@ -457,90 +480,94 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
457
480
|
- !ruby/object:Gem::Version
|
458
481
|
version: '0'
|
459
482
|
requirements: []
|
460
|
-
rubygems_version: 3.
|
483
|
+
rubygems_version: 3.1.6
|
461
484
|
signing_key:
|
462
485
|
specification_version: 4
|
463
486
|
summary: Set of other gems and configurations designed to build incredible APIs
|
464
487
|
test_files:
|
465
|
-
- spec/
|
466
|
-
- spec/dummy/app/mailers/application_mailer.rb
|
467
|
-
- spec/dummy/app/channels/application_cable/connection.rb
|
468
|
-
- spec/dummy/app/channels/application_cable/channel.rb
|
469
|
-
- spec/dummy/app/views/layouts/application.html.erb
|
470
|
-
- spec/dummy/app/views/layouts/mailer.text.erb
|
471
|
-
- spec/dummy/app/views/layouts/mailer.html.erb
|
472
|
-
- spec/dummy/app/jobs/application_job.rb
|
473
|
-
- spec/dummy/app/models/blog.rb
|
474
|
-
- spec/dummy/app/models/application_record.rb
|
475
|
-
- spec/dummy/app/models/user.rb
|
476
|
-
- spec/dummy/app/models/portfolio.rb
|
477
|
-
- spec/dummy/app/helpers/application_helper.rb
|
478
|
-
- spec/dummy/app/assets/javascripts/application.js
|
479
|
-
- spec/dummy/app/assets/javascripts/cable.js
|
480
|
-
- spec/dummy/app/assets/stylesheets/application.css
|
488
|
+
- spec/dummy/Rakefile
|
481
489
|
- spec/dummy/app/assets/config/manifest.js
|
490
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
491
|
+
- spec/dummy/app/channels/application_cable/channel.rb
|
492
|
+
- spec/dummy/app/channels/application_cable/connection.rb
|
493
|
+
- spec/dummy/app/controllers/api/base_controller.rb
|
494
|
+
- spec/dummy/app/controllers/api/internal/base_controller.rb
|
495
|
+
- spec/dummy/app/controllers/api/internal/blogs_controller.rb
|
482
496
|
- spec/dummy/app/controllers/application_controller.rb
|
483
497
|
- spec/dummy/app/controllers/concerns/api/deprecated_spec.rb
|
484
|
-
- spec/dummy/app/controllers/concerns/api/filtered_spec.rb
|
485
498
|
- spec/dummy/app/controllers/concerns/api/error_spec.rb
|
486
|
-
- spec/dummy/app/controllers/concerns/api/
|
487
|
-
- spec/dummy/
|
488
|
-
- spec/dummy/
|
489
|
-
- spec/dummy/
|
490
|
-
- spec/dummy/
|
491
|
-
- spec/dummy/
|
499
|
+
- spec/dummy/app/controllers/concerns/api/filtered_spec.rb
|
500
|
+
- spec/dummy/app/helpers/application_helper.rb
|
501
|
+
- spec/dummy/app/javascript/packs/application.js
|
502
|
+
- spec/dummy/app/jobs/application_job.rb
|
503
|
+
- spec/dummy/app/mailers/application_mailer.rb
|
504
|
+
- spec/dummy/app/models/application_record.rb
|
505
|
+
- spec/dummy/app/models/blog.rb
|
506
|
+
- spec/dummy/app/models/portfolio.rb
|
507
|
+
- spec/dummy/app/models/user.rb
|
508
|
+
- spec/dummy/app/serializers/api/internal/blog_serializer.rb
|
509
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
510
|
+
- spec/dummy/app/views/layouts/mailer.html.erb
|
511
|
+
- spec/dummy/app/views/layouts/mailer.text.erb
|
492
512
|
- spec/dummy/bin/rails
|
513
|
+
- spec/dummy/bin/rake
|
493
514
|
- spec/dummy/bin/setup
|
494
|
-
- spec/dummy/spec/lib/power_api/generator_helper/controller_actions_helper_spec.rb
|
495
|
-
- spec/dummy/spec/lib/power_api/generator_helper/simple_token_auth_helper_spec.rb
|
496
|
-
- spec/dummy/spec/lib/power_api/generator_helper/pagination_helper_spec.rb
|
497
|
-
- spec/dummy/spec/lib/power_api/generator_helper/swagger_helper_spec.rb
|
498
|
-
- spec/dummy/spec/lib/power_api/generator_helper/resource_helper_spec.rb
|
499
|
-
- spec/dummy/spec/lib/power_api/generator_helper/controller_helper_spec.rb
|
500
|
-
- spec/dummy/spec/lib/power_api/generator_helper/version_helper_spec.rb
|
501
|
-
- spec/dummy/spec/lib/power_api/generator_helper/ams_helper_spec.rb
|
502
|
-
- spec/dummy/spec/lib/power_api/generator_helper/routes_helper_spec.rb
|
503
|
-
- spec/dummy/spec/support/test_helpers.rb
|
504
|
-
- spec/dummy/spec/support/shared_examples/active_record_resource.rb
|
505
|
-
- spec/dummy/spec/support/shared_examples/active_record_resource_atrributes.rb
|
506
|
-
- spec/dummy/spec/support/test_generator_helpers.rb
|
507
|
-
- spec/dummy/spec/assets/image.png
|
508
|
-
- spec/dummy/spec/assets/video.mp4
|
509
|
-
- spec/dummy/spec/factories/users.rb
|
510
|
-
- spec/dummy/spec/factories/blogs.rb
|
511
|
-
- spec/dummy/spec/factories/portfolios.rb
|
512
|
-
- spec/dummy/public/404.html
|
513
|
-
- spec/dummy/public/500.html
|
514
|
-
- spec/dummy/public/apple-touch-icon-precomposed.png
|
515
|
-
- spec/dummy/public/422.html
|
516
|
-
- spec/dummy/public/apple-touch-icon.png
|
517
|
-
- spec/dummy/public/favicon.ico
|
518
515
|
- spec/dummy/config.ru
|
519
|
-
- spec/dummy/db/migrate/20200227150449_create_portfolios.rb
|
520
|
-
- spec/dummy/db/migrate/20200215225917_create_users.rb
|
521
|
-
- spec/dummy/db/migrate/20190322205209_create_blogs.rb
|
522
|
-
- spec/dummy/db/migrate/20200227150548_add_portfolio_id_blogs.rb
|
523
|
-
- spec/dummy/db/schema.rb
|
524
|
-
- spec/dummy/config/routes.rb
|
525
|
-
- spec/dummy/config/environment.rb
|
526
|
-
- spec/dummy/config/spring.rb
|
527
|
-
- spec/dummy/config/cable.yml
|
528
|
-
- spec/dummy/config/secrets.yml
|
529
516
|
- spec/dummy/config/application.rb
|
530
517
|
- spec/dummy/config/boot.rb
|
531
|
-
- spec/dummy/config/
|
518
|
+
- spec/dummy/config/cable.yml
|
519
|
+
- spec/dummy/config/database.yml
|
520
|
+
- spec/dummy/config/environment.rb
|
532
521
|
- spec/dummy/config/environments/development.rb
|
533
522
|
- spec/dummy/config/environments/production.rb
|
534
|
-
- spec/dummy/config/
|
535
|
-
- spec/dummy/config/
|
536
|
-
- spec/dummy/config/initializers/
|
537
|
-
- spec/dummy/config/initializers/mime_types.rb
|
538
|
-
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
539
|
-
- spec/dummy/config/initializers/assets.rb
|
523
|
+
- spec/dummy/config/environments/test.rb
|
524
|
+
- spec/dummy/config/initializers/active_model_serializers.rb
|
525
|
+
- spec/dummy/config/initializers/api_pagination.rb
|
540
526
|
- spec/dummy/config/initializers/application_controller_renderer.rb
|
541
|
-
- spec/dummy/config/initializers/
|
542
|
-
- spec/dummy/config/initializers/cookies_serializer.rb
|
527
|
+
- spec/dummy/config/initializers/assets.rb
|
543
528
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
544
|
-
- spec/dummy/config/
|
529
|
+
- spec/dummy/config/initializers/content_security_policy.rb
|
530
|
+
- spec/dummy/config/initializers/cookies_serializer.rb
|
531
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
532
|
+
- spec/dummy/config/initializers/inflections.rb
|
533
|
+
- spec/dummy/config/initializers/mime_types.rb
|
534
|
+
- spec/dummy/config/initializers/permissions_policy.rb
|
535
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
536
|
+
- spec/dummy/config/locales/en.yml
|
537
|
+
- spec/dummy/config/puma.rb
|
538
|
+
- spec/dummy/config/routes.rb
|
539
|
+
- spec/dummy/config/storage.yml
|
540
|
+
- spec/dummy/db/migrate/20190322205209_create_blogs.rb
|
541
|
+
- spec/dummy/db/migrate/20200215225917_create_users.rb
|
542
|
+
- spec/dummy/db/migrate/20200227150449_create_portfolios.rb
|
543
|
+
- spec/dummy/db/migrate/20200227150548_add_portfolio_id_blogs.rb
|
544
|
+
- spec/dummy/db/schema.rb
|
545
545
|
- spec/dummy/package.json
|
546
|
+
- spec/dummy/public/404.html
|
547
|
+
- spec/dummy/public/422.html
|
548
|
+
- spec/dummy/public/500.html
|
549
|
+
- spec/dummy/public/apple-touch-icon-precomposed.png
|
550
|
+
- spec/dummy/public/apple-touch-icon.png
|
551
|
+
- spec/dummy/public/favicon.ico
|
552
|
+
- spec/dummy/spec/assets/image.png
|
553
|
+
- spec/dummy/spec/assets/video.mp4
|
554
|
+
- spec/dummy/spec/factories/blogs.rb
|
555
|
+
- spec/dummy/spec/factories/portfolios.rb
|
556
|
+
- spec/dummy/spec/factories/users.rb
|
557
|
+
- spec/dummy/spec/helpers/power_api/application_helper_spec.rb
|
558
|
+
- spec/dummy/spec/lib/power_api/generator_helper/ams_helper_spec.rb
|
559
|
+
- spec/dummy/spec/lib/power_api/generator_helper/api_helper_spec.rb
|
560
|
+
- spec/dummy/spec/lib/power_api/generator_helper/controller_actions_helper_spec.rb
|
561
|
+
- spec/dummy/spec/lib/power_api/generator_helper/controller_helper_spec.rb
|
562
|
+
- spec/dummy/spec/lib/power_api/generator_helper/pagination_helper_spec.rb
|
563
|
+
- spec/dummy/spec/lib/power_api/generator_helper/resource_helper_spec.rb
|
564
|
+
- spec/dummy/spec/lib/power_api/generator_helper/routes_helper_spec.rb
|
565
|
+
- spec/dummy/spec/lib/power_api/generator_helper/rspec_controller_helper_spec.rb
|
566
|
+
- spec/dummy/spec/lib/power_api/generator_helper/simple_token_auth_helper_spec.rb
|
567
|
+
- spec/dummy/spec/lib/power_api/generator_helper/swagger_helper_spec.rb
|
568
|
+
- spec/dummy/spec/support/shared_examples/active_record_resource.rb
|
569
|
+
- spec/dummy/spec/support/shared_examples/active_record_resource_atrributes.rb
|
570
|
+
- spec/dummy/spec/support/test_generator_helpers.rb
|
571
|
+
- spec/dummy/spec/support/test_helpers.rb
|
546
572
|
- spec/rails_helper.rb
|
573
|
+
- spec/spec_helper.rb
|
data/.hound.yml
DELETED
data/.travis.yml
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
sudo: false
|
2
|
-
language: ruby
|
3
|
-
rvm:
|
4
|
-
- 2.5.0
|
5
|
-
script:
|
6
|
-
- RAILS_ENV=test bundle exec rake db:create db:migrate
|
7
|
-
- bundle exec rspec spec
|
8
|
-
before_install: gem install bundler -v 1.17.3
|
9
|
-
deploy:
|
10
|
-
provider: rubygems
|
11
|
-
api_key:
|
12
|
-
secure: GaNPiRBIHwFsuZGh+3HGiW+tdpjRIh9j4hAeXy8qqIDyXuOknjbdjYFE40RJHuxfyc76Ajx0Wi6ybHYyD6BEQcG7iLZKHVbzr/EAQCQejCCO1TkuNS8loVXNh65EPcl1XbJPURBliG1fSCOSPHRnXMK7SxUX0flnewvgLo0ZDRNY5hkc/Pyt+MBElUnzgmikrolhOzUHCMyzo9BPlem0ToCCtJuruM5EQQhPRrbPuYkJlGty4cqcyyLtPQwe0sgARbiAbYIa+vxi0mvYxf0s2HZwpBqIa3BkgL6ozdOVBk2a0hgjEQbkeGSRCo+R4fgtb4QHB5OamTKO6HF5ceECNe76eR4P8GYp6LBNj3R/sUJb8Fmp/7xs9q5JYkJ6+RKJzpLWFOd7U0xAsC9D3r/PDJHAuzjbiAi/f9C0nD0UQgPtLXeytp85W71bRd7Dommk785kphporaM7xteUWYMK0Jmo02zRa8qdo+fqFJQQ7lFovSHQO+boIBI3MnOHhlz54XFnkPJkfM9NIrCq2zOlxtJgW4B1Zuw93z7zFUfPOEekMoqAXR/tCKpdV1e5XhikSCNSWv1EHPZaB+IsaOzWEPY8rcA/l47gWXoa9Mgv8rTzj489EzoXrqXv/8yb6TSBOezTypt6MNYqiABnRv43mo2CvtlG5ERQM3izWC6vo00=
|
13
|
-
gem: power_api
|
14
|
-
on:
|
15
|
-
tags: true
|
16
|
-
repo: platanus/power_api
|
@@ -1,36 +0,0 @@
|
|
1
|
-
module Api::Versioned
|
2
|
-
extend ActiveSupport::Concern
|
3
|
-
|
4
|
-
DEFAULT_API_VERSIONS = 1
|
5
|
-
|
6
|
-
included do
|
7
|
-
before_action :check_api_version!
|
8
|
-
after_action :add_version_to_content_type
|
9
|
-
end
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def available_api_versions
|
14
|
-
ENV.fetch("AVAILABLE_API_VERSIONS", DEFAULT_API_VERSIONS)
|
15
|
-
end
|
16
|
-
|
17
|
-
def check_api_version!
|
18
|
-
return if (1..available_api_versions) === version_number
|
19
|
-
|
20
|
-
raise ::PowerApi::InvalidVersion.new("invalid API version")
|
21
|
-
end
|
22
|
-
|
23
|
-
def version_number
|
24
|
-
@version_number ||= begin
|
25
|
-
v = request.headers["Accept"].to_s.match(/version=(\d+)/)&.captures&.first.to_i
|
26
|
-
v.zero? ? DEFAULT_API_VERSIONS : v
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def add_version_to_content_type
|
31
|
-
content_type_header = response.headers["Content-Type"]
|
32
|
-
parts = !content_type_header ? [] : content_type_header.to_s.split(";").map(&:strip)
|
33
|
-
parts << "version=#{@version_number}"
|
34
|
-
response.headers["Content-Type"] = parts.join("; ")
|
35
|
-
end
|
36
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module PowerApi::GeneratorHelper::VersionHelper
|
2
|
-
extend ActiveSupport::Concern
|
3
|
-
|
4
|
-
included do
|
5
|
-
attr_reader :version_number
|
6
|
-
end
|
7
|
-
|
8
|
-
def version_number=(value)
|
9
|
-
@version_number = value.to_s.to_i
|
10
|
-
raise PowerApi::GeneratorError.new("invalid version number") if version_number < 1
|
11
|
-
end
|
12
|
-
|
13
|
-
def first_version?
|
14
|
-
version_number.to_i == 1
|
15
|
-
end
|
16
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
// Action Cable provides the framework to deal with WebSockets in Rails.
|
2
|
-
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
|
3
|
-
//
|
4
|
-
//= require action_cable
|
5
|
-
//= require_self
|
6
|
-
//= require_tree ./channels
|
7
|
-
|
8
|
-
(function() {
|
9
|
-
this.App || (this.App = {});
|
10
|
-
|
11
|
-
App.cable = ActionCable.createConsumer();
|
12
|
-
|
13
|
-
}).call(this);
|
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Api::Versioned', type: :controller do
|
4
|
-
let(:available_versions) { 1 }
|
5
|
-
let(:headers) do
|
6
|
-
{}
|
7
|
-
end
|
8
|
-
|
9
|
-
before do
|
10
|
-
allow(ENV).to receive(:fetch).with(
|
11
|
-
"AVAILABLE_API_VERSIONS", 1
|
12
|
-
).and_return(available_versions)
|
13
|
-
|
14
|
-
routes.draw { get :action, to: "anonymous#action" }
|
15
|
-
request.headers.merge!(headers) unless headers.blank?
|
16
|
-
get :action
|
17
|
-
end
|
18
|
-
|
19
|
-
controller do
|
20
|
-
include ::Api::Versioned
|
21
|
-
include ::Api::Error
|
22
|
-
|
23
|
-
def action
|
24
|
-
head :ok
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
context "with default version" do
|
29
|
-
it { expect(response.status).to eq(200) }
|
30
|
-
it { expect(response.headers["Content-Type"]).to eq("text/html; version=1") }
|
31
|
-
|
32
|
-
context "with invalid version header" do
|
33
|
-
let(:headers) do
|
34
|
-
{
|
35
|
-
"Accept" => "version=2"
|
36
|
-
}
|
37
|
-
end
|
38
|
-
|
39
|
-
it { expect(response.status).to eq(400) }
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
context "with multiple versions" do
|
44
|
-
let(:available_versions) { 2 }
|
45
|
-
let(:headers) do
|
46
|
-
{
|
47
|
-
"Accept" => "version=2"
|
48
|
-
}
|
49
|
-
end
|
50
|
-
|
51
|
-
it { expect(response.status).to eq(200) }
|
52
|
-
it { expect(response.headers["Content-Type"]).to eq("text/html; version=2") }
|
53
|
-
|
54
|
-
context "with invalid version header" do
|
55
|
-
let(:headers) do
|
56
|
-
{
|
57
|
-
"Accept" => "version=3"
|
58
|
-
}
|
59
|
-
end
|
60
|
-
|
61
|
-
it { expect(response.status).to eq(400) }
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
data/spec/dummy/bin/bundle
DELETED
data/spec/dummy/bin/update
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'pathname'
|
3
|
-
require 'fileutils'
|
4
|
-
include FileUtils
|
5
|
-
|
6
|
-
# path to your application root.
|
7
|
-
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8
|
-
|
9
|
-
def system!(*args)
|
10
|
-
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
-
end
|
12
|
-
|
13
|
-
chdir APP_ROOT do
|
14
|
-
# This script is a way to update your development environment automatically.
|
15
|
-
# Add necessary update steps to this file.
|
16
|
-
|
17
|
-
puts '== Installing dependencies =='
|
18
|
-
system! 'gem install bundler --conservative'
|
19
|
-
system('bundle check') || system!('bundle install')
|
20
|
-
|
21
|
-
puts "\n== Updating database =="
|
22
|
-
system! 'bin/rails db:migrate'
|
23
|
-
|
24
|
-
puts "\n== Removing old logs and tempfiles =="
|
25
|
-
system! 'bin/rails log:clear tmp:clear'
|
26
|
-
|
27
|
-
puts "\n== Restarting application server =="
|
28
|
-
system! 'bin/rails restart'
|
29
|
-
end
|
data/spec/dummy/bin/yarn
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
VENDOR_PATH = File.expand_path('..', __dir__)
|
3
|
-
Dir.chdir(VENDOR_PATH) do
|
4
|
-
begin
|
5
|
-
exec "yarnpkg #{ARGV.join(" ")}"
|
6
|
-
rescue Errno::ENOENT
|
7
|
-
$stderr.puts "Yarn executable was not detected in the system."
|
8
|
-
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
9
|
-
exit 1
|
10
|
-
end
|
11
|
-
end
|