jsonapi-serializers 0.16.0 → 0.16.1
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/README.md +1 -1
- data/lib/jsonapi-serializers/serializer.rb +2 -1
- data/lib/jsonapi-serializers/version.rb +1 -1
- data/spec/serializer_spec.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f9584848d438371a8e74a93af4cd1e2ef0dbe2f
|
4
|
+
data.tar.gz: 997e23a37237cd66ef6eaa5776c0512041178be3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac2d3b371c2c94bdbacd2d77f2fb63d3b9e0b5f5e29daca35bffaf8152a2dbc3c8b68081c2eb3c4981ebb79f7af5c85f119b769cf68028d17de3f71d57515854
|
7
|
+
data.tar.gz: 3a5789b22a8508cd3ee6641fe2753490321087592852f670a7824ed59d6f3a67b6d6a2b3ed4d1a0d55380bf3948a3b0b9cb4ea502d18972a2aee522d7f39ceb2
|
data/README.md
CHANGED
@@ -205,10 +205,11 @@ module JSONAPI
|
|
205
205
|
# Allow "if: :show_title?" and "unless: :hide_title?" attribute options.
|
206
206
|
if_method_name = attr_data[:options][:if]
|
207
207
|
unless_method_name = attr_data[:options][:unless]
|
208
|
+
formatted_attribute_name = format_name(attribute_name).to_sym
|
208
209
|
show_attr = true
|
209
210
|
show_attr &&= send(if_method_name) if if_method_name
|
210
211
|
show_attr &&= !send(unless_method_name) if unless_method_name
|
211
|
-
show_attr &&= @_fields[type.to_s].include?(
|
212
|
+
show_attr &&= @_fields[type.to_s].include?(formatted_attribute_name) if @_fields[type.to_s]
|
212
213
|
show_attr
|
213
214
|
end
|
214
215
|
protected :should_include_attr?
|
data/spec/serializer_spec.rb
CHANGED
@@ -886,7 +886,7 @@ describe JSONAPI::Serializer do
|
|
886
886
|
long_comments = [first_comment, second_comment]
|
887
887
|
post = create(:post, :with_author, long_comments: long_comments)
|
888
888
|
|
889
|
-
fields = {posts: 'title,author,
|
889
|
+
fields = {posts: 'title,author,long-comments'}
|
890
890
|
serialized_data = JSONAPI::Serializer.serialize(post, fields: fields)
|
891
891
|
expect(serialized_data['data']['relationships']).to eq ({
|
892
892
|
'author' => {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonapi-serializers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.16.
|
4
|
+
version: 0.16.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Fotinakis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
139
139
|
rubyforge_project:
|
140
|
-
rubygems_version: 2.
|
140
|
+
rubygems_version: 2.6.7
|
141
141
|
signing_key:
|
142
142
|
specification_version: 4
|
143
143
|
summary: Pure Ruby readonly serializers for the JSON:API spec.
|