restpack_serializer 0.5.8 → 0.5.9
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48ad2bb0975d935d8c7862edb654645f26e7ee91
|
4
|
+
data.tar.gz: 965783d651b2f3bb9b1d37b8cab6b18064c091e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a12cd6e72db3ad699934ff7ff5dade4f8d76514d76aef01d707949da51f7caf8628a104ccaadec3275737714beed588d91884fef81544da6e6893ec670f14d02
|
7
|
+
data.tar.gz: d3e38c875f4467d587d0b8e68329daccad67a3e368c62c84278431325a1cdeadbc8cf1dce4be1ff1720501f57d5451950c353c9a818f37bdb22680aee8043f4b
|
@@ -49,7 +49,8 @@ module RestPack::Serializer::Attributes
|
|
49
49
|
define_method name do
|
50
50
|
value = self.default_href if name == :href
|
51
51
|
if @model.is_a?(Hash)
|
52
|
-
value
|
52
|
+
value = @model[name]
|
53
|
+
value = @model[name.to_s] if value.nil?
|
53
54
|
else
|
54
55
|
value ||= @model.send(name)
|
55
56
|
end
|
@@ -57,13 +57,14 @@ describe RestPack::Serializer::Attributes do
|
|
57
57
|
end
|
58
58
|
|
59
59
|
describe "model as a hash" do
|
60
|
-
let(:model) { { a: 'A', 'b' => 'B' } }
|
60
|
+
let(:model) { { a: 'A', 'b' => 'B', c: false } }
|
61
61
|
|
62
62
|
subject(:as_json) { CustomSerializer.as_json(model, include_gonzaga?: false) }
|
63
63
|
|
64
64
|
it 'uses the transform method on the model attribute' do
|
65
65
|
expect(as_json[:a]).to eq('A')
|
66
66
|
expect(as_json[:b]).to eq('B')
|
67
|
+
expect(as_json[:c]).to eq(false)
|
67
68
|
end
|
68
69
|
end
|
69
70
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restpack_serializer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gavin Joyce
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|