grape-markdown 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/grape-markdown/document.rb +1 -1
- data/lib/grape-markdown/route.rb +4 -2
- data/lib/grape-markdown/version.rb +1 -1
- data/spec/grape-markdown/document_spec.rb +4 -0
- data/spec/support/sample_api.rb +22 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd6795347e2d992cc9afb0cff433233546c37c85
|
4
|
+
data.tar.gz: 2ae1d275b9041fb8156b00fa03e0dba70771a152
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a932d99462ca9b8730897151b20876612919d4107a349851a3ee30a01902e11f6243a65f8039c0d87798e404ff5095d90b257240bd3fd5084414dbdff41b71b
|
7
|
+
data.tar.gz: 507427675239837beb66161070d93ecacf44fefa80348f951596444b0a4fd1136fa77d39221ff3dc3f3786b1a297984cf463f5af51022c29af512183ca00399d
|
@@ -30,7 +30,7 @@ module GrapeMarkdown
|
|
30
30
|
def resources
|
31
31
|
@resources ||= begin
|
32
32
|
grouped_routes = routes.group_by(&:route_name).reject do |name, routes|
|
33
|
-
resource_exclusion.include?(name.to_sym)
|
33
|
+
resource_exclusion.include?(name.parameterize('_').to_sym)
|
34
34
|
end
|
35
35
|
|
36
36
|
grouped_routes.map { |name, routes| Resource.new(name, routes) }
|
data/lib/grape-markdown/route.rb
CHANGED
@@ -38,7 +38,9 @@ module GrapeMarkdown
|
|
38
38
|
#{list? ? route_title : route_title.singularize}
|
39
39
|
DESCRIPTION
|
40
40
|
|
41
|
-
description << "on a #{root_resource_title.singularize}" if
|
41
|
+
description << "on a #{root_resource_title.singularize}" if parent?
|
42
|
+
|
43
|
+
description
|
42
44
|
end
|
43
45
|
|
44
46
|
def route_path_without_format
|
@@ -63,7 +65,7 @@ module GrapeMarkdown
|
|
63
65
|
!%w(GET DELETE).include?(route_method)
|
64
66
|
end
|
65
67
|
|
66
|
-
def
|
68
|
+
def parent?
|
67
69
|
route_name != root_resource
|
68
70
|
end
|
69
71
|
end
|
@@ -39,6 +39,10 @@ describe GrapeMarkdown::Document do
|
|
39
39
|
it 'includes properties for the resources' do
|
40
40
|
expect(subject).to include('Properties')
|
41
41
|
end
|
42
|
+
|
43
|
+
it 'includes short route descriptions' do
|
44
|
+
expect(subject).to include('## Post a Widget')
|
45
|
+
end
|
42
46
|
end
|
43
47
|
|
44
48
|
it 'exposes configuration settings' do
|
data/spec/support/sample_api.rb
CHANGED
@@ -31,6 +31,28 @@ class SampleApi < Grape::API
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
resource '/widgets/:widget_id/sprockets' do
|
35
|
+
desc 'create a sprocket for a specific widget'
|
36
|
+
params do
|
37
|
+
requires :name,
|
38
|
+
type: 'string',
|
39
|
+
desc: 'the widgets name',
|
40
|
+
documentation: { example: 'super widget' }
|
41
|
+
end
|
42
|
+
post '/' do
|
43
|
+
end
|
44
|
+
|
45
|
+
desc 'updates a sprocket for a specific widget'
|
46
|
+
params do
|
47
|
+
requires :name,
|
48
|
+
type: 'string',
|
49
|
+
desc: 'the widgets name',
|
50
|
+
documentation: { example: 'super widget' }
|
51
|
+
end
|
52
|
+
put ':id' do
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
34
56
|
resource 'admin' do
|
35
57
|
get '/' do
|
36
58
|
end
|