apipie-rails 0.5.12 → 0.5.13

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: 5ff91284d6576af7f50913921c4b677f67a1e163
4
- data.tar.gz: 0cd61c342c534f728d0d210b47d28d1ccb903663
3
+ metadata.gz: 7a003368791253c56f130f6ff692225f71d51736
4
+ data.tar.gz: b0d9ea7bba052e5afbb460c6c2c2650609afdad3
5
5
  SHA512:
6
- metadata.gz: 373f9ba52ccbec5af1691a8d8d58e9d5631903a0a356020c0ee5265dce36e7d9240a21ded67407ad2d8ded8642ef36a99b334919c738b0d441ab0cbb486c9411
7
- data.tar.gz: c2fcf805fc6eb9a27826e1057780f53b06a20c05db585a4abd89f2fba9372c0a987cd3e54cdaf64b91ee19fa4c951e29a0a57b1db4bf374360d10e71ae752ab9
6
+ metadata.gz: 003c59006f91cab87c478740a851d06926fc4ee029420d054ede2d619245929f13af84ed53704a1708263b4e825ac37eb8e429f8927e7ca6e30ea05397ab6846
7
+ data.tar.gz: 8d3648f85b07e59313ae749397ed4ce965aed7dadd9d801f55dc1cefc296cb641e1740ba7be0141321b8347a844ea385655b58e1f75766605b536609b0c690d1
@@ -1,6 +1,10 @@
1
1
  Changelog
2
2
  ===========
3
3
 
4
+ v0.5.13
5
+ -------
6
+ - Fix swagger generation if a controller's parent doesn't define a resource_description [\#637](https://github.com/Apipie/apipie-rails/pull/637) ([enrique-guillen](https://github.com/enrique-guillen))
7
+
4
8
  v0.5.12
5
9
  -------
6
10
  - Fix returns displaying [\#635](https://github.com/Apipie/apipie-rails/pull/635) ([X1ting](https://github.com/X1ting))
data/README.rst CHANGED
@@ -283,6 +283,8 @@ Example:
283
283
  property :enum1, ['v1', 'v2'], :desc => "One of 2 possible string values"
284
284
  end
285
285
  end
286
+ tags %w[profiles logins]
287
+ tags 'more', 'related', 'resources'
286
288
  description "method description"
287
289
  formats ['json', 'jsonp', 'xml']
288
290
  meta :message => "Some very important info"
@@ -1154,7 +1156,7 @@ You must then call the ``apipie_validations`` method yourself, e.g.:
1154
1156
 
1155
1157
  .. code:: ruby
1156
1158
 
1157
- before_action: :apipie_validations
1159
+ before_action :apipie_validations
1158
1160
 
1159
1161
  This is useful if you have before_actions which use parameter values: just add them
1160
1162
  after the ``apipie_validations`` before_action.
@@ -101,7 +101,7 @@ module Apipie
101
101
  parent = Apipie.get_resource_description(@resource.controller.superclass)
102
102
 
103
103
  # get tags from parent resource description
104
- parent_tags = [parent, @resource].flat_map { |resource| resource._tag_list_arg }
104
+ parent_tags = [parent, @resource].compact.flat_map { |resource| resource._tag_list_arg }
105
105
  Apipie::TagListDescription.new((parent_tags + @tag_list).uniq.compact)
106
106
  end
107
107
 
@@ -1,3 +1,3 @@
1
1
  module Apipie
2
- VERSION = '0.5.12'
2
+ VERSION = '0.5.13'
3
3
  end
@@ -3,7 +3,7 @@
3
3
  # defining a set of tags for the contained methods to include.
4
4
  #
5
5
 
6
- class TaggedCatsController < ApplicationController
6
+ class TaggedCatsController < ActionController::Base
7
7
  resource_description do
8
8
  description 'A controller to test "returns"'
9
9
  short 'Pets'
@@ -0,0 +1,15 @@
1
+ #
2
+ # The TagsController defined here provides an example of a
3
+ # tags call without a resource description.
4
+ #
5
+
6
+ class TaggedDogsController < ActionController::Base
7
+ #-----------------------------------------------------------
8
+ # simple 'returns' example: a method that returns a cat record
9
+ #-----------------------------------------------------------
10
+ api :GET, "/pets/:id/as_properties", "Get a dog record"
11
+ tags(%w[Dogs Wolves])
12
+ def show_as_properties
13
+ render :plain => "showing pet properties"
14
+ end
15
+ end
@@ -448,6 +448,27 @@ describe "Swagger Responses" do
448
448
 
449
449
  end
450
450
 
451
+ #==============================================================================
452
+ # TaggedDogsController is a demonstration of how tags may be defined in a simple
453
+ # controller class without defining either the controller resource-description
454
+ # block or the controller's superclass's resource-description block.
455
+ #==============================================================================
456
+
457
+ describe TaggedDogsController do
458
+ describe "TaggedDogsController#show_as_properties" do
459
+ subject do
460
+ desc._methods[:show_as_properties]
461
+ end
462
+
463
+ it "should return tags with 'Dogs', and 'Wolves'" do
464
+ returns_obj = subject.tag_list
465
+ puts returns_obj.inspect
466
+
467
+ expect(returns_obj.tags).to eq(%w[Dogs Wolves])
468
+ end
469
+ end
470
+ end
471
+
451
472
  #==============================================================================
452
473
  # TaggedCatsController is a demonstration of how tags may be defined in the
453
474
  # controller's resource description so that they may be automatically prefixed
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apipie-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.12
4
+ version: 0.5.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Pokorny
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-10-17 00:00:00.000000000 Z
12
+ date: 2018-10-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -266,6 +266,7 @@ files:
266
266
  - spec/dummy/app/controllers/pets_using_auto_views_controller.rb
267
267
  - spec/dummy/app/controllers/pets_using_self_describing_classes_controller.rb
268
268
  - spec/dummy/app/controllers/tagged_cats_controller.rb
269
+ - spec/dummy/app/controllers/tagged_dogs_controller.rb
269
270
  - spec/dummy/app/controllers/twitter_example_controller.rb
270
271
  - spec/dummy/app/controllers/users_controller.rb
271
272
  - spec/dummy/app/views/layouts/application.html.erb
@@ -361,6 +362,7 @@ test_files:
361
362
  - spec/dummy/app/controllers/pets_using_auto_views_controller.rb
362
363
  - spec/dummy/app/controllers/pets_using_self_describing_classes_controller.rb
363
364
  - spec/dummy/app/controllers/tagged_cats_controller.rb
365
+ - spec/dummy/app/controllers/tagged_dogs_controller.rb
364
366
  - spec/dummy/app/controllers/twitter_example_controller.rb
365
367
  - spec/dummy/app/controllers/users_controller.rb
366
368
  - spec/dummy/app/views/layouts/application.html.erb