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: 8ac9acf1f92a45c9c9b077bbe6b2e2fc37f97dccf04cd0cc843e01a08ebd7e14
4
- data.tar.gz: bf06a96ba3a1124ce2cbc6ac0f30e457b189c33ab4e05660cf843e316acd2031
3
+ metadata.gz: '035423092a1cbcd12e5389d792d39479eb85000569a787625365c0325b99abf0'
4
+ data.tar.gz: 7723b115197ac35b1a36b955ed829981bd1d0a02dc555c2842cfb5a60e3b7383
5
5
  SHA512:
6
- metadata.gz: d841662ee53332f6d1df1477106c31f2285d37b5cd3d9c9f36c338222b80301b16cd785e949d35919115b0b1a01208023ca12b1170ee64d5a1f5de3693b3a0b5
7
- data.tar.gz: 5d74353382a5bbd9300aee9dc6aec04ba22682648eda4802fc73ebbe21e898bb6c57fbde107b1f80ad4a095cc33e2966d015b3a1dbb9c195f7fdca039abf68f2
6
+ metadata.gz: 4cee5a77e3969898ce193d4d84becab080c5225c6a0ef73905e78356c485188fa934f8ccd538d17353132cecc430b398a9c4626c3174a5f748ae54abc13d636b
7
+ data.tar.gz: fccb0a63a957ead2e90773076bbce9923ae7f6d4a8f5ad7a050da6dd0c307b31aee77edca5a36053591c06c5de6201a06179826362abb3808d3de2ea30dbd7e4
@@ -1,3 +1,3 @@
1
1
  module ApiScaffold
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
@@ -58,8 +58,8 @@ module ApiScaffold
58
58
  end.sort.to_h
59
59
  end
60
60
 
61
- def apipie_param(attribute)
62
- "param :#{attribute.name}, String, 'TODO: #{attribute.name} descrption'"
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
- <% attributes.each do |attribute| -%><%= indent(apipie_param(attribute), 2) %>
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
- <% attributes.each do |attribute| -%><%= indent(apipie_param(attribute), 2) %>
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
- <% end -%>def index
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_scaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Atkinson