rails_api_documentation 0.3.3 → 0.3.4

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: aa57f61a95e060eff72a6089f4e5806d7246bfe9
4
- data.tar.gz: 6cafddf29e9049a7a3e75b5817f4bdc95a600c87
3
+ metadata.gz: fb69d9f7bcbd91be6bb3133dd12aaea9711f40e2
4
+ data.tar.gz: 809c90106f7e608c76c7654d8ed4833781f706ad
5
5
  SHA512:
6
- metadata.gz: a340764a01562dc0417d0289b66c0cfa7cbaa6cae3ca057adbc1fdffb93c35fc35e44b2f785e5c7de4273b11846cd460c8b5251013603e007c278ddf468e0c70
7
- data.tar.gz: 23fb0e13df0227c92ef22498055b03278e63e3903b849c6951a4204b6d17bd49835d031830c366982355f85b89c60e6dee48ca4b8d60a537676ae7991d1179f5
6
+ metadata.gz: 406cb23093b4a93239171caaee8d955c4a81dda89f8d2fafc4e7a7e6cb168562b2b7fe1c6b9f2a89be97e18eb4dd37e043c8a8dc971cd443ba7bdd47eb73d558
7
+ data.tar.gz: fffd6ec4314b1d91b38fbd742bebaabfb0af7da5540675fd3490759f661bad88c9639c093df491d474b54d8197e87c44362ef03695fa5ce63cba95dcaf266115
@@ -4,11 +4,31 @@
4
4
  class RailsApiDoc::Controller::Request::Repository
5
5
 
6
6
  include RailsApiDoc::Controller::Request::Headers
7
+
7
8
  extend RailsApiDoc::Controller::Repo
8
9
  include RailsApiDoc::Controller::Repo
9
10
 
11
+ class << self
12
+
13
+ def params_for_klass(klass)
14
+ params = {}
15
+
16
+ until _abstract_class(klass)
17
+ params.merge!(self[klass])
18
+ klass = klass.superclass
19
+ end
20
+
21
+ params
22
+ end
23
+
24
+ def _abstract_class(klass)
25
+ klass == ActionController::Base || klass == RailsApiDoc::Params
26
+ end
27
+
28
+ end
29
+
10
30
  def initialize
11
- @repo = self.class.repo.clone.transform_values { |v| v.deep_dup }
31
+ @repo = self.class.repo.clone.transform_values(&:deep_dup)
12
32
  end
13
33
 
14
34
  end
@@ -7,8 +7,8 @@ module RailsApiDoc
7
7
 
8
8
  include RailsApiDoc::Controller::ResourceParams::PermittedParams # implements params_to_permit
9
9
 
10
- def strong_params(pars = params)
11
- permitted = params_to_permit(pars)
10
+ def strong_params(pars = params, params_holder: nil)
11
+ permitted = params_to_permit(pars, params_holder: params_holder)
12
12
 
13
13
  pars.permit(permitted)
14
14
  end
@@ -8,14 +8,17 @@ module RailsApiDoc
8
8
  #
9
9
  # accepted_params for permit
10
10
  #
11
- def params_to_permit(pars = params)
12
- _next_nesting_level(pars, param_data: _permitted_params)
11
+ def params_to_permit(pars = params, params_holder: nil)
12
+ permitted_params = _permitted_params(params_holder)
13
+
14
+ _next_nesting_level(pars, param_data: permitted_params)
13
15
  end
14
16
 
15
17
  private
16
18
 
17
- def _permitted_params
18
- ::RailsApiDoc::Controller::Request::Repository[self.class]
19
+ def _permitted_params(params_holder = nil)
20
+ ::RailsApiDoc::Controller::Request::Repository
21
+ .params_for_klass(params_holder || self.class)
19
22
  end
20
23
 
21
24
  #
@@ -19,11 +19,11 @@ module RailsApiDoc::Params::DSL
19
19
  end
20
20
 
21
21
  def ctrl_strong_params
22
- @ctrl_strong_params ||= ctrl_parameters.strong_params(params)
22
+ @ctrl_strong_params ||= strong_params(params_holder: ctrl_parameters)
23
23
  end
24
24
 
25
25
  def ctrl_parameters
26
- @ctrl_parameters ||= self.class.parameter_class.new
26
+ @ctrl_parameters ||= self.class.parameter_class
27
27
  end
28
28
 
29
29
  end
@@ -3,7 +3,7 @@
3
3
  # :nodoc:
4
4
  class RailsApiDoc::Params::Finder
5
5
 
6
- SUFFIX = 'Parameter'
6
+ SUFFIX = 'Params'
7
7
 
8
8
  def initialize(object)
9
9
  @object = object
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  # author: Vadim Shaveiko <@vshaveyko>
3
3
  module RailsApiDoc
4
- VERSION = '0.3.3'
4
+ VERSION = '0.3.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_api_documentation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - vs
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-22 00:00:00.000000000 Z
11
+ date: 2017-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler