json_api_responders 2.6.0 → 2.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +24 -0
- data/.gitignore +0 -1
- data/Gemfile.lock +72 -0
- data/LICENSE +21 -0
- data/json_api_responders.gemspec +3 -1
- data/lib/json_api_responders/responder/actions.rb +1 -1
- data/lib/json_api_responders/responder.rb +2 -2
- data/lib/json_api_responders/version.rb +2 -2
- data/lib/json_api_responders.rb +3 -1
- metadata +26 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24ac85c0a9cead016e6a85f137862c45de681c4efd2f6c76c61c67375c976e75
|
4
|
+
data.tar.gz: 35714ae4317d6d3b1e60fa400d3bd9c90538cf9a70c8265802ba6d12cfc793a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e89a20f6ad1ef12fa75d3cd367ca02205fe998bf882859264ca4f34c824e93ebd8e72a28e843e854dfdcf7e224dafa8785f071ad0dd04c414c068a4bc5f3237
|
7
|
+
data.tar.gz: ea307d61e1032c6fb8641741f1586bf57d7987bc36482f73aee3fbe09385f8336311c3576083ef12105f24173bf3273ecc4778c676d218531b9b2c2f7f3bfb40
|
@@ -0,0 +1,24 @@
|
|
1
|
+
name: Test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
name: Ruby ${{ matrix.ruby }}
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
strategy:
|
14
|
+
matrix:
|
15
|
+
ruby: [2.7, '3.0', 3.1]
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v3
|
19
|
+
- uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: ${{ matrix.ruby }}
|
22
|
+
bundler-cache: true
|
23
|
+
- name: Run tests
|
24
|
+
run: bundle exec rake
|
data/.gitignore
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
json_api_responders (2.7.0)
|
5
|
+
activemodel
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activemodel (7.0.3)
|
11
|
+
activesupport (= 7.0.3)
|
12
|
+
activesupport (7.0.3)
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
+
i18n (>= 1.6, < 2)
|
15
|
+
minitest (>= 5.1)
|
16
|
+
tzinfo (~> 2.0)
|
17
|
+
byebug (11.1.3)
|
18
|
+
codeclimate-test-reporter (1.0.9)
|
19
|
+
simplecov (<= 0.13)
|
20
|
+
coderay (1.1.3)
|
21
|
+
concurrent-ruby (1.1.10)
|
22
|
+
diff-lcs (1.5.0)
|
23
|
+
docile (1.1.5)
|
24
|
+
i18n (1.10.0)
|
25
|
+
concurrent-ruby (~> 1.0)
|
26
|
+
json (2.6.1)
|
27
|
+
method_source (1.0.0)
|
28
|
+
minitest (5.15.0)
|
29
|
+
pry (0.13.1)
|
30
|
+
coderay (~> 1.1)
|
31
|
+
method_source (~> 1.0)
|
32
|
+
pry-byebug (3.9.0)
|
33
|
+
byebug (~> 11.0)
|
34
|
+
pry (~> 0.13.0)
|
35
|
+
rack (2.2.3)
|
36
|
+
rake (10.5.0)
|
37
|
+
rspec (3.11.0)
|
38
|
+
rspec-core (~> 3.11.0)
|
39
|
+
rspec-expectations (~> 3.11.0)
|
40
|
+
rspec-mocks (~> 3.11.0)
|
41
|
+
rspec-core (3.11.0)
|
42
|
+
rspec-support (~> 3.11.0)
|
43
|
+
rspec-expectations (3.11.0)
|
44
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
45
|
+
rspec-support (~> 3.11.0)
|
46
|
+
rspec-mocks (3.11.1)
|
47
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
+
rspec-support (~> 3.11.0)
|
49
|
+
rspec-support (3.11.0)
|
50
|
+
simplecov (0.13.0)
|
51
|
+
docile (~> 1.1.0)
|
52
|
+
json (>= 1.8, < 3)
|
53
|
+
simplecov-html (~> 0.10.0)
|
54
|
+
simplecov-html (0.10.2)
|
55
|
+
tzinfo (2.0.4)
|
56
|
+
concurrent-ruby (~> 1.0)
|
57
|
+
|
58
|
+
PLATFORMS
|
59
|
+
ruby
|
60
|
+
|
61
|
+
DEPENDENCIES
|
62
|
+
bundler
|
63
|
+
codeclimate-test-reporter
|
64
|
+
json_api_responders!
|
65
|
+
pry-byebug
|
66
|
+
rack
|
67
|
+
rake (~> 10.0)
|
68
|
+
rspec
|
69
|
+
simplecov
|
70
|
+
|
71
|
+
BUNDLED WITH
|
72
|
+
2.3.13
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2016 Infinum
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/json_api_responders.gemspec
CHANGED
@@ -12,6 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.summary = 'Automatically respond to JSON::API requests'
|
13
13
|
spec.description = 'Automatically respond to JSON::API requests'
|
14
14
|
spec.homepage = 'https://github.com/infinum/json_api_responders'
|
15
|
+
spec.license = 'MIT'
|
15
16
|
|
16
17
|
if spec.respond_to?(:metadata)
|
17
18
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
@@ -26,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
26
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
28
|
spec.require_paths = ['lib']
|
28
29
|
|
29
|
-
spec.add_development_dependency 'bundler'
|
30
|
+
spec.add_development_dependency 'bundler'
|
30
31
|
spec.add_development_dependency 'rake', '~> 10.0'
|
31
32
|
# spec.add_development_dependency 'rspec-rails'
|
32
33
|
spec.add_development_dependency 'rspec'
|
@@ -34,4 +35,5 @@ Gem::Specification.new do |spec|
|
|
34
35
|
spec.add_development_dependency 'pry-byebug'
|
35
36
|
spec.add_development_dependency 'simplecov'
|
36
37
|
spec.add_development_dependency 'codeclimate-test-reporter'
|
38
|
+
spec.add_dependency 'activemodel'
|
37
39
|
end
|
@@ -37,7 +37,7 @@ module JsonApiResponders
|
|
37
37
|
|
38
38
|
def render_error
|
39
39
|
controller.render(
|
40
|
-
render_options.merge(
|
40
|
+
**render_options.merge(
|
41
41
|
json: error_render_options,
|
42
42
|
status: error_status
|
43
43
|
)
|
@@ -66,7 +66,7 @@ module JsonApiResponders
|
|
66
66
|
errors[:errors] << { detail: on_error(:detail) } if on_error(:detail)
|
67
67
|
|
68
68
|
if resource.respond_to?(:errors)
|
69
|
-
if ActiveModel.version >= Gem::Version.new("6.1")
|
69
|
+
if ::ActiveModel.version >= Gem::Version.new("6.1")
|
70
70
|
resource.errors.each do |error|
|
71
71
|
errors[:errors] << error_response(error.attribute, error.message)
|
72
72
|
end
|
data/lib/json_api_responders.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'active_model'
|
2
|
+
|
1
3
|
require 'json_api_responders/version'
|
2
4
|
require 'json_api_responders/errors'
|
3
5
|
require 'json_api_responders/responder'
|
@@ -24,7 +26,7 @@ module JsonApiResponders
|
|
24
26
|
def respond_with(resource, options = {})
|
25
27
|
options = { params: params }.merge(options)
|
26
28
|
JsonApiResponders.config.check_required_options(options)
|
27
|
-
Responder.new(self, resource, options).respond!
|
29
|
+
Responder.new(self, resource, **options).respond!
|
28
30
|
end
|
29
31
|
|
30
32
|
def respond_with_error(status, detail = nil)
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_api_responders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.1
|
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:
|
11
|
+
date: 2023-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: activemodel
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
description: Automatically respond to JSON::API requests
|
112
126
|
email:
|
113
127
|
- stanko.krtalic@gmail.com
|
@@ -116,11 +130,14 @@ extensions: []
|
|
116
130
|
extra_rdoc_files: []
|
117
131
|
files:
|
118
132
|
- ".codeclimate.yml"
|
133
|
+
- ".github/workflows/test.yml"
|
119
134
|
- ".gitignore"
|
120
135
|
- ".rspec"
|
121
136
|
- ".rubocop.yml"
|
122
137
|
- ".travis.yml"
|
123
138
|
- Gemfile
|
139
|
+
- Gemfile.lock
|
140
|
+
- LICENSE
|
124
141
|
- README.md
|
125
142
|
- Rakefile
|
126
143
|
- bin/console
|
@@ -134,7 +151,8 @@ files:
|
|
134
151
|
- lib/json_api_responders/responder/sanitizers.rb
|
135
152
|
- lib/json_api_responders/version.rb
|
136
153
|
homepage: https://github.com/infinum/json_api_responders
|
137
|
-
licenses:
|
154
|
+
licenses:
|
155
|
+
- MIT
|
138
156
|
metadata:
|
139
157
|
allowed_push_host: https://rubygems.org
|
140
158
|
post_install_message:
|
@@ -152,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
170
|
- !ruby/object:Gem::Version
|
153
171
|
version: '0'
|
154
172
|
requirements: []
|
155
|
-
rubygems_version: 3.
|
173
|
+
rubygems_version: 3.4.5
|
156
174
|
signing_key:
|
157
175
|
specification_version: 4
|
158
176
|
summary: Automatically respond to JSON::API requests
|