lp-serializable 0.2.3 → 1.0.0

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
  SHA256:
3
- metadata.gz: 89210875f4b075f10a9f32cd2aa6f8835338e6870b474c3e6ac43cb07ef9e032
4
- data.tar.gz: dbc7937ef61666166931ca2897feb58c257a194bf216eb602303c32fa6a9fb5c
3
+ metadata.gz: 571bdc82cdc4daa0a04c7bc64ffc0eb6aa147e01a864f080d3defa30d2894077
4
+ data.tar.gz: 6fb5aa279f61c83de4df3c31c72aa7f40fb570299dc66ee93a9a15c1fdd8dd0a
5
5
  SHA512:
6
- metadata.gz: bc82ab5cafd065632241e73a015c0e12f01753a201426e5929f10f6f726e6ccc5dad8c3c90523f3cf7a0dcdab6f0353ff8c1f0f66786922cf8196fa7a16cc61a
7
- data.tar.gz: edba6bfea1317854dfa1c49ab205fb0296762cfd711276abfb03a89b9d69f81a1858d37369f59c5d840b8b58b212f49710d5a9ca3a354ffa62869dc4ccc4291f
6
+ metadata.gz: 18adea0133108a9ab4f8de8184da80176f9823cc97cb6a95af79ff081f3dd489f452d27caed37ae4f7e04932dba5014a5bc601bee63c5f13f717603274331286
7
+ data.tar.gz: 7db2565d566e1b232a58be585e15726a7e2f0b1d699515c0941d5acd712e43fff9ff989a4cc613ae7caf1c3b2335a5224850ce9e0a439456fac90d991b586601
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lp-serializable (0.2.3)
4
+ lp-serializable (1.0.0)
5
5
  activesupport (>= 4.2)
6
6
  fast_jsonapi (>= 1.3)
7
7
 
data/README.md CHANGED
@@ -92,7 +92,7 @@ movie
92
92
 
93
93
  **Return a hash**
94
94
  ```ruby
95
- hash = serialize_and_flatten(movie)
95
+ hash = serializable(movie)
96
96
  ```
97
97
 
98
98
  **Output**
@@ -157,6 +157,18 @@ end
157
157
 
158
158
  Attribute `:actors` will trigger `ActorSerializer` to serialize the actors collection. Consequently, any relationships defined in `ActorSerializer` via custom attributes and serialized with `serializable_` methods (using the `nested: true` option) will be appropriately nested.
159
159
 
160
+ ## Custom Serializer Class
161
+
162
+ Use `#serializable_class` to serialize with a custom class:
163
+
164
+ ```ruby
165
+ def show
166
+ movie = Movie.find(params[:id])
167
+ # Will serialize with FilmSerializer instead of MovieSerializer
168
+ movie_hash = serializable_class(movie, 'Film')
169
+ render json: movie_hash
170
+ end
171
+ ```
160
172
 
161
173
  ## Options Support
162
174
 
@@ -1,5 +1,5 @@
1
1
  module Lp
2
2
  module Serializable
3
- VERSION = "0.2.3"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lp-serializable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - mrjonesbot
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-26 00:00:00.000000000 Z
11
+ date: 2020-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal