standardapi 1.0.16 → 1.0.17
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f80d90ed82d66f971ccf96ea833f58acd99c9adf
|
4
|
+
data.tar.gz: e317d8b862655b1d97081a3d114be321a417fcb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64df65916314e170718b1efb030802c8950a4ea11f55f6dfdb9ed6b8d801fcbf9488204c04f2015ea984bcd2152889a87e53b0d7d20d9facd8138a89ab17b8bb
|
7
|
+
data.tar.gz: c3acbfc937611625bd7d08d0692df7d5738486c360df3de3a0523011ccfb2096407914fc724560e774a07311409d50699e523228aa28596553cc8e6dc633dfaf
|
@@ -91,6 +91,7 @@ module StandardAPI
|
|
91
91
|
|
92
92
|
view_attributes(m).each do |key, value|
|
93
93
|
message = "Model / Attribute: #{m.class.name}##{key}"
|
94
|
+
byebug if m_json[key.to_s] != normalize_to_json(m, key, value)
|
94
95
|
assert_equal m_json[key.to_s], normalize_to_json(m, key, value)
|
95
96
|
end
|
96
97
|
|
@@ -1,23 +1,23 @@
|
|
1
1
|
record.attributes.each do |name, value|
|
2
2
|
# Skip if attribute is included in excludes
|
3
|
-
next if defined?(excludes) && excludes[record.model_name.singular].try(:find) { |x| x.to_s
|
3
|
+
next if defined?(excludes) && excludes[record.model_name.singular.to_sym].try(:find) { |x| x.to_s == name.to_s }
|
4
4
|
json.set! name, value
|
5
5
|
end
|
6
6
|
|
7
7
|
includes.each do |inc, subinc|
|
8
8
|
association = record.class.reflect_on_association(inc)
|
9
|
-
if association
|
9
|
+
if association
|
10
10
|
json.set! inc do
|
11
11
|
collection = [:has_many, :has_and_belongs_to_many].include?(association.macro)
|
12
12
|
|
13
|
-
partial = model_partial(association.klass)
|
14
|
-
|
15
13
|
if collection
|
14
|
+
partial = model_partial(association.klass)
|
16
15
|
json.array! record.send(inc), partial: partial, as: :record, locals: { includes: subinc }
|
17
16
|
else
|
18
17
|
if record.send(inc).nil?
|
19
18
|
json.set! association.klass.model_name.element, nil
|
20
19
|
else
|
20
|
+
partial = model_partial(record.send(inc))
|
21
21
|
json.partial! partial, record: record.send(inc), includes: subinc
|
22
22
|
end
|
23
23
|
end
|
@@ -28,5 +28,5 @@ includes.each do |inc, subinc|
|
|
28
28
|
end
|
29
29
|
|
30
30
|
if !record.errors.blank?
|
31
|
-
json.set! 'errors', record.errors.
|
31
|
+
json.set! 'errors', record.errors.to_hash
|
32
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: standardapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Bracy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord-sort
|