json_api_responders 2.3.0 → 2.4.0

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
- SHA1:
3
- metadata.gz: 6082cfc85b741c549db6f0d8c2a3c430c4723c96
4
- data.tar.gz: d60acf9a61be1307044fb219dded909308438b0d
2
+ SHA256:
3
+ metadata.gz: 7df311b93bbca363d13105a1db7d3d3edad5f2739f5b4c59fa9e9ba55cf917c5
4
+ data.tar.gz: 1f7eb04edff138ccfdf2a0cfab648c2236200665124b1a9d4e875a28a53ebc64
5
5
  SHA512:
6
- metadata.gz: 120db92c0eeb5c5daec62e49903df4561ea56a24661c67fcbe873511a9a68569181eb40332d76f1abc75aac8a272b098ffccbeca0b4cce1bcb7e43470da09d03
7
- data.tar.gz: b580a033b90d92a053ab0ea37de03d6c809613343230f9b2b6de11641119452572f2b4d0a25886d201e9dfd02fbbf4c16dfd017fb00531ec62da65314177dd4e
6
+ metadata.gz: '09e3590a12b0578c798796c5bfe35351d5282cb6159034e3127b4f9c163d04393417fe4da194526a3ec78f3e7aa8d7d0fe44436583125588db017730b6f87349'
7
+ data.tar.gz: 591341c5b4585cdc55ae6646fd7b8698bb42812cb9e1a0fcfd3eb9ff4f1b70fbdb88b1c20ef7e7a428c130684aebfdb57ffd55e07f72cb34aeba3fa82730d42b
data/README.md CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/json_api_responders.svg)](https://badge.fury.io/rb/json_api_responders)
4
4
  [![Build Status](https://semaphoreci.com/api/v1/infinum/json_api_responders/branches/master/shields_badge.svg)](https://semaphoreci.com/infinum/json_api_responders)
5
- [![Code Climate](https://codeclimate.com/github/infinum/json_api_responders/badges/gpa.svg)](https://codeclimate.com/github/infinum/json_api_responders)
6
- [![Test Coverage](https://codeclimate.com/github/infinum/json_api_responders/badges/coverage.svg)](https://codeclimate.com/github/infinum/json_api_responders/coverage)
5
+ [![Maintainability](https://api.codeclimate.com/v1/badges/f0735e647a41336a7f0a/maintainability)](https://codeclimate.com/github/infinum/json_api_responders/maintainability)
6
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/f0735e647a41336a7f0a/test_coverage)](https://codeclimate.com/github/infinum/json_api_responders/test_coverage)
7
7
 
8
8
  This gem gives a few convenient methods for working with JSONAPI. It is inspired by the [responders](https://github.com/plataformatec/responders) gem.
9
9
 
@@ -60,13 +60,15 @@ This method requires HTTP status code and an optional parameter explaining the e
60
60
  ## Configuration
61
61
  Currently you can only configure which options are required to be passed through the `respond_with` method. These required options are categorized by the controller's actions. Bellow you can find an example:
62
62
 
63
+ # config/initializers/json_api_responders.rb
63
64
  JsonApiResponders.configure do |config|
64
65
  config.required_options = {
65
66
  index: [:each_serializer],
66
67
  create: [:serializer]
67
68
  }
68
69
  end
69
- ...
70
+
71
+ # app/controllers/v1/users_controller.rb
70
72
  def create
71
73
  user = User.create(...)
72
74
  respond_with user, serializer: UserSerializer
@@ -90,6 +92,7 @@ If `:serializer` was left out of the above `respond_with` method you would see t
90
92
  render json: resource, status: 201
91
93
  else
92
94
  render error: errors, status: 409
95
+ end
93
96
 
94
97
  ### update
95
98
 
@@ -97,6 +100,7 @@ If `:serializer` was left out of the above `respond_with` method you would see t
97
100
  render json: resource, status: 200
98
101
  else
99
102
  render error: errors, status: 409
103
+ end
100
104
 
101
105
  ### destroy
102
106
 
@@ -33,8 +33,8 @@ module JsonApiResponders
33
33
 
34
34
  private
35
35
 
36
- def record_not_found!
37
- respond_with_error(:not_found)
36
+ def record_not_found!(reason)
37
+ respond_with_error(:not_found, reason.message)
38
38
  end
39
39
 
40
40
  def parameter_missing!(reason)
@@ -1,6 +1,6 @@
1
1
  module JsonApiResponders
2
2
  MAJOR = 2
3
- MINOR = 3
3
+ MINOR = 4
4
4
  PATCH = 0
5
5
  VERSION = [MAJOR, MINOR, PATCH].join('.').freeze
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_api_responders
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stanko Krtalić Rusendić
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-24 00:00:00.000000000 Z
11
+ date: 2018-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
153
  version: '0'
154
154
  requirements: []
155
155
  rubyforge_project:
156
- rubygems_version: 2.6.11
156
+ rubygems_version: 2.7.3
157
157
  signing_key:
158
158
  specification_version: 4
159
159
  summary: Automatically respond to JSON::API requests