openapi-rails 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b1aa34c54005e99ae4306aa08e2d7497f687327
4
- data.tar.gz: a287a9ddddd26db598041115cb326be15eba9e06
3
+ metadata.gz: 8a159aad26d1ebebde743aa749c2e24d47d20244
4
+ data.tar.gz: 9c4651933c47cfcfcc74e876fb8afa36515a0311
5
5
  SHA512:
6
- metadata.gz: 8976d41adeeb8e08aef3acbf70f11a814d977b1e83868bc157aa861d8c6feb91dc8a840c280d79c4a38cfd90b77a83ed8300b349def8b224932fa1b29baec0e6
7
- data.tar.gz: 92d5e820340fd7dc6c1c3d76dc03b74db721ae9766d04e6034529973166c349ee1151eede7f5d8192232a523b17c4cacf8d59c5d0ffdb72abbb0f6fbea47f41d
6
+ metadata.gz: 5970ef069b39fb49e829b6484d5af750b1792d89c3ebf455f130698b0c2efd048055a88abb0ef80272d09b07254bffb01737b157b2cdf673c11bb01491d5fd9c
7
+ data.tar.gz: 776f4ce7f899a7283683c51b80ca08d2b203de3a8434b81a7299f468fca4773cf8103e5289ed73d4d707e6d307f4787c6f00b81e9e2cffa7fa4ef1829913710e
@@ -48,31 +48,32 @@ module Openapi
48
48
 
49
49
  class_methods do
50
50
  def spec_params(options)
51
- self.spec_collection_name = options[:collection_name]
52
- self.spec_resource_name = options[:resource_name]
53
51
  self.spec_resource_class = options[:resource_class]
54
- self.spec_except_actions = options[:except_actions]
52
+ self.spec_resource_name = options[:resource_name]
53
+ self.spec_collection_name = options[:collection_name]
55
54
  self.spec_relative_path = options[:relative_path]
55
+ self.spec_except_actions = options[:except_actions]
56
56
  end
57
57
 
58
58
  def build_openapi_specification(options)
59
- self.spec_base_path = options[:base_path]
59
+ self.spec_except_actions ||=
60
+ []
61
+
62
+ self.spec_base_path =
63
+ options[:base_path]
60
64
 
61
65
  self.spec_relative_path ||=
62
66
  ('/' + to_s.remove(/Controller$/).gsub('::', '/').underscore).
63
67
  remove(spec_base_path)
64
68
 
65
- self.spec_except_actions ||= []
66
-
67
- self.spec_collection_name ||=
68
- to_s.split('::').last.sub(/Controller$/, '')
69
+ self.spec_resource_class ||=
70
+ self.try(:crud_resource_class)
69
71
 
70
72
  self.spec_resource_name ||=
71
- self.spec_collection_name.singularize
73
+ self.spec_resource_class.to_s.remove('::')
72
74
 
73
- self.spec_resource_class ||= self.try(:crud_resource_class)
74
- self.spec_resource_class ||=
75
- self.spec_resource_name.constantize
75
+ self.spec_collection_name ||=
76
+ self.spec_resource_name.pluralize
76
77
 
77
78
  build_openapi_definitions
78
79
  build_openapi_paths
@@ -88,9 +89,9 @@ module Openapi
88
89
  end
89
90
 
90
91
  def build_openapi_definitions
91
- collection_name = spec_collection_name
92
- resource_class = spec_resource_class
93
- resource_name = spec_resource_name
92
+ collection_name = spec_collection_name
93
+ resource_class = spec_resource_class
94
+ resource_name = spec_resource_name
94
95
  resource_property_name = resource_name.underscore.to_sym
95
96
 
96
97
  swagger_schema resource_name do
@@ -169,7 +170,7 @@ module Openapi
169
170
  if include_index
170
171
  operation :get do
171
172
  key :tags, [plural_name]
172
- key :summary, 'Index'
173
+ key :summary, "index#{plural_name}"
173
174
  key :operationId, "index#{plural_name}"
174
175
  key :produces, json_mime
175
176
 
@@ -257,7 +258,7 @@ module Openapi
257
258
  if include_create
258
259
  operation :post do
259
260
  key :tags, [plural_name]
260
- key :summary, 'Create'
261
+ key :summary, "create#{plural_name}"
261
262
  key :operationId, "create#{plural_name}"
262
263
  key :produces, json_mime
263
264
 
@@ -309,7 +310,7 @@ module Openapi
309
310
  if include_show
310
311
  operation :get do
311
312
  key :tags, [plural_name]
312
- key :summary, 'Show'
313
+ key :summary, "show#{name}ById"
313
314
  key :operationId, "show#{name}ById"
314
315
  key :produces, json_mime
315
316
 
@@ -354,7 +355,7 @@ module Openapi
354
355
  if include_update
355
356
  operation :put do
356
357
  key :tags, [plural_name]
357
- key :summary, 'Update'
358
+ key :summary, "update#{name}"
358
359
  key :operationId, "update#{name}"
359
360
  key :produces, json_mime
360
361
 
@@ -408,7 +409,7 @@ module Openapi
408
409
  if include_destroy
409
410
  operation :delete do
410
411
  key :tags, [plural_name]
411
- key :summary, 'Destroy'
412
+ key :summary, "destroy#{name}"
412
413
  key :operationId, "destroy#{name}"
413
414
 
414
415
  parameter do
@@ -1,3 +1,3 @@
1
1
  module Openapi
2
- VERSION = '0.3.5'.freeze
2
+ VERSION = '0.3.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openapi-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kravets
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-01-08 00:00:00.000000000 Z
12
+ date: 2017-01-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: swagger-blocks