api_scaffold 0.1.8 → 0.1.9
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '035423092a1cbcd12e5389d792d39479eb85000569a787625365c0325b99abf0'
|
4
|
+
data.tar.gz: 7723b115197ac35b1a36b955ed829981bd1d0a02dc555c2842cfb5a60e3b7383
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cee5a77e3969898ce193d4d84becab080c5225c6a0ef73905e78356c485188fa934f8ccd538d17353132cecc430b398a9c4626c3174a5f748ae54abc13d636b
|
7
|
+
data.tar.gz: fccb0a63a957ead2e90773076bbce9923ae7f6d4a8f5ad7a050da6dd0c307b31aee77edca5a36053591c06c5de6201a06179826362abb3808d3de2ea30dbd7e4
|
data/lib/api_scaffold/version.rb
CHANGED
@@ -58,8 +58,8 @@ module ApiScaffold
|
|
58
58
|
end.sort.to_h
|
59
59
|
end
|
60
60
|
|
61
|
-
def apipie_param(
|
62
|
-
"param :#{
|
61
|
+
def apipie_param(attribute_name)
|
62
|
+
"param :#{attribute_name}, String, 'TODO: #{attribute_name} descrption'"
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
@@ -8,11 +8,14 @@ class <%= prefixed_controller_class_name %>Controller < ApplicationController
|
|
8
8
|
|
9
9
|
<% if apipie_installed? -%>def_param_group :<%= singular_table_name %> do
|
10
10
|
param :<%= singular_table_name %>, Hash, required: true, action_aware: true do
|
11
|
-
<%
|
11
|
+
<% attributes_names.each do |attribute_name| -%><%= indent(apipie_param(attribute_name), 2) %>
|
12
12
|
<% end -%>end
|
13
13
|
end
|
14
14
|
|
15
15
|
api :GET, '/<%= plural_table_name %>', 'List <%= plural_table_name %>'
|
16
|
+
<% if gem_available?('api-pagination') %>param :page, String, 'Paginate results'
|
17
|
+
param :per_page, String, 'Number of records per page'
|
18
|
+
<% end -%>
|
16
19
|
<% end -%>def index
|
17
20
|
@<%= plural_table_name %> = <%= 'paginate ' if gem_available?('api-pagination') %><%= orm_class.all(class_name) %>
|
18
21
|
render json: <%= "@#{plural_table_name}" %>
|
@@ -8,12 +8,14 @@ class <%= prefixed_controller_class_name %>Controller < ApplicationController
|
|
8
8
|
|
9
9
|
<% if apipie_installed? -%>def_param_group :<%= singular_table_name %> do
|
10
10
|
param :<%= singular_table_name %>, Hash, required: true, action_aware: true do
|
11
|
-
<%
|
11
|
+
<% attributes_names.each do |attribute_name| -%><%= indent(apipie_param(attribute_name), 2) %>
|
12
12
|
<% end -%>end
|
13
13
|
end
|
14
14
|
|
15
15
|
api :GET, '/<%= [prefix, plural_table_name].join("/") %>', 'List <%= plural_table_name %>'
|
16
|
-
<%
|
16
|
+
<% if gem_available?('api-pagination') %>param :page, String, 'Paginate results'
|
17
|
+
param :per_page, String, 'Number of records per page'
|
18
|
+
<% end -%><% end -%>def index
|
17
19
|
@<%= plural_table_name %> = <%= 'paginate ' if gem_available?('api-pagination') %><%= orm_class.all(class_name) %>
|
18
20
|
render json: <%= class_name %>Serializer.new(<%= "@#{plural_table_name}" %>)
|
19
21
|
end
|