dry_serialization 0.4.4.2 → 0.4.4.3

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
  SHA256:
3
- metadata.gz: 6722956e8906a82b85c3cf64a9ce275882d217c28f674003d410fa36195cfd13
4
- data.tar.gz: b6881b357536253f4dd37ff059de7e4dcb01ec3cd6e77cc79d62a0c4b17ac60c
3
+ metadata.gz: 32515881ad6106083773deb7252ed369d179aa499c8955760459c29e740da85c
4
+ data.tar.gz: b3bfffa4bed91ee6abc05edc66f45d07cee9a56b0865a143c7e5e24880ae9756
5
5
  SHA512:
6
- metadata.gz: b5a6afddeca50b3fd6baacf423375178354f33482edb81acd2c18693269fd1f07d0ffbd01bf03c4ff15a559e45d06080550efdeb842215e372d9f7212666aab6
7
- data.tar.gz: 4fa61e7c736019154a8d70191459756168c6d8154cb6254517e9715f192bfe93a9851a67e775fdf7b404af47f8122a95babd95e87ccb89b59e3790a23f09e7b0
6
+ metadata.gz: e23aa1a8f4a0b4d27b4c8d2f664c8e149421afa0e4cc2dacd7198cb38f2c43863affe03bb75fe13dfab715b212920facaa42ae4c8fcfe71ef51dd7f8bc8a6db2
7
+ data.tar.gz: daa8252dcdd1f0aec8e2acc0e8ed61beed8b4f6999cfe20c5de643c52360111793a0946335359e59411f81fcf667f05086556174c334af3939726c466f072cb7
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # DrySerialization
2
2
 
3
- ![AppVeyor](https://img.shields.io/appveyor/build/mikeyduece/dry_serialization?style=plastic)
4
- ![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/mikeyduece/dry_serialization?style=plastic)
3
+ [![Gem Version](https://badge.fury.io/rb/dry_serialization.svg)](https://badge.fury.io/rb/dry_serialization)
5
4
  ![GitHub issues](https://img.shields.io/github/issues-raw/mikeyduece/dry_serialization?style=plastic)
6
5
 
7
6
  Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/dry_serialization`. To experiment with that code, run `bin/console` for an interactive prompt.
@@ -33,7 +32,27 @@ Or install it yourself as:
33
32
  `rails g dry_serialization:<serializer_name>:install`
34
33
 
35
34
 
35
+ - This gem will assume you have an api controller, and create one if you do not. This is to further keep the api separate from the web controllers.
36
+ - The inclusion of the module corresponding to your chosen serializer gem will give you access to `#serialized_resource`.
37
+ - The `#serialized_resource` method also takes an optional 'options' hash. For `jsonapi-serializer`, that can come in the form of the `include` hash and/or `meta` or any of the other options available through that gem. Please see their documentation for all options.
38
+ - Similarly for `blueprinter` it will also take an optional options hash. Again, please see the official documentation in their repo.
39
+ ```ruby
40
+ user = User.find(params[:id])
41
+ render json: serialized_resource(user, UserSerializer) # UserSerializer can be substituted with UserBlueprint if that is the gem you've chosen.
42
+ ```
43
+
44
+ - SerializationHelper
45
+ - This module provides success and error response helper methods.
46
+ - In your controller you can use them like so:
47
+ ```ruby
48
+ def create
49
+ user = User.create(create_user_params)
50
+ return error_response(user.errors) unless user.errors.empty?
36
51
 
52
+ success_response(user, UserSerializer, :created)
53
+ end
54
+ ```
55
+ - Both methods take an optional argument for the status. You can either use the symbol representation or the number code.
37
56
 
38
57
 
39
58
  ## Development
@@ -2,6 +2,7 @@ require "dry_serialization/version"
2
2
  require "dry_serialization/blueprinter"
3
3
  require "dry_serialization/jsonapi_serializer"
4
4
  require "dry_serialization/concerns/serialization_helper"
5
+ require "dry_serialization/concerns/deserializable"
5
6
 
6
7
  module DrySerialization
7
8
 
@@ -1,3 +1,3 @@
1
1
  module DrySerialization
2
- VERSION = "0.4.4.2"
2
+ VERSION = "0.4.4.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry_serialization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4.2
4
+ version: 0.4.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Heft