mini_serializer 0.1 → 0.1.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/.gitignore +2 -1
- data/lib/mini_serializer/version.rb +1 -1
- data/lib/mini_serializer.rb +6 -6
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5e95f63521ae2309104e29ad73b4b3954a981d295814eb76727c64505c44e250
|
|
4
|
+
data.tar.gz: 9a3a258e15233884a47b178fa2046e1e73eab1eccfec4b4e4ef853e068547456
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dd08f8545118415548f7233c6d9a49629f9128227332a10d3a6c213343151aeb10607e40dbdeaf7c830fa36459611d1a2ec3a3c97f66ae4f5751e85bc7fa646d
|
|
7
|
+
data.tar.gz: db635c0c67770b8f2195e3c3f07192d4fe0f1f4298a0089ff6cd06c7082a287602833e9ab8fcb756a612e1e8adbb2e0136a3c500c7a04296520886cf6f25c3cd
|
data/.gitignore
CHANGED
data/lib/mini_serializer.rb
CHANGED
|
@@ -12,19 +12,19 @@ module MiniSerializer
|
|
|
12
12
|
@wams_except_params_main_object=except_params[:except]
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
def
|
|
15
|
+
def add_has_many(object,except_methods=[])
|
|
16
16
|
wams_has_many.append [object,except_methods]
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
def
|
|
19
|
+
def add_has_one(object,except_methods=[])
|
|
20
20
|
wams_has_one<<[object,except_methods]
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
def
|
|
23
|
+
def get_included_objects
|
|
24
24
|
return wams_association_object
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
def
|
|
27
|
+
def json_serializer
|
|
28
28
|
included_data=includes_to_serlizer
|
|
29
29
|
var_hash={}
|
|
30
30
|
|
|
@@ -48,7 +48,7 @@ module MiniSerializer
|
|
|
48
48
|
:wams_except_params,:wams_main_object,:wams_association_for_to_json,
|
|
49
49
|
:wams_except_params_main_object
|
|
50
50
|
|
|
51
|
-
def
|
|
51
|
+
def includes_to_serlizer
|
|
52
52
|
data_with_includes=nil
|
|
53
53
|
fetch_association_objects
|
|
54
54
|
if wams_has_many.any?
|
|
@@ -60,7 +60,7 @@ module MiniSerializer
|
|
|
60
60
|
return data_with_includes
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
-
def
|
|
63
|
+
def fetch_association_objects
|
|
64
64
|
wams_has_many.map do |object_asoc,except_params|
|
|
65
65
|
wams_association_for_to_json.store(object_asoc,{except: except_params}) # for to_json hash
|
|
66
66
|
wams_association_object<<object_asoc # for included (relation record)
|