jsonapi.rb 1.6.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -1
- data/lib/jsonapi/active_model_error_serializer.rb +0 -3
- data/lib/jsonapi/error_serializer.rb +6 -1
- data/lib/jsonapi/filtering.rb +6 -2
- data/lib/jsonapi/pagination.rb +25 -5
- data/lib/jsonapi/rails.rb +18 -10
- 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 +36 -25
- 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 -4
- data/Rakefile +0 -34
- data/jsonapi.rb.gemspec +0 -40
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,34 +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
|
-
if ENV['RAILS_VERSION'].to_s.include?('4')
|
28
|
-
task(qa: ['qa:docs'])
|
29
|
-
else
|
30
|
-
task(qa: ['qa:docs', 'qa:code'])
|
31
|
-
end
|
32
|
-
|
33
|
-
RSpec::Core::RakeTask.new(spec: :qa)
|
34
|
-
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 'jsonapi-serializer', '~> 2.0'
|
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
|