rest_framework 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/rest_framework/errors.rb +0 -12
- data/lib/rest_framework/serializers.rb +5 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86f1b6f94bf7074dd30cf16be9f07fdc83df2bd477e09584f12882456e1405cf
|
4
|
+
data.tar.gz: b0d8bacaac76492876f13e8f402bb090a3e490f3bbf6656c88efb3cf52d2d1c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '02179633392aa9f9e7c873e38bcacfb1cd7c93b5caeef57c2ec112707b16fc069cae17686d899d4d6bf5cb0582dff469bac38e71081f7b5f20b5915298e6eb44'
|
7
|
+
data.tar.gz: 432da0162809905fc29e93194d616561ee0b9d93c23b194e77792fb9a7814062ae10025986c466510d3d5adfe2e4300de4104213444a30835626ed17c076f7b4
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.6
|
@@ -14,15 +14,3 @@ class RESTFramework::NilPassedToAPIResponseError < RESTFramework::Error
|
|
14
14
|
MSG
|
15
15
|
end
|
16
16
|
end
|
17
|
-
|
18
|
-
|
19
|
-
class RESTFramework::UnserializableError < RESTFramework::Error
|
20
|
-
def initialize(object)
|
21
|
-
@object = object
|
22
|
-
return super
|
23
|
-
end
|
24
|
-
|
25
|
-
def message
|
26
|
-
return "Unable to serialize `#{@object.inspect}` (of type `#{@object.class}`)."
|
27
|
-
end
|
28
|
-
end
|
@@ -105,18 +105,12 @@ class RESTFramework::NativeSerializer < RESTFramework::BaseSerializer
|
|
105
105
|
|
106
106
|
# Convert the object (record or recordset) to Ruby primitives.
|
107
107
|
def serialize
|
108
|
-
|
109
|
-
begin
|
110
|
-
if @object.is_a?(Enumerable)
|
111
|
-
return @object.map { |r| r.serializable_hash(self.get_serializer_config) }
|
112
|
-
end
|
113
|
-
return @object.serializable_hash(self.get_serializer_config)
|
114
|
-
rescue NoMethodError
|
115
|
-
end
|
116
|
-
end
|
108
|
+
raise "No object available to serialize!" unless @object
|
117
109
|
|
118
|
-
|
119
|
-
|
110
|
+
if @object.is_a?(Enumerable)
|
111
|
+
return @object.map { |r| r.serializable_hash(self.get_serializer_config) }
|
112
|
+
end
|
113
|
+
return @object.serializable_hash(self.get_serializer_config)
|
120
114
|
end
|
121
115
|
|
122
116
|
# Allow a serializer instance to be used as a hash directly in a nested serializer config.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rest_framework
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregory N. Schmit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|