power_api 0.1.0 → 0.2.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 +4 -4
- data/.travis.yml +5 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile +0 -4
- data/Gemfile.lock +33 -34
- data/README.md +35 -0
- data/lib/generators/power_api/controller/controller_generator.rb +23 -6
- data/lib/power_api/engine.rb +1 -0
- data/lib/power_api/generator_helper/controller_actions_helper.rb +27 -0
- data/lib/power_api/generator_helper/controller_helper.rb +15 -0
- data/lib/power_api/generator_helper/swagger_helper.rb +15 -0
- data/lib/power_api/generator_helpers.rb +1 -0
- data/lib/power_api/version.rb +1 -1
- data/spec/dummy/spec/lib/power_api/generator_helper/controller_actions_helper_spec.rb +177 -0
- data/spec/dummy/spec/lib/power_api/generator_helper/controller_helper_spec.rb +63 -0
- data/spec/dummy/spec/lib/power_api/generator_helper/swagger_helper_spec.rb +29 -0
- data/spec/dummy/spec/support/test_generator_helpers.rb +2 -0
- metadata +63 -119
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c6d232bd68c004bbe28ff8a0feff4106c2a3f2257c5d12ab6b4249655ec415c7
|
|
4
|
+
data.tar.gz: 70b0642b24c736dc1a2bad345c677e59e6072a9282b5f5fff609064cf8c7fe73
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6e652618b0f9bc1150bdf0b479420888a806a2063bba8f75d63f2d75c0a5d90319350e033f6f6bd6162a1ff87a9d675ec6c0688346e0f405f1ce5d4bbd62ca46
|
|
7
|
+
data.tar.gz: 054f6630eb7bebacf19d835a19645c6f2ef9c5c2a5f4fb486d6ae6db8103c1e54e3cf252a08754c70b903ff5434c4ccfa5b6cc6b21dd9be88e0d25cfaf45c959
|
data/.travis.yml
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
sudo: false
|
|
2
2
|
language: ruby
|
|
3
3
|
rvm:
|
|
4
|
-
|
|
4
|
+
- 2.5.0
|
|
5
5
|
script:
|
|
6
|
-
|
|
7
|
-
|
|
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
|
|
8
9
|
deploy:
|
|
9
10
|
provider: rubygems
|
|
10
11
|
api_key:
|
|
11
|
-
secure:
|
|
12
|
+
secure: GaNPiRBIHwFsuZGh+3HGiW+tdpjRIh9j4hAeXy8qqIDyXuOknjbdjYFE40RJHuxfyc76Ajx0Wi6ybHYyD6BEQcG7iLZKHVbzr/EAQCQejCCO1TkuNS8loVXNh65EPcl1XbJPURBliG1fSCOSPHRnXMK7SxUX0flnewvgLo0ZDRNY5hkc/Pyt+MBElUnzgmikrolhOzUHCMyzo9BPlem0ToCCtJuruM5EQQhPRrbPuYkJlGty4cqcyyLtPQwe0sgARbiAbYIa+vxi0mvYxf0s2HZwpBqIa3BkgL6ozdOVBk2a0hgjEQbkeGSRCo+R4fgtb4QHB5OamTKO6HF5ceECNe76eR4P8GYp6LBNj3R/sUJb8Fmp/7xs9q5JYkJ6+RKJzpLWFOd7U0xAsC9D3r/PDJHAuzjbiAi/f9C0nD0UQgPtLXeytp85W71bRd7Dommk785kphporaM7xteUWYMK0Jmo02zRa8qdo+fqFJQQ7lFovSHQO+boIBI3MnOHhlz54XFnkPJkfM9NIrCq2zOlxtJgW4B1Zuw93z7zFUfPOEekMoqAXR/tCKpdV1e5XhikSCNSWv1EHPZaB+IsaOzWEPY8rcA/l47gWXoa9Mgv8rTzj489EzoXrqXv/8yb6TSBOezTypt6MNYqiABnRv43mo2CvtlG5ERQM3izWC6vo00=
|
|
12
13
|
gem: power_api
|
|
13
14
|
on:
|
|
14
15
|
tags: true
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
power_api (0.
|
|
4
|
+
power_api (0.2.0)
|
|
5
5
|
active_model_serializers (~> 0.10.0)
|
|
6
6
|
api-pagination
|
|
7
7
|
kaminari
|
|
@@ -67,7 +67,7 @@ GEM
|
|
|
67
67
|
api-pagination (4.8.2)
|
|
68
68
|
arel (9.0.0)
|
|
69
69
|
ast (2.4.0)
|
|
70
|
-
bcrypt (3.1.
|
|
70
|
+
bcrypt (3.1.16)
|
|
71
71
|
builder (3.2.3)
|
|
72
72
|
case_transform (0.2)
|
|
73
73
|
activesupport
|
|
@@ -79,8 +79,8 @@ GEM
|
|
|
79
79
|
term-ansicolor (~> 1.3)
|
|
80
80
|
thor (~> 0.19.4)
|
|
81
81
|
tins (~> 1.6)
|
|
82
|
-
crass (1.0.
|
|
83
|
-
devise (4.7.
|
|
82
|
+
crass (1.0.6)
|
|
83
|
+
devise (4.7.3)
|
|
84
84
|
bcrypt (~> 3.0)
|
|
85
85
|
orm_adapter (~> 0.1)
|
|
86
86
|
railties (>= 4.1.0)
|
|
@@ -119,23 +119,23 @@ GEM
|
|
|
119
119
|
json-schema (2.8.1)
|
|
120
120
|
addressable (>= 2.4)
|
|
121
121
|
jsonapi-renderer (0.2.2)
|
|
122
|
-
kaminari (1.
|
|
122
|
+
kaminari (1.2.1)
|
|
123
123
|
activesupport (>= 4.1.0)
|
|
124
|
-
kaminari-actionview (= 1.
|
|
125
|
-
kaminari-activerecord (= 1.
|
|
126
|
-
kaminari-core (= 1.
|
|
127
|
-
kaminari-actionview (1.
|
|
124
|
+
kaminari-actionview (= 1.2.1)
|
|
125
|
+
kaminari-activerecord (= 1.2.1)
|
|
126
|
+
kaminari-core (= 1.2.1)
|
|
127
|
+
kaminari-actionview (1.2.1)
|
|
128
128
|
actionview
|
|
129
|
-
kaminari-core (= 1.
|
|
130
|
-
kaminari-activerecord (1.
|
|
129
|
+
kaminari-core (= 1.2.1)
|
|
130
|
+
kaminari-activerecord (1.2.1)
|
|
131
131
|
activerecord
|
|
132
|
-
kaminari-core (= 1.
|
|
133
|
-
kaminari-core (1.
|
|
132
|
+
kaminari-core (= 1.2.1)
|
|
133
|
+
kaminari-core (1.2.1)
|
|
134
134
|
listen (3.1.5)
|
|
135
135
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
|
136
136
|
rb-inotify (~> 0.9, >= 0.9.7)
|
|
137
137
|
ruby_dep (~> 1.2)
|
|
138
|
-
loofah (2.
|
|
138
|
+
loofah (2.4.0)
|
|
139
139
|
crass (~> 1.0.2)
|
|
140
140
|
nokogiri (>= 1.5.9)
|
|
141
141
|
lumberjack (1.0.13)
|
|
@@ -144,13 +144,13 @@ GEM
|
|
|
144
144
|
marcel (0.3.3)
|
|
145
145
|
mimemagic (~> 0.3.2)
|
|
146
146
|
method_source (0.9.2)
|
|
147
|
-
mimemagic (0.3.
|
|
147
|
+
mimemagic (0.3.5)
|
|
148
148
|
mini_mime (1.0.2)
|
|
149
149
|
mini_portile2 (2.4.0)
|
|
150
150
|
minitest (5.11.3)
|
|
151
151
|
nenv (0.3.0)
|
|
152
|
-
nio4r (2.5.
|
|
153
|
-
nokogiri (1.10.
|
|
152
|
+
nio4r (2.5.4)
|
|
153
|
+
nokogiri (1.10.9)
|
|
154
154
|
mini_portile2 (~> 2.4.0)
|
|
155
155
|
notiffany (0.1.1)
|
|
156
156
|
nenv (~> 0.1)
|
|
@@ -159,8 +159,8 @@ GEM
|
|
|
159
159
|
parallel (1.19.1)
|
|
160
160
|
parser (2.7.0.2)
|
|
161
161
|
ast (~> 2.4.0)
|
|
162
|
-
polyamorous (2.3.
|
|
163
|
-
activerecord (>= 5.
|
|
162
|
+
polyamorous (2.3.2)
|
|
163
|
+
activerecord (>= 5.2.1)
|
|
164
164
|
powerpack (0.1.2)
|
|
165
165
|
pry (0.12.2)
|
|
166
166
|
coderay (~> 1.1.0)
|
|
@@ -169,7 +169,7 @@ GEM
|
|
|
169
169
|
pry (>= 0.10.4)
|
|
170
170
|
psych (3.1.0)
|
|
171
171
|
public_suffix (4.0.1)
|
|
172
|
-
rack (2.
|
|
172
|
+
rack (2.2.2)
|
|
173
173
|
rack-test (1.1.0)
|
|
174
174
|
rack (>= 1.0, < 3)
|
|
175
175
|
rails (5.2.2.1)
|
|
@@ -197,17 +197,16 @@ GEM
|
|
|
197
197
|
rake (>= 0.8.7)
|
|
198
198
|
thor (>= 0.19.0, < 2.0)
|
|
199
199
|
rainbow (3.0.0)
|
|
200
|
-
rake (
|
|
201
|
-
ransack (2.3.
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
activesupport (>= 5.0)
|
|
200
|
+
rake (13.0.1)
|
|
201
|
+
ransack (2.3.2)
|
|
202
|
+
activerecord (>= 5.2.1)
|
|
203
|
+
activesupport (>= 5.2.1)
|
|
205
204
|
i18n
|
|
206
|
-
polyamorous (= 2.3.
|
|
205
|
+
polyamorous (= 2.3.2)
|
|
207
206
|
rb-fsevent (0.10.3)
|
|
208
207
|
rb-inotify (0.10.0)
|
|
209
208
|
ffi (~> 1.0)
|
|
210
|
-
responders (3.0.
|
|
209
|
+
responders (3.0.1)
|
|
211
210
|
actionpack (>= 5.0)
|
|
212
211
|
railties (>= 5.0)
|
|
213
212
|
rspec (3.8.0)
|
|
@@ -263,10 +262,10 @@ GEM
|
|
|
263
262
|
json (>= 1.8, < 3)
|
|
264
263
|
simplecov-html (~> 0.10.0)
|
|
265
264
|
simplecov-html (0.10.2)
|
|
266
|
-
sprockets (4.0.
|
|
265
|
+
sprockets (4.0.2)
|
|
267
266
|
concurrent-ruby (~> 1.0)
|
|
268
267
|
rack (> 1, < 3)
|
|
269
|
-
sprockets-rails (3.2.
|
|
268
|
+
sprockets-rails (3.2.2)
|
|
270
269
|
actionpack (>= 4.0)
|
|
271
270
|
activesupport (>= 4.0)
|
|
272
271
|
sprockets (>= 3.0.0)
|
|
@@ -283,12 +282,12 @@ GEM
|
|
|
283
282
|
activesupport (>= 3)
|
|
284
283
|
railties (>= 3)
|
|
285
284
|
yard (~> 0.9.11)
|
|
286
|
-
warden (1.2.
|
|
287
|
-
rack (>= 2.0.
|
|
288
|
-
websocket-driver (0.7.
|
|
285
|
+
warden (1.2.9)
|
|
286
|
+
rack (>= 2.0.9)
|
|
287
|
+
websocket-driver (0.7.3)
|
|
289
288
|
websocket-extensions (>= 0.1.0)
|
|
290
|
-
websocket-extensions (0.1.
|
|
291
|
-
yard (0.9.
|
|
289
|
+
websocket-extensions (0.1.5)
|
|
290
|
+
yard (0.9.25)
|
|
292
291
|
|
|
293
292
|
PLATFORMS
|
|
294
293
|
ruby
|
data/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Power API
|
|
2
2
|
|
|
3
|
+
[](https://badge.fury.io/rb/power_api)
|
|
4
|
+
[](https://travis-ci.org/platanus/power_api)
|
|
5
|
+
[](https://coveralls.io/github/platanus/power_api?branch=master)
|
|
6
|
+
|
|
3
7
|
It's a Rails engine that gathers a set of gems and configurations designed to build incredible REST APIs.
|
|
4
8
|
|
|
5
9
|
These gems are:
|
|
@@ -26,6 +30,7 @@ These gems are:
|
|
|
26
30
|
- [Controller Generation](#controller-generation)
|
|
27
31
|
- [Command Options](#command-options-1)
|
|
28
32
|
- [--attributes](#--attributes)
|
|
33
|
+
- [--controller-actions](#--controller-actions)
|
|
29
34
|
- [--version-number](#--version-number)
|
|
30
35
|
- [--use-paginator](#--use-paginator)
|
|
31
36
|
- [--allow-filters](#--allow-filters)
|
|
@@ -508,6 +513,36 @@ class Api::V1::BlogSerializer < ActiveModel::Serializer
|
|
|
508
513
|
end
|
|
509
514
|
```
|
|
510
515
|
|
|
516
|
+
##### `--controller-actions`
|
|
517
|
+
|
|
518
|
+
Use this option if you want to choose which actions will be included in the controller.
|
|
519
|
+
|
|
520
|
+
```bash
|
|
521
|
+
rails g power_api:controller blog --controller-actions=show destroy
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
When you do this, you will see that only relevant code is generated in controller, tests and routes.
|
|
525
|
+
|
|
526
|
+
For example, the controller would only include the `show` and `destroy` actions and wouldn't include the `blog_params` method:
|
|
527
|
+
|
|
528
|
+
```ruby
|
|
529
|
+
class Api::V1::BlogSerializer < Api::V1::BaseController
|
|
530
|
+
def show
|
|
531
|
+
respond_with blog
|
|
532
|
+
end
|
|
533
|
+
|
|
534
|
+
def destroy
|
|
535
|
+
respond_with blog.destroy!
|
|
536
|
+
end
|
|
537
|
+
|
|
538
|
+
private
|
|
539
|
+
|
|
540
|
+
def blog
|
|
541
|
+
@blog ||= Blog.find_by!(id: params[:id])
|
|
542
|
+
end
|
|
543
|
+
end
|
|
544
|
+
```
|
|
545
|
+
|
|
511
546
|
##### `--version-number`
|
|
512
547
|
|
|
513
548
|
Use this option if you want to decide which version the new controller will belong to.
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
class PowerApi::ControllerGenerator < Rails::Generators::NamedBase
|
|
2
2
|
source_root File.expand_path('templates', __dir__)
|
|
3
3
|
|
|
4
|
+
def self.valid_actions
|
|
5
|
+
PowerApi::GeneratorHelpers::PERMITTED_ACTIONS
|
|
6
|
+
end
|
|
7
|
+
|
|
4
8
|
class_option(
|
|
5
9
|
:attributes,
|
|
6
10
|
type: 'array',
|
|
@@ -9,6 +13,13 @@ class PowerApi::ControllerGenerator < Rails::Generators::NamedBase
|
|
|
9
13
|
desc: 'attributes to show in serializer'
|
|
10
14
|
)
|
|
11
15
|
|
|
16
|
+
class_option(
|
|
17
|
+
:controller_actions,
|
|
18
|
+
type: 'array',
|
|
19
|
+
default: [],
|
|
20
|
+
desc: "actions to include in controller. Valid values: #{valid_actions.join(', ')}"
|
|
21
|
+
)
|
|
22
|
+
|
|
12
23
|
class_option(
|
|
13
24
|
:version_number,
|
|
14
25
|
type: 'numeric',
|
|
@@ -63,10 +74,12 @@ class PowerApi::ControllerGenerator < Rails::Generators::NamedBase
|
|
|
63
74
|
|
|
64
75
|
def add_routes
|
|
65
76
|
if helper.parent_resource?
|
|
66
|
-
|
|
67
|
-
|
|
77
|
+
if helper.resource_actions?
|
|
78
|
+
add_normal_route(actions: helper.controller_actions & ["show", "update", "destroy"])
|
|
79
|
+
end
|
|
80
|
+
add_nested_route if helper.collection_actions?
|
|
68
81
|
else
|
|
69
|
-
add_normal_route
|
|
82
|
+
add_normal_route(actions: helper.controller_actions)
|
|
70
83
|
end
|
|
71
84
|
|
|
72
85
|
helper.format_ruby_file(helper.routes_path)
|
|
@@ -107,7 +120,9 @@ class PowerApi::ControllerGenerator < Rails::Generators::NamedBase
|
|
|
107
120
|
|
|
108
121
|
def add_nested_route
|
|
109
122
|
line_to_replace = helper.parent_resource_routes_line_regex
|
|
110
|
-
nested_resource_line = helper.resource_route_tpl(
|
|
123
|
+
nested_resource_line = helper.resource_route_tpl(
|
|
124
|
+
actions: helper.controller_actions & ['index', 'create']
|
|
125
|
+
)
|
|
111
126
|
add_nested_parent_route unless helper.parent_route_exist?
|
|
112
127
|
|
|
113
128
|
if helper.parent_route_already_have_children?
|
|
@@ -119,9 +134,10 @@ class PowerApi::ControllerGenerator < Rails::Generators::NamedBase
|
|
|
119
134
|
end
|
|
120
135
|
end
|
|
121
136
|
|
|
122
|
-
def add_normal_route(actions:
|
|
137
|
+
def add_normal_route(actions:)
|
|
138
|
+
actions_for_only_option = actions.sort == self.class.valid_actions.sort ? [] : actions
|
|
123
139
|
add_route(helper.api_version_routes_line_regex) do |match|
|
|
124
|
-
"#{match}\n#{helper.resource_route_tpl(actions:
|
|
140
|
+
"#{match}\n#{helper.resource_route_tpl(actions: actions_for_only_option)}"
|
|
125
141
|
end
|
|
126
142
|
end
|
|
127
143
|
|
|
@@ -145,6 +161,7 @@ class PowerApi::ControllerGenerator < Rails::Generators::NamedBase
|
|
|
145
161
|
parent_resource: options[:parent_resource],
|
|
146
162
|
owned_by_authenticated_resource: options[:owned_by_authenticated_resource],
|
|
147
163
|
resource_attributes: options[:attributes],
|
|
164
|
+
controller_actions: options[:controller_actions],
|
|
148
165
|
use_paginator: options[:use_paginator],
|
|
149
166
|
allow_filters: options[:allow_filters]
|
|
150
167
|
)
|
data/lib/power_api/engine.rb
CHANGED
|
@@ -11,6 +11,7 @@ module PowerApi
|
|
|
11
11
|
|
|
12
12
|
initializer "initialize" do
|
|
13
13
|
require_relative "./errors"
|
|
14
|
+
require_relative "./generator_helper/controller_actions_helper"
|
|
14
15
|
require_relative "./generator_helper/active_record_resource"
|
|
15
16
|
require_relative "./generator_helper/version_helper"
|
|
16
17
|
require_relative "./generator_helper/resource_helper"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module PowerApi::GeneratorHelper::ControllerActionsHelper
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
PERMITTED_ACTIONS = ['index', 'create', 'show', 'update', 'destroy']
|
|
5
|
+
|
|
6
|
+
attr_reader :controller_actions
|
|
7
|
+
|
|
8
|
+
def controller_actions=(actions)
|
|
9
|
+
@controller_actions = actions.blank? ? PERMITTED_ACTIONS : actions & PERMITTED_ACTIONS
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
PERMITTED_ACTIONS.each do |action|
|
|
13
|
+
define_method("#{action}?") { controller_actions.include?(action) }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def resource_actions?
|
|
17
|
+
show? || update? || destroy?
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def collection_actions?
|
|
21
|
+
index? || create?
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def update_or_create?
|
|
25
|
+
update? || create?
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -8,6 +8,7 @@ module PowerApi::GeneratorHelper::ControllerHelper
|
|
|
8
8
|
include PowerApi::GeneratorHelper::PaginationHelper
|
|
9
9
|
include PowerApi::GeneratorHelper::SimpleTokenAuthHelper
|
|
10
10
|
include PowerApi::GeneratorHelper::TemplateBuilderHelper
|
|
11
|
+
include PowerApi::GeneratorHelper::ControllerActionsHelper
|
|
11
12
|
|
|
12
13
|
attr_accessor :allow_filters
|
|
13
14
|
end
|
|
@@ -73,18 +74,26 @@ fallback: :exception\n"
|
|
|
73
74
|
end
|
|
74
75
|
|
|
75
76
|
def ctrl_tpl_index
|
|
77
|
+
return unless index?
|
|
78
|
+
|
|
76
79
|
concat_tpl_method("index", "respond_with #{ctrl_tpl_index_resources}")
|
|
77
80
|
end
|
|
78
81
|
|
|
79
82
|
def ctrl_tpl_show
|
|
83
|
+
return unless show?
|
|
84
|
+
|
|
80
85
|
concat_tpl_method("show", "respond_with #{resource.snake_case}")
|
|
81
86
|
end
|
|
82
87
|
|
|
83
88
|
def ctrl_tpl_create
|
|
89
|
+
return unless create?
|
|
90
|
+
|
|
84
91
|
concat_tpl_method("create", "respond_with #{ctrl_tpl_create_resource}")
|
|
85
92
|
end
|
|
86
93
|
|
|
87
94
|
def ctrl_tpl_update
|
|
95
|
+
return unless update?
|
|
96
|
+
|
|
88
97
|
concat_tpl_method(
|
|
89
98
|
"update",
|
|
90
99
|
"respond_with #{resource.snake_case}.update!(#{resource.snake_case}_params)"
|
|
@@ -92,14 +101,20 @@ fallback: :exception\n"
|
|
|
92
101
|
end
|
|
93
102
|
|
|
94
103
|
def ctrl_tpl_destroy
|
|
104
|
+
return unless destroy?
|
|
105
|
+
|
|
95
106
|
concat_tpl_method("destroy", "respond_with #{resource.snake_case}.destroy!")
|
|
96
107
|
end
|
|
97
108
|
|
|
98
109
|
def ctrl_tpl_resource
|
|
110
|
+
return unless resource_actions?
|
|
111
|
+
|
|
99
112
|
concat_tpl_method(resource.snake_case, "@#{resource.snake_case} ||= #{ctrl_tpl_find_resource}")
|
|
100
113
|
end
|
|
101
114
|
|
|
102
115
|
def ctrl_tpl_permitted_params
|
|
116
|
+
return unless update_or_create?
|
|
117
|
+
|
|
103
118
|
concat_tpl_method(
|
|
104
119
|
"#{resource.snake_case}_params",
|
|
105
120
|
"params.require(:#{resource.snake_case}).permit(",
|
|
@@ -9,6 +9,7 @@ module PowerApi::GeneratorHelper::SwaggerHelper
|
|
|
9
9
|
include PowerApi::GeneratorHelper::ResourceHelper
|
|
10
10
|
include PowerApi::GeneratorHelper::SimpleTokenAuthHelper
|
|
11
11
|
include PowerApi::GeneratorHelper::TemplateBuilderHelper
|
|
12
|
+
include PowerApi::GeneratorHelper::ControllerActionsHelper
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
def swagger_helper_path
|
|
@@ -201,6 +202,8 @@ swagger_doc: 'v#{version_number}/swagger.json' do"
|
|
|
201
202
|
end
|
|
202
203
|
|
|
203
204
|
def spec_tpl_collection_path_statements
|
|
205
|
+
return unless collection_actions?
|
|
206
|
+
|
|
204
207
|
concat_tpl_statements(
|
|
205
208
|
"path '/#{spec_tpl_collection_path}' do",
|
|
206
209
|
spec_tpl_parent_resource_parameter,
|
|
@@ -218,6 +221,8 @@ swagger_doc: 'v#{version_number}/swagger.json' do"
|
|
|
218
221
|
end
|
|
219
222
|
|
|
220
223
|
def spec_tpl_resource_path_statements
|
|
224
|
+
return unless resource_actions?
|
|
225
|
+
|
|
221
226
|
concat_tpl_statements(
|
|
222
227
|
"path '/#{resource.plural}/{id}' do",
|
|
223
228
|
spec_tpl_authenticated_resource_params,
|
|
@@ -251,6 +256,8 @@ swagger_doc: 'v#{version_number}/swagger.json' do"
|
|
|
251
256
|
end
|
|
252
257
|
|
|
253
258
|
def spec_tpl_index
|
|
259
|
+
return unless index?
|
|
260
|
+
|
|
254
261
|
concat_tpl_statements(
|
|
255
262
|
"get 'Retrieves #{resource.plural_titleized}' do",
|
|
256
263
|
"description 'Retrieves all the #{resource.plural}'",
|
|
@@ -286,6 +293,8 @@ swagger_doc: 'v#{version_number}/swagger.json' do"
|
|
|
286
293
|
end
|
|
287
294
|
|
|
288
295
|
def spec_tpl_create
|
|
296
|
+
return unless create?
|
|
297
|
+
|
|
289
298
|
concat_tpl_statements(
|
|
290
299
|
"post 'Creates #{resource.titleized}' do",
|
|
291
300
|
"description 'Creates #{resource.titleized}'",
|
|
@@ -320,6 +329,8 @@ swagger_doc: 'v#{version_number}/swagger.json' do"
|
|
|
320
329
|
end
|
|
321
330
|
|
|
322
331
|
def spec_tpl_show
|
|
332
|
+
return unless show?
|
|
333
|
+
|
|
323
334
|
concat_tpl_statements(
|
|
324
335
|
"get 'Retrieves #{resource.titleized}' do",
|
|
325
336
|
"produces 'application/json'\n",
|
|
@@ -337,6 +348,8 @@ swagger_doc: 'v#{version_number}/swagger.json' do"
|
|
|
337
348
|
end
|
|
338
349
|
|
|
339
350
|
def spec_tpl_update
|
|
351
|
+
return unless update?
|
|
352
|
+
|
|
340
353
|
concat_tpl_statements(
|
|
341
354
|
"put 'Updates #{resource.titleized}' do",
|
|
342
355
|
"description 'Updates #{resource.titleized}'",
|
|
@@ -356,6 +369,8 @@ swagger_doc: 'v#{version_number}/swagger.json' do"
|
|
|
356
369
|
end
|
|
357
370
|
|
|
358
371
|
def spec_tpl_destroy
|
|
372
|
+
return unless destroy?
|
|
373
|
+
|
|
359
374
|
concat_tpl_statements(
|
|
360
375
|
"delete 'Deletes #{resource.titleized}' do",
|
|
361
376
|
"produces 'application/json'",
|
data/lib/power_api/version.rb
CHANGED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
RSpec.describe PowerApi::GeneratorHelper::ControllerActionsHelper, type: :generator do
|
|
2
|
+
describe '#controller_actions=' do
|
|
3
|
+
context 'when arg is nil' do
|
|
4
|
+
before { generators_helper.controller_actions = nil }
|
|
5
|
+
|
|
6
|
+
it do
|
|
7
|
+
expect(generators_helper.controller_actions).to(
|
|
8
|
+
match_array(generators_helper.class::PERMITTED_ACTIONS)
|
|
9
|
+
)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
context 'when arg is empty array' do
|
|
14
|
+
before { generators_helper.controller_actions = [] }
|
|
15
|
+
|
|
16
|
+
it do
|
|
17
|
+
expect(generators_helper.controller_actions).to(
|
|
18
|
+
match_array(generators_helper.class::PERMITTED_ACTIONS)
|
|
19
|
+
)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
context 'when including not permitted actions' do
|
|
24
|
+
before { generators_helper.controller_actions = ['index', 'clone'] }
|
|
25
|
+
|
|
26
|
+
it 'ignores them' do
|
|
27
|
+
expect(generators_helper.controller_actions).to match_array(['index'])
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
context 'when including only permitted actions' do
|
|
32
|
+
let(:actions) { ['index', 'show'] }
|
|
33
|
+
|
|
34
|
+
before { generators_helper.controller_actions = actions }
|
|
35
|
+
|
|
36
|
+
it 'includes them all' do
|
|
37
|
+
expect(generators_helper.controller_actions).to match_array(actions)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
describe 'index?' do
|
|
43
|
+
context 'when including index action' do
|
|
44
|
+
before { generators_helper.controller_actions = ['index'] }
|
|
45
|
+
|
|
46
|
+
it { expect(generators_helper.index?).to be(true) }
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
context 'when not including index action' do
|
|
50
|
+
before { generators_helper.controller_actions = ['show'] }
|
|
51
|
+
|
|
52
|
+
it { expect(generators_helper.index?).to be(false) }
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
describe 'show?' do
|
|
57
|
+
context 'when including show action' do
|
|
58
|
+
before { generators_helper.controller_actions = ['show'] }
|
|
59
|
+
|
|
60
|
+
it { expect(generators_helper.show?).to be(true) }
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
context 'when not including show action' do
|
|
64
|
+
before { generators_helper.controller_actions = ['index'] }
|
|
65
|
+
|
|
66
|
+
it { expect(generators_helper.show?).to be(false) }
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
describe 'update?' do
|
|
71
|
+
context 'when including update action' do
|
|
72
|
+
before { generators_helper.controller_actions = ['update'] }
|
|
73
|
+
|
|
74
|
+
it { expect(generators_helper.update?).to be(true) }
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
context 'when not including update action' do
|
|
78
|
+
before { generators_helper.controller_actions = ['show'] }
|
|
79
|
+
|
|
80
|
+
it { expect(generators_helper.update?).to be(false) }
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
describe 'create?' do
|
|
85
|
+
context 'when including create action' do
|
|
86
|
+
before { generators_helper.controller_actions = ['create'] }
|
|
87
|
+
|
|
88
|
+
it { expect(generators_helper.create?).to be(true) }
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
context 'when not including create action' do
|
|
92
|
+
before { generators_helper.controller_actions = ['show'] }
|
|
93
|
+
|
|
94
|
+
it { expect(generators_helper.create?).to be(false) }
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
describe 'destroy?' do
|
|
99
|
+
context 'when including destroy action' do
|
|
100
|
+
before { generators_helper.controller_actions = ['destroy'] }
|
|
101
|
+
|
|
102
|
+
it { expect(generators_helper.destroy?).to be(true) }
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
context 'when not including destroy action' do
|
|
106
|
+
before { generators_helper.controller_actions = ['show'] }
|
|
107
|
+
|
|
108
|
+
it { expect(generators_helper.destroy?).to be(false) }
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
describe 'resource_actions?' do
|
|
113
|
+
context 'when including show action' do
|
|
114
|
+
before { generators_helper.controller_actions = ['show'] }
|
|
115
|
+
|
|
116
|
+
it { expect(generators_helper.resource_actions?).to be(true) }
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
context 'when including update action' do
|
|
120
|
+
before { generators_helper.controller_actions = ['update'] }
|
|
121
|
+
|
|
122
|
+
it { expect(generators_helper.resource_actions?).to be(true) }
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
context 'when including destroy action' do
|
|
126
|
+
before { generators_helper.controller_actions = ['destroy'] }
|
|
127
|
+
|
|
128
|
+
it { expect(generators_helper.resource_actions?).to be(true) }
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
context 'when not including show, update or destroy actions' do
|
|
132
|
+
before { generators_helper.controller_actions = ['index', 'create'] }
|
|
133
|
+
|
|
134
|
+
it { expect(generators_helper.resource_actions?).to be(false) }
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
describe 'collection_actions?' do
|
|
139
|
+
context 'when including index action' do
|
|
140
|
+
before { generators_helper.controller_actions = ['index'] }
|
|
141
|
+
|
|
142
|
+
it { expect(generators_helper.collection_actions?).to be(true) }
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
context 'when including create action' do
|
|
146
|
+
before { generators_helper.controller_actions = ['create'] }
|
|
147
|
+
|
|
148
|
+
it { expect(generators_helper.collection_actions?).to be(true) }
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
context 'when not including index or create actions' do
|
|
152
|
+
before { generators_helper.controller_actions = ['show', 'update', 'destroy'] }
|
|
153
|
+
|
|
154
|
+
it { expect(generators_helper.collection_actions?).to be(false) }
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
describe 'update_or_create?' do
|
|
159
|
+
context 'when including update action' do
|
|
160
|
+
before { generators_helper.controller_actions = ['update'] }
|
|
161
|
+
|
|
162
|
+
it { expect(generators_helper.update_or_create?).to be(true) }
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
context 'when including create action' do
|
|
166
|
+
before { generators_helper.controller_actions = ['create'] }
|
|
167
|
+
|
|
168
|
+
it { expect(generators_helper.update_or_create?).to be(true) }
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
context 'when not including update or create actions' do
|
|
172
|
+
before { generators_helper.controller_actions = ['show', 'index', 'destroy'] }
|
|
173
|
+
|
|
174
|
+
it { expect(generators_helper.update_or_create?).to be(false) }
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
end
|
|
@@ -112,6 +112,69 @@ RSpec.describe PowerApi::GeneratorHelper::ControllerHelper, type: :generator do
|
|
|
112
112
|
it { expect(perform).to include(expected) }
|
|
113
113
|
end
|
|
114
114
|
|
|
115
|
+
context 'with specific actions' do
|
|
116
|
+
let(:controller_actions) do
|
|
117
|
+
[
|
|
118
|
+
"show",
|
|
119
|
+
"update",
|
|
120
|
+
"index"
|
|
121
|
+
]
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
it { expect(perform).to include("def show\n") }
|
|
125
|
+
it { expect(perform).to include("def update\n") }
|
|
126
|
+
it { expect(perform).to include("def index\n") }
|
|
127
|
+
it { expect(perform).not_to include("def destroy\n") }
|
|
128
|
+
it { expect(perform).not_to include("def create\n") }
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
context 'with only collection actions' do
|
|
132
|
+
let(:controller_actions) do
|
|
133
|
+
[
|
|
134
|
+
"index",
|
|
135
|
+
"create"
|
|
136
|
+
]
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
it { expect(perform).not_to include("def blog\n") }
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
context 'with some reource actions' do
|
|
143
|
+
let(:controller_actions) do
|
|
144
|
+
[
|
|
145
|
+
"index",
|
|
146
|
+
"create",
|
|
147
|
+
"show"
|
|
148
|
+
]
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
it { expect(perform).to include("def blog\n") }
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
context 'with update action' do
|
|
155
|
+
let(:controller_actions) { ["update"] }
|
|
156
|
+
|
|
157
|
+
it { expect(perform).to include("def blog_params\n") }
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
context 'with create action' do
|
|
161
|
+
let(:controller_actions) { ["create"] }
|
|
162
|
+
|
|
163
|
+
it { expect(perform).to include("def blog_params\n") }
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
context 'without update or create actions' do
|
|
167
|
+
let(:controller_actions) do
|
|
168
|
+
[
|
|
169
|
+
"index",
|
|
170
|
+
"destroy",
|
|
171
|
+
"show"
|
|
172
|
+
]
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
it { expect(perform).not_to include("def blog_params\n") }
|
|
176
|
+
end
|
|
177
|
+
|
|
115
178
|
context "with true use_paginator option" do
|
|
116
179
|
let(:use_paginator) { true }
|
|
117
180
|
let(:expected) do
|
|
@@ -421,6 +421,35 @@ RSpec.describe PowerApi::GeneratorHelper::SwaggerHelper, type: :generator do
|
|
|
421
421
|
it { expect(perform).to include("let(:portfolio) { create(:portfolio) }") }
|
|
422
422
|
it { expect(perform).to include("(:existent_blog) { create(:blog, portfolio: portfolio) }") }
|
|
423
423
|
end
|
|
424
|
+
|
|
425
|
+
context 'with only some resource actions (show and update)' do
|
|
426
|
+
let(:controller_actions) do
|
|
427
|
+
[
|
|
428
|
+
"show",
|
|
429
|
+
"update"
|
|
430
|
+
]
|
|
431
|
+
end
|
|
432
|
+
|
|
433
|
+
it { expect(perform).to include("path '/blogs/{id}' do\n") }
|
|
434
|
+
it { expect(perform).to include("get 'Retrieves Blog' do\n") }
|
|
435
|
+
it { expect(perform).to include("put 'Updates Blog' do\n") }
|
|
436
|
+
it { expect(perform).not_to include("delete 'Deletes Blog' do\n") }
|
|
437
|
+
it { expect(perform).not_to include("path '/blogs' do\n") }
|
|
438
|
+
it { expect(perform).not_to include("get 'Retrieves Blogs' do\n") }
|
|
439
|
+
it { expect(perform).not_to include("post 'Creates Blog' do\n") }
|
|
440
|
+
end
|
|
441
|
+
|
|
442
|
+
context 'with only some collection actions (index)' do
|
|
443
|
+
let(:controller_actions) { ["index"] }
|
|
444
|
+
|
|
445
|
+
it { expect(perform).not_to include("path '/blogs/{id}' do\n") }
|
|
446
|
+
it { expect(perform).not_to include("get 'Retrieves Blog' do\n") }
|
|
447
|
+
it { expect(perform).not_to include("put 'Updates Blog' do\n") }
|
|
448
|
+
it { expect(perform).not_to include("delete 'Deletes Blog' do\n") }
|
|
449
|
+
it { expect(perform).to include("path '/blogs' do\n") }
|
|
450
|
+
it { expect(perform).to include("get 'Retrieves Blogs' do\n") }
|
|
451
|
+
it { expect(perform).not_to include("post 'Creates Blog' do\n") }
|
|
452
|
+
end
|
|
424
453
|
end
|
|
425
454
|
|
|
426
455
|
describe "#rswag_ui_swagger_endpoint" do
|
|
@@ -10,6 +10,7 @@ module TestGeneratorHelpers
|
|
|
10
10
|
let(:parent_resource_name) { nil }
|
|
11
11
|
let(:owned_by_authenticated_resource) { false }
|
|
12
12
|
let(:resource_attributes) { nil }
|
|
13
|
+
let(:controller_actions) { [] }
|
|
13
14
|
let(:use_paginator) { false }
|
|
14
15
|
let(:allow_filters) { false }
|
|
15
16
|
|
|
@@ -18,6 +19,7 @@ module TestGeneratorHelpers
|
|
|
18
19
|
version_number: version_number,
|
|
19
20
|
resource: resource_name,
|
|
20
21
|
resource_attributes: resource_attributes,
|
|
22
|
+
controller_actions: controller_actions,
|
|
21
23
|
parent_resource: parent_resource_name,
|
|
22
24
|
use_paginator: use_paginator,
|
|
23
25
|
authenticated_resource: authenticated_resource,
|
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.
|
|
4
|
+
version: 0.2.0
|
|
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: 2021-01-22 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rails
|
|
@@ -342,6 +342,7 @@ files:
|
|
|
342
342
|
- lib/power_api/errors.rb
|
|
343
343
|
- lib/power_api/generator_helper/active_record_resource.rb
|
|
344
344
|
- lib/power_api/generator_helper/ams_helper.rb
|
|
345
|
+
- lib/power_api/generator_helper/controller_actions_helper.rb
|
|
345
346
|
- lib/power_api/generator_helper/controller_helper.rb
|
|
346
347
|
- lib/power_api/generator_helper/pagination_helper.rb
|
|
347
348
|
- lib/power_api/generator_helper/resource_helper.rb
|
|
@@ -405,40 +406,11 @@ files:
|
|
|
405
406
|
- spec/dummy/config/routes.rb
|
|
406
407
|
- spec/dummy/config/secrets.yml
|
|
407
408
|
- spec/dummy/config/spring.rb
|
|
408
|
-
- spec/dummy/coverage/assets/0.10.2/application.css
|
|
409
|
-
- spec/dummy/coverage/assets/0.10.2/application.js
|
|
410
|
-
- spec/dummy/coverage/assets/0.10.2/colorbox/border.png
|
|
411
|
-
- spec/dummy/coverage/assets/0.10.2/colorbox/controls.png
|
|
412
|
-
- spec/dummy/coverage/assets/0.10.2/colorbox/loading.gif
|
|
413
|
-
- spec/dummy/coverage/assets/0.10.2/colorbox/loading_background.png
|
|
414
|
-
- spec/dummy/coverage/assets/0.10.2/favicon_green.png
|
|
415
|
-
- spec/dummy/coverage/assets/0.10.2/favicon_red.png
|
|
416
|
-
- spec/dummy/coverage/assets/0.10.2/favicon_yellow.png
|
|
417
|
-
- spec/dummy/coverage/assets/0.10.2/loading.gif
|
|
418
|
-
- spec/dummy/coverage/assets/0.10.2/magnify.png
|
|
419
|
-
- spec/dummy/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
|
|
420
|
-
- spec/dummy/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
|
|
421
|
-
- spec/dummy/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
|
|
422
|
-
- spec/dummy/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
|
|
423
|
-
- spec/dummy/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png
|
|
424
|
-
- spec/dummy/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
|
|
425
|
-
- spec/dummy/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
|
|
426
|
-
- spec/dummy/coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
|
|
427
|
-
- spec/dummy/coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png
|
|
428
|
-
- spec/dummy/coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png
|
|
429
|
-
- spec/dummy/coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png
|
|
430
|
-
- spec/dummy/coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png
|
|
431
|
-
- spec/dummy/coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png
|
|
432
|
-
- spec/dummy/coverage/index.html
|
|
433
|
-
- spec/dummy/db/development.sqlite3
|
|
434
409
|
- spec/dummy/db/migrate/20190322205209_create_blogs.rb
|
|
435
410
|
- spec/dummy/db/migrate/20200215225917_create_users.rb
|
|
436
411
|
- spec/dummy/db/migrate/20200227150449_create_portfolios.rb
|
|
437
412
|
- spec/dummy/db/migrate/20200227150548_add_portfolio_id_blogs.rb
|
|
438
413
|
- spec/dummy/db/schema.rb
|
|
439
|
-
- spec/dummy/db/test.sqlite3
|
|
440
|
-
- spec/dummy/log/development.log
|
|
441
|
-
- spec/dummy/log/test.log
|
|
442
414
|
- spec/dummy/package.json
|
|
443
415
|
- spec/dummy/public/404.html
|
|
444
416
|
- spec/dummy/public/422.html
|
|
@@ -452,6 +424,7 @@ files:
|
|
|
452
424
|
- spec/dummy/spec/factories/portfolios.rb
|
|
453
425
|
- spec/dummy/spec/factories/users.rb
|
|
454
426
|
- spec/dummy/spec/lib/power_api/generator_helper/ams_helper_spec.rb
|
|
427
|
+
- spec/dummy/spec/lib/power_api/generator_helper/controller_actions_helper_spec.rb
|
|
455
428
|
- spec/dummy/spec/lib/power_api/generator_helper/controller_helper_spec.rb
|
|
456
429
|
- spec/dummy/spec/lib/power_api/generator_helper/pagination_helper_spec.rb
|
|
457
430
|
- spec/dummy/spec/lib/power_api/generator_helper/resource_helper_spec.rb
|
|
@@ -484,119 +457,90 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
484
457
|
- !ruby/object:Gem::Version
|
|
485
458
|
version: '0'
|
|
486
459
|
requirements: []
|
|
487
|
-
|
|
488
|
-
rubygems_version: 2.7.6.2
|
|
460
|
+
rubygems_version: 3.0.8
|
|
489
461
|
signing_key:
|
|
490
462
|
specification_version: 4
|
|
491
463
|
summary: Set of other gems and configurations designed to build incredible APIs
|
|
492
464
|
test_files:
|
|
493
465
|
- spec/spec_helper.rb
|
|
494
466
|
- spec/dummy/app/mailers/application_mailer.rb
|
|
495
|
-
- spec/dummy/app/
|
|
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
|
|
496
473
|
- spec/dummy/app/models/blog.rb
|
|
497
474
|
- spec/dummy/app/models/application_record.rb
|
|
498
475
|
- spec/dummy/app/models/user.rb
|
|
499
|
-
- spec/dummy/app/
|
|
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
|
|
481
|
+
- spec/dummy/app/assets/config/manifest.js
|
|
500
482
|
- spec/dummy/app/controllers/application_controller.rb
|
|
501
|
-
- spec/dummy/app/controllers/concerns/api/error_spec.rb
|
|
502
483
|
- spec/dummy/app/controllers/concerns/api/deprecated_spec.rb
|
|
503
484
|
- spec/dummy/app/controllers/concerns/api/filtered_spec.rb
|
|
485
|
+
- spec/dummy/app/controllers/concerns/api/error_spec.rb
|
|
504
486
|
- spec/dummy/app/controllers/concerns/api/versioned_spec.rb
|
|
505
|
-
- spec/dummy/
|
|
506
|
-
- spec/dummy/
|
|
507
|
-
- spec/dummy/app/views/layouts/mailer.text.erb
|
|
508
|
-
- spec/dummy/app/assets/config/manifest.js
|
|
509
|
-
- spec/dummy/app/assets/javascripts/cable.js
|
|
510
|
-
- spec/dummy/app/assets/javascripts/application.js
|
|
511
|
-
- spec/dummy/app/assets/stylesheets/application.css
|
|
512
|
-
- spec/dummy/app/helpers/application_helper.rb
|
|
513
|
-
- spec/dummy/app/channels/application_cable/connection.rb
|
|
514
|
-
- spec/dummy/app/channels/application_cable/channel.rb
|
|
487
|
+
- spec/dummy/Rakefile
|
|
488
|
+
- spec/dummy/bin/yarn
|
|
515
489
|
- spec/dummy/bin/update
|
|
516
490
|
- spec/dummy/bin/rake
|
|
517
|
-
- spec/dummy/bin/setup
|
|
518
491
|
- spec/dummy/bin/bundle
|
|
519
|
-
- spec/dummy/bin/yarn
|
|
520
492
|
- spec/dummy/bin/rails
|
|
521
|
-
- spec/dummy/
|
|
522
|
-
- spec/dummy/
|
|
523
|
-
- spec/dummy/config/locales/en.yml
|
|
524
|
-
- spec/dummy/config/cable.yml
|
|
525
|
-
- spec/dummy/config/environments/production.rb
|
|
526
|
-
- spec/dummy/config/environments/development.rb
|
|
527
|
-
- spec/dummy/config/environments/test.rb
|
|
528
|
-
- spec/dummy/config/spring.rb
|
|
529
|
-
- spec/dummy/config/environment.rb
|
|
530
|
-
- spec/dummy/config/application.rb
|
|
531
|
-
- spec/dummy/config/puma.rb
|
|
532
|
-
- spec/dummy/config/database.yml
|
|
533
|
-
- spec/dummy/config/boot.rb
|
|
534
|
-
- spec/dummy/config/initializers/application_controller_renderer.rb
|
|
535
|
-
- spec/dummy/config/initializers/backtrace_silencers.rb
|
|
536
|
-
- spec/dummy/config/initializers/mime_types.rb
|
|
537
|
-
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
|
538
|
-
- spec/dummy/config/initializers/wrap_parameters.rb
|
|
539
|
-
- spec/dummy/config/initializers/assets.rb
|
|
540
|
-
- spec/dummy/config/initializers/cookies_serializer.rb
|
|
541
|
-
- spec/dummy/config/initializers/inflections.rb
|
|
542
|
-
- spec/dummy/config.ru
|
|
543
|
-
- spec/dummy/spec/support/test_helpers.rb
|
|
544
|
-
- spec/dummy/spec/support/test_generator_helpers.rb
|
|
545
|
-
- spec/dummy/spec/support/shared_examples/active_record_resource_atrributes.rb
|
|
546
|
-
- spec/dummy/spec/support/shared_examples/active_record_resource.rb
|
|
547
|
-
- spec/dummy/spec/factories/blogs.rb
|
|
548
|
-
- spec/dummy/spec/factories/portfolios.rb
|
|
549
|
-
- spec/dummy/spec/factories/users.rb
|
|
550
|
-
- spec/dummy/spec/lib/power_api/generator_helper/swagger_helper_spec.rb
|
|
493
|
+
- spec/dummy/bin/setup
|
|
494
|
+
- spec/dummy/spec/lib/power_api/generator_helper/controller_actions_helper_spec.rb
|
|
551
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
|
|
552
498
|
- spec/dummy/spec/lib/power_api/generator_helper/resource_helper_spec.rb
|
|
553
499
|
- spec/dummy/spec/lib/power_api/generator_helper/controller_helper_spec.rb
|
|
554
500
|
- spec/dummy/spec/lib/power_api/generator_helper/version_helper_spec.rb
|
|
555
501
|
- spec/dummy/spec/lib/power_api/generator_helper/ams_helper_spec.rb
|
|
556
|
-
- spec/dummy/spec/lib/power_api/generator_helper/pagination_helper_spec.rb
|
|
557
502
|
- spec/dummy/spec/lib/power_api/generator_helper/routes_helper_spec.rb
|
|
558
|
-
- spec/dummy/spec/
|
|
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
|
|
559
507
|
- spec/dummy/spec/assets/image.png
|
|
560
|
-
- spec/dummy/
|
|
561
|
-
- spec/dummy/
|
|
562
|
-
- spec/dummy/
|
|
563
|
-
- spec/dummy/
|
|
564
|
-
- spec/dummy/public/500.html
|
|
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
|
|
565
512
|
- spec/dummy/public/404.html
|
|
513
|
+
- spec/dummy/public/500.html
|
|
566
514
|
- spec/dummy/public/apple-touch-icon-precomposed.png
|
|
567
|
-
- spec/dummy/
|
|
568
|
-
- spec/dummy/
|
|
569
|
-
- spec/dummy/
|
|
570
|
-
- spec/dummy/
|
|
571
|
-
- spec/dummy/db/migrate/20190322205209_create_blogs.rb
|
|
572
|
-
- spec/dummy/db/migrate/20200215225917_create_users.rb
|
|
515
|
+
- spec/dummy/public/422.html
|
|
516
|
+
- spec/dummy/public/apple-touch-icon.png
|
|
517
|
+
- spec/dummy/public/favicon.ico
|
|
518
|
+
- spec/dummy/config.ru
|
|
573
519
|
- spec/dummy/db/migrate/20200227150449_create_portfolios.rb
|
|
574
|
-
- spec/dummy/db/
|
|
575
|
-
- spec/dummy/
|
|
576
|
-
- spec/dummy/
|
|
577
|
-
- spec/dummy/
|
|
578
|
-
- spec/dummy/
|
|
579
|
-
- spec/dummy/
|
|
580
|
-
- spec/dummy/
|
|
581
|
-
- spec/dummy/
|
|
582
|
-
- spec/dummy/
|
|
583
|
-
- spec/dummy/
|
|
584
|
-
- spec/dummy/
|
|
585
|
-
- spec/dummy/
|
|
586
|
-
- spec/dummy/
|
|
587
|
-
- spec/dummy/
|
|
588
|
-
- spec/dummy/
|
|
589
|
-
- spec/dummy/
|
|
590
|
-
- spec/dummy/
|
|
591
|
-
- spec/dummy/
|
|
592
|
-
- spec/dummy/
|
|
593
|
-
- spec/dummy/
|
|
594
|
-
- spec/dummy/
|
|
595
|
-
- spec/dummy/
|
|
596
|
-
- spec/dummy/
|
|
597
|
-
- spec/dummy/
|
|
598
|
-
- spec/dummy/
|
|
599
|
-
- spec/dummy/
|
|
600
|
-
- spec/dummy/coverage/assets/0.10.2/magnify.png
|
|
601
|
-
- spec/dummy/coverage/assets/0.10.2/application.js
|
|
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
|
+
- spec/dummy/config/application.rb
|
|
530
|
+
- spec/dummy/config/boot.rb
|
|
531
|
+
- spec/dummy/config/environments/test.rb
|
|
532
|
+
- spec/dummy/config/environments/development.rb
|
|
533
|
+
- spec/dummy/config/environments/production.rb
|
|
534
|
+
- spec/dummy/config/locales/en.yml
|
|
535
|
+
- spec/dummy/config/puma.rb
|
|
536
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
|
537
|
+
- spec/dummy/config/initializers/mime_types.rb
|
|
538
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
|
539
|
+
- spec/dummy/config/initializers/assets.rb
|
|
540
|
+
- spec/dummy/config/initializers/application_controller_renderer.rb
|
|
541
|
+
- spec/dummy/config/initializers/inflections.rb
|
|
542
|
+
- spec/dummy/config/initializers/cookies_serializer.rb
|
|
543
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
|
544
|
+
- spec/dummy/config/database.yml
|
|
545
|
+
- spec/dummy/package.json
|
|
602
546
|
- spec/rails_helper.rb
|