jsonapi-params 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/jsonapi-params/param.rb +10 -1
- data/lib/jsonapi-params/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f842e95854f931fa69a0e3ba04d4a8a760f17f11
|
|
4
|
+
data.tar.gz: 5e6f05f52c7fb5dfd67a1b7dbf50fa794c45192e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 379e54a2a2a5766019cc5d46adde42489f7f87e313327ce2d047f8a7448f51556a27248957a68a6c9b11bc56c88271d4e05447c439637b1af1eb0bae4f1a3daf
|
|
7
|
+
data.tar.gz: ee54f058231a5ee2c1559fbbad605b7136d32d8084c77038c950bcb0f18983c915d3ddb4b32039b8ff1583d2ad31f95025ae0e8b47a7fda8447178c87036a871
|
data/CHANGELOG.md
CHANGED
data/lib/jsonapi-params/param.rb
CHANGED
|
@@ -82,8 +82,9 @@ module JSONAPI
|
|
|
82
82
|
attributes = @data['attributes'] || {}
|
|
83
83
|
attributes = attributes.slice(*self.class.whitelist_attributes)
|
|
84
84
|
attributes = attributes.merge(relationships)
|
|
85
|
+
collection_attributes = strong_parameters? ? attributes.to_unsafe_h : attributes.to_h
|
|
85
86
|
|
|
86
|
-
|
|
87
|
+
collection_attributes.inject({}) do |attributes, (key, value)|
|
|
87
88
|
attributes[key.to_s.underscore.to_sym] = value
|
|
88
89
|
attributes
|
|
89
90
|
end
|
|
@@ -122,6 +123,14 @@ module JSONAPI
|
|
|
122
123
|
def params_klass(key)
|
|
123
124
|
"#{key}Param".classify.constantize
|
|
124
125
|
end
|
|
126
|
+
|
|
127
|
+
# Are the attributes an ActionController::Parameters instance?
|
|
128
|
+
#
|
|
129
|
+
# @return [Boolean]
|
|
130
|
+
# @!visibility private
|
|
131
|
+
def strong_parameters?
|
|
132
|
+
Object.const_defined?('ActionController::Parameters') && @data.is_a?(ActionController::Parameters)
|
|
133
|
+
end
|
|
125
134
|
end
|
|
126
135
|
end
|
|
127
136
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jsonapi-params
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Noverde Team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-01-
|
|
11
|
+
date: 2016-01-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|