shields_up 0.17.0 → 0.18.0

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: 391eded2ca4d95f1777b8a227f13905e7f01b975
4
- data.tar.gz: 05c2a17280fb9c761b3743e688abcc3c9cbe97ce
3
+ metadata.gz: 437e1ba9fb4476f8dc720427401607320e7d4625
4
+ data.tar.gz: 09c5b2be9c7e5d2d84a6f3cd466be68639cb59bd
5
5
  SHA512:
6
- metadata.gz: a13deb71b95918e3c1b7d297ec5f72a9d8b29a71d9a58c8f3259d09d9d8373aa2c6f7881b9f7c0c2c0b0df01adcd0f6f052383454ec527c2ac061faf045830a1
7
- data.tar.gz: 4d99e218185e1db2828543e5c9ce39f469c593a9cc0a16c98516e1625ffe7d903acb7bf895c2b81ac830c85b49137aaf19d5562bf0bb785de84549da3a8732fd
6
+ metadata.gz: 11cc043d76fcf28e2cb50150b95a639ea8f138c5a5986f5720fbeaedc760e64bb2d73c737e06aa2fb25750f1d5ddc90035d08f4436a2f4154546490548f2d3cc
7
+ data.tar.gz: ee27061c271e103a51bd9c12287d19ed6108483eb16a93b2cffa6ae36bf5ffa6dfeb386c699a3a229716893e2f014e8d053ae890a4e6acb4608af5048d5046c8
data/Appraisals ADDED
@@ -0,0 +1,7 @@
1
+ appraise "activesupport-3.2" do
2
+ gem 'activesupport', '~> 3.2.0'
3
+ end
4
+
5
+ appraise "activesupport-4.0" do
6
+ gem 'activesupport', '~> 4.0.0'
7
+ end
data/Gemfile CHANGED
@@ -2,6 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
+ gem 'appraisal'
5
6
  gem 'mocha'
6
7
  gem 'activemodel'
7
8
  gem 'rails'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shields_up (0.16.0)
4
+ shields_up (0.17.0)
5
5
  activesupport (~> 3.2)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  [![Build Status](https://travis-ci.org/appfolio/shields_up.png)](https://travis-ci.org/appfolio/shields_up)
2
2
  [![Code Climate](https://codeclimate.com/github/appfolio/shields_up/badges/gpa.svg)](https://codeclimate.com/github/appfolio/shields_up)
3
3
  [![Test Coverage](https://codeclimate.com/github/appfolio/shields_up/badges/coverage.svg)](https://codeclimate.com/github/appfolio/shields_up)
4
+ [![Gem Version](https://badge.fury.io/rb/shields_up.svg)](http://badge.fury.io/rb/shields_up)
4
5
 
5
6
  #Shields Up
6
7
  This gem provides an alternative implementation of strong_parameters.
@@ -11,6 +12,8 @@ This gem provides an alternative implementation of strong_parameters.
11
12
  ##Differences to strong parameter
12
13
  params.symbolize_keys (or similar functions) will disable strong_parameters
13
14
  protection silently. With ShieldsUp this can not happen.
15
+ (For a more in depth explanation see this discussion on the rails core mailing
16
+ list: https://groups.google.com/forum/#!topic/rubyonrails-core/TdQVJCw1HfI)
14
17
 
15
18
  ## Enable ShieldsUp<br>
16
19
 
@@ -23,28 +26,18 @@ in controllers<br>
23
26
  include ShieldsUp
24
27
  ```
25
28
 
26
- - ShieldsUp::Parameter type only allows three operations: [], permit and require.
29
+ - ShieldsUp::Parameters type only allows three operations: [], permit and require.
27
30
  - You can use symbols or strings to access variables.<br>
28
31
 
29
32
  ##Example:<br>
30
33
  ```
31
- params[:company]
34
+ params[:company] Or params["company"]
32
35
  ```
33
- not:
34
- ```
35
- params["company"]
36
- ```
37
- or
38
- ```
39
- params.fetch(:company)
40
- params.fetch("company")
41
- ```
42
-
43
36
  ##A more complicated example:<br>
44
37
  ```
45
38
  params.permit(:company => [:address, :enabled])
46
39
  ```
47
- not:
40
+ Or:
48
41
  ```
49
42
  params.permit("company" => [:address, "enabled"])
50
43
  ```
data/Rakefile CHANGED
@@ -10,6 +10,7 @@ rescue Bundler::BundlerError => e
10
10
  end
11
11
 
12
12
  require 'rake'
13
+ require 'appraisal'
13
14
  require 'rake/testtask'
14
15
 
15
16
  namespace :test do
@@ -0,0 +1,13 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "mocha"
7
+ gem "activemodel"
8
+ gem "rails"
9
+ gem "minitest", "~> 4.0"
10
+ gem "codeclimate-test-reporter", :require => nil
11
+ gem "activesupport", "~> 3.2.0"
12
+
13
+ gemspec :path => "../"
@@ -0,0 +1,13 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "mocha"
7
+ gem "activemodel"
8
+ gem "rails"
9
+ gem "minitest", "~> 4.0"
10
+ gem "codeclimate-test-reporter", :require => nil
11
+ gem "activesupport", "~> 4.0.0"
12
+
13
+ gemspec :path => "../"
@@ -1,10 +1,12 @@
1
1
  require 'active_support/core_ext/hash/indifferent_access'
2
2
  module ShieldsUp
3
3
  class Parameters
4
- if defined?(ActionController) && defined?(ActionController::Parameters)
5
- PARAM_TYPE = ActionController::Parameters
6
- else
7
- PARAM_TYPE = ActiveSupport::HashWithIndifferentAccess
4
+ def self.param_type
5
+ @param_type ||= if defined?(ActionController) && defined?(ActionController::Parameters)
6
+ ActionController::Parameters
7
+ else
8
+ ActiveSupport::HashWithIndifferentAccess
9
+ end
8
10
  end
9
11
 
10
12
  PERMITTED_SCALAR_TYPES = [
@@ -143,7 +145,7 @@ module ShieldsUp
143
145
  end
144
146
 
145
147
  def deep_dup_to_hash(params)
146
- return dup_if_possible(params) unless params.is_a?(PARAM_TYPE)
148
+ return dup_if_possible(params) unless params.is_a?(self.class.param_type)
147
149
  {}.tap do |dup|
148
150
  params.each do |key, value|
149
151
  dup[key] = deep_dup_to_hash(value)
@@ -1,3 +1,3 @@
1
1
  module ShieldsUp
2
- VERSION = '0.17.0'.freeze
2
+ VERSION = '0.18.0'.freeze
3
3
  end
data/shields_up.gemspec CHANGED
@@ -17,5 +17,5 @@ Gem::Specification.new do |s|
17
17
  s.files = Dir['**/*'].reject{ |f| f[%r{^pkg/}] || f[%r{^test/}] }
18
18
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
19
  s.require_paths = ['lib']
20
- s.add_dependency('activesupport', '~> 3.2')
20
+ s.add_dependency('activesupport', ['>= 3.2', '< 4.1'])
21
21
  end
metadata CHANGED
@@ -1,40 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shields_up
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - AppFolio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-20 00:00:00.000000000 Z
11
+ date: 2014-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.2'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '4.1'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '3.2'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '4.1'
27
33
  description: Mass assignment Protection made by AppFolio Inc., inspired by strong_parameters.
28
34
  email: dev@appfolio.com
29
35
  executables: []
30
36
  extensions: []
31
37
  extra_rdoc_files: []
32
38
  files:
39
+ - Appraisals
33
40
  - Gemfile
34
41
  - Gemfile.lock
35
42
  - LICENSE
36
43
  - README.md
37
44
  - Rakefile
45
+ - gemfiles/activesupport_3.2.gemfile
46
+ - gemfiles/activesupport_4.0.gemfile
38
47
  - lib/shields_up.rb
39
48
  - lib/shields_up/exceptions.rb
40
49
  - lib/shields_up/parameters.rb
@@ -61,8 +70,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
70
  version: '0'
62
71
  requirements: []
63
72
  rubyforge_project:
64
- rubygems_version: 2.2.2
73
+ rubygems_version: 2.4.3
65
74
  signing_key:
66
75
  specification_version: 4
67
76
  summary: Mass assignment Protection made by AppFolio Inc., inspired by strong_parameters.
68
77
  test_files: []
78
+ has_rdoc: