jsonapi.rb 1.5.7 → 2.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 +5 -5
- data/README.md +28 -4
- data/lib/jsonapi/active_model_error_serializer.rb +0 -3
- data/lib/jsonapi/error_serializer.rb +8 -3
- data/lib/jsonapi/filtering.rb +7 -2
- data/lib/jsonapi/pagination.rb +25 -5
- data/lib/jsonapi/rails.rb +38 -13
- data/lib/jsonapi/version.rb +1 -1
- data/spec/deserialization_spec.rb +87 -0
- data/spec/dummy.rb +162 -0
- data/spec/errors_spec.rb +168 -0
- data/spec/fetching_spec.rb +65 -0
- data/spec/filtering_spec.rb +101 -0
- data/spec/pagination_spec.rb +246 -0
- data/spec/spec_helper.rb +87 -0
- metadata +37 -27
- data/.github/ISSUE_TEMPLATE.md +0 -16
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -17
- data/.github/workflows/ci.yml +0 -36
- data/.gitignore +0 -3
- data/.rspec +0 -3
- data/.rubocop.yml +0 -36
- data/.yardstick.yml +0 -29
- data/Gemfile +0 -6
- data/Rakefile +0 -30
- data/jsonapi.rb.gemspec +0 -40
metadata
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonapi.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stas Suscov
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: jsonapi-serializer
|
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: :runtime
|
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
|
-
name:
|
28
|
+
name: rack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -39,13 +39,13 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
|
-
type: :
|
48
|
+
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
@@ -53,7 +53,21 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: ransack
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: railties
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - ">="
|
@@ -67,7 +81,7 @@ dependencies:
|
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: activerecord
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - ">="
|
@@ -227,18 +241,8 @@ executables: []
|
|
227
241
|
extensions: []
|
228
242
|
extra_rdoc_files: []
|
229
243
|
files:
|
230
|
-
- ".github/ISSUE_TEMPLATE.md"
|
231
|
-
- ".github/PULL_REQUEST_TEMPLATE.md"
|
232
|
-
- ".github/workflows/ci.yml"
|
233
|
-
- ".gitignore"
|
234
|
-
- ".rspec"
|
235
|
-
- ".rubocop.yml"
|
236
|
-
- ".yardstick.yml"
|
237
|
-
- Gemfile
|
238
244
|
- LICENSE.txt
|
239
245
|
- README.md
|
240
|
-
- Rakefile
|
241
|
-
- jsonapi.rb.gemspec
|
242
246
|
- lib/jsonapi.rb
|
243
247
|
- lib/jsonapi/active_model_error_serializer.rb
|
244
248
|
- lib/jsonapi/deserialization.rb
|
@@ -250,11 +254,18 @@ files:
|
|
250
254
|
- lib/jsonapi/patches.rb
|
251
255
|
- lib/jsonapi/rails.rb
|
252
256
|
- lib/jsonapi/version.rb
|
257
|
+
- spec/deserialization_spec.rb
|
258
|
+
- spec/dummy.rb
|
259
|
+
- spec/errors_spec.rb
|
260
|
+
- spec/fetching_spec.rb
|
261
|
+
- spec/filtering_spec.rb
|
262
|
+
- spec/pagination_spec.rb
|
263
|
+
- spec/spec_helper.rb
|
253
264
|
homepage: https://github.com/stas/jsonapi.rb
|
254
265
|
licenses:
|
255
266
|
- MIT
|
256
267
|
metadata: {}
|
257
|
-
post_install_message:
|
268
|
+
post_install_message:
|
258
269
|
rdoc_options: []
|
259
270
|
require_paths:
|
260
271
|
- lib
|
@@ -269,9 +280,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
269
280
|
- !ruby/object:Gem::Version
|
270
281
|
version: '0'
|
271
282
|
requirements: []
|
272
|
-
|
273
|
-
|
274
|
-
signing_key:
|
283
|
+
rubygems_version: 3.3.3
|
284
|
+
signing_key:
|
275
285
|
specification_version: 4
|
276
286
|
summary: So you say you need JSON:API support in your API...
|
277
287
|
test_files: []
|
data/.github/ISSUE_TEMPLATE.md
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
## What is the current behavior?
|
2
|
-
|
3
|
-
<!-- Please describe the current behavior that you are modifying, or link to a
|
4
|
-
relevant issue. -->
|
5
|
-
|
6
|
-
## What is the new behavior?
|
7
|
-
|
8
|
-
<!-- Please describe the behavior or changes that are being added here. -->
|
9
|
-
|
10
|
-
## Checklist
|
11
|
-
|
12
|
-
Please make sure the following requirements are complete:
|
13
|
-
|
14
|
-
- [ ] Tests for the changes have been added (for bug fixes / features)
|
15
|
-
- [ ] Docs have been reviewed and added / updated if needed (for bug fixes /
|
16
|
-
features)
|
17
|
-
- [ ] All automated checks pass (CI/CD)
|
data/.github/workflows/ci.yml
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
name: CI
|
2
|
-
|
3
|
-
on: [push, pull_request]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
ruby_rails_test_matrix:
|
7
|
-
runs-on: ubuntu-18.04
|
8
|
-
|
9
|
-
strategy:
|
10
|
-
matrix:
|
11
|
-
ruby: [2.4, 2.6]
|
12
|
-
rails: [4, 5, 6]
|
13
|
-
exclude:
|
14
|
-
- ruby: 2.4
|
15
|
-
rails: 6
|
16
|
-
|
17
|
-
steps:
|
18
|
-
- uses: actions/checkout@master
|
19
|
-
|
20
|
-
- name: Sets up the environment
|
21
|
-
uses: actions/setup-ruby@v1
|
22
|
-
with:
|
23
|
-
ruby-version: ${{ matrix.ruby }}
|
24
|
-
|
25
|
-
- name: Runs code QA and tests
|
26
|
-
env:
|
27
|
-
RAILS_VERSION: ~> ${{ matrix.rails }}
|
28
|
-
run: |
|
29
|
-
rm -rf Gemfile.lock
|
30
|
-
sudo apt-get update
|
31
|
-
sudo apt-get install libsqlite3-dev
|
32
|
-
gem uninstall bundler -a --force
|
33
|
-
gem install bundler -v '~> 1'
|
34
|
-
echo $RAILS_VERSION | grep -q '4' && export SQLITE3_VERSION='~> 1.3.6'
|
35
|
-
bundle
|
36
|
-
rake
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
inherit_gem:
|
2
|
-
rubocop-rails_config:
|
3
|
-
- config/rails.yml
|
4
|
-
|
5
|
-
require: rubocop-performance
|
6
|
-
|
7
|
-
Performance:
|
8
|
-
Enabled: true
|
9
|
-
|
10
|
-
Rails:
|
11
|
-
Enabled: true
|
12
|
-
|
13
|
-
Style/StringLiterals:
|
14
|
-
Enabled: true
|
15
|
-
EnforcedStyle: single_quotes
|
16
|
-
|
17
|
-
Style/FrozenStringLiteralComment:
|
18
|
-
Enabled: false
|
19
|
-
|
20
|
-
Layout/LineLength:
|
21
|
-
Max: 80
|
22
|
-
|
23
|
-
Layout/IndentationConsistency:
|
24
|
-
EnforcedStyle: normal
|
25
|
-
|
26
|
-
Style/BlockDelimiters:
|
27
|
-
Enabled: true
|
28
|
-
|
29
|
-
Rails/ApplicationRecord:
|
30
|
-
Enabled: false
|
31
|
-
|
32
|
-
Rails/BelongsTo:
|
33
|
-
Enabled: false
|
34
|
-
|
35
|
-
Rails/ApplicationController:
|
36
|
-
Enabled: false
|
data/.yardstick.yml
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
---
|
2
|
-
path: ['lib/**/*.rb']
|
3
|
-
threshold: 100
|
4
|
-
rules:
|
5
|
-
ApiTag::Presence:
|
6
|
-
enabled: false
|
7
|
-
ApiTag::Inclusion:
|
8
|
-
enabled: false
|
9
|
-
ApiTag::ProtectedMethod:
|
10
|
-
enabled: false
|
11
|
-
ApiTag::PrivateMethod:
|
12
|
-
enabled: false
|
13
|
-
ExampleTag:
|
14
|
-
enabled: false
|
15
|
-
ReturnTag:
|
16
|
-
enabled: true
|
17
|
-
exclude: []
|
18
|
-
Summary::Presence:
|
19
|
-
enabled: true
|
20
|
-
exclude: []
|
21
|
-
Summary::Length:
|
22
|
-
enabled: true
|
23
|
-
exclude: []
|
24
|
-
Summary::Delimiter:
|
25
|
-
enabled: true
|
26
|
-
exclude: []
|
27
|
-
Summary::SingleLine:
|
28
|
-
enabled: true
|
29
|
-
exclude: []
|
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
2
|
-
require 'rspec/core/rake_task'
|
3
|
-
require 'rubocop/rake_task'
|
4
|
-
require 'yaml'
|
5
|
-
require 'yardstick'
|
6
|
-
|
7
|
-
desc('Documentation stats and measurements')
|
8
|
-
task('qa:docs') do
|
9
|
-
yaml = YAML.load_file(File.expand_path('../.yardstick.yml', __FILE__))
|
10
|
-
config = Yardstick::Config.coerce(yaml)
|
11
|
-
measure = Yardstick.measure(config)
|
12
|
-
measure.puts
|
13
|
-
coverage = Yardstick.round_percentage(measure.coverage * 100)
|
14
|
-
exit(1) if coverage < config.threshold
|
15
|
-
end
|
16
|
-
|
17
|
-
desc('Codestyle check and linter')
|
18
|
-
RuboCop::RakeTask.new('qa:code') do |task|
|
19
|
-
task.fail_on_error = true
|
20
|
-
task.patterns = [
|
21
|
-
'lib/**/*.rb',
|
22
|
-
'spec/**/*.rb'
|
23
|
-
]
|
24
|
-
end
|
25
|
-
|
26
|
-
desc('Run CI QA tasks')
|
27
|
-
task(qa: ['qa:docs', 'qa:code'])
|
28
|
-
|
29
|
-
RSpec::Core::RakeTask.new(spec: :qa)
|
30
|
-
task(default: :spec)
|
data/jsonapi.rb.gemspec
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
lib = File.expand_path('../lib', __FILE__)
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
|
4
|
-
require 'jsonapi/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = 'jsonapi.rb'
|
8
|
-
spec.version = JSONAPI::VERSION
|
9
|
-
spec.authors = ['Stas Suscov']
|
10
|
-
spec.email = ['stas@nerd.ro']
|
11
|
-
|
12
|
-
spec.summary = 'So you say you need JSON:API support in your API...'
|
13
|
-
spec.description = (
|
14
|
-
'JSON:API serialization, error handling, filtering and pagination.'
|
15
|
-
)
|
16
|
-
spec.homepage = 'https://github.com/stas/jsonapi.rb'
|
17
|
-
spec.license = 'MIT'
|
18
|
-
|
19
|
-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
20
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
|
21
|
-
end
|
22
|
-
spec.require_paths = ['lib']
|
23
|
-
|
24
|
-
spec.add_dependency 'fast_jsonapi', '~> 1.5'
|
25
|
-
spec.add_dependency 'ransack'
|
26
|
-
spec.add_dependency 'rack'
|
27
|
-
|
28
|
-
spec.add_development_dependency 'bundler'
|
29
|
-
spec.add_development_dependency 'rails', ENV['RAILS_VERSION']
|
30
|
-
spec.add_development_dependency 'sqlite3', ENV['SQLITE3_VERSION']
|
31
|
-
spec.add_development_dependency 'ffaker'
|
32
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
33
|
-
spec.add_development_dependency 'rspec-rails'
|
34
|
-
spec.add_development_dependency 'jsonapi-rspec'
|
35
|
-
spec.add_development_dependency 'yardstick'
|
36
|
-
spec.add_development_dependency 'rubocop-rails_config'
|
37
|
-
spec.add_development_dependency 'rubocop'
|
38
|
-
spec.add_development_dependency 'simplecov'
|
39
|
-
spec.add_development_dependency 'rubocop-performance'
|
40
|
-
end
|