jsonapi-params 0.1.2 → 0.1.3

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: de9116b1bef0c70f1bb9f7212643d3cc3e5f0604
4
- data.tar.gz: 12a615d655fc3c48f83e6b76da34c5a5a6553291
3
+ metadata.gz: f842e95854f931fa69a0e3ba04d4a8a760f17f11
4
+ data.tar.gz: 5e6f05f52c7fb5dfd67a1b7dbf50fa794c45192e
5
5
  SHA512:
6
- metadata.gz: feb7542e2522a61504eb40864eae68bff92326ae1c6cdb342ed6dce963be259042e29e0abef51c4a36e4f226998b4723632d70e66312900633a7b3ba6ec26b9b
7
- data.tar.gz: 3648e73135005676a49c36d65910b6312cf012530d79b3e83139b43f2d1108c6fe405c6c1fa52865e99510d0fe450126a384bf06d88bddaec587cc15489e03bb
6
+ metadata.gz: 379e54a2a2a5766019cc5d46adde42489f7f87e313327ce2d047f8a7448f51556a27248957a68a6c9b11bc56c88271d4e05447c439637b1af1eb0bae4f1a3daf
7
+ data.tar.gz: ee54f058231a5ee2c1559fbbad605b7136d32d8084c77038c950bcb0f18983c915d3ddb4b32039b8ff1583d2ad31f95025ae0e8b47a7fda8447178c87036a871
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.1.3
4
+
5
+ * Fix the empty attributes return
6
+
3
7
  ## 0.1.2
4
8
 
5
9
  * Fix attributes and relationships to force convert rails parameters to a hash.
@@ -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
- attributes.to_h.inject({}) do |attributes, (key, value)|
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
@@ -1,5 +1,5 @@
1
1
  module JSONAPI
2
2
  module Param
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  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.2
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-28 00:00:00.000000000 Z
11
+ date: 2016-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport