Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
standardrb:
runs-on: ubuntu-18.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v2
Expand All @@ -19,7 +19,7 @@ jobs:
run: bundle exec standardrb

rubocop-rspec:
runs-on: ubuntu-18.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ on:

jobs:
rake-spec:
runs-on: ubuntu-18.04
runs-on: ubuntu-24.04
strategy:
matrix:
ruby: [2.5, 2.6, 2.7, 3.0]
ruby: ['3.2', '3.3', '3.4']

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.2
3.4.5
136 changes: 87 additions & 49 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,55 @@ PATH
remote: .
specs:
jsonapi-query_builder (0.3.0)
activerecord (>= 5)
activerecord (>= 7.2)
pagy (>= 3.5)

GEM
remote: https://rubygems.org/
specs:
actionview (6.1.4.1)
activesupport (= 6.1.4.1)
actionview (8.0.2.1)
activesupport (= 8.0.2.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activemodel (6.1.4.1)
activesupport (= 6.1.4.1)
activerecord (6.1.4.1)
activemodel (= 6.1.4.1)
activesupport (= 6.1.4.1)
activesupport (6.1.4.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activemodel (8.0.2.1)
activesupport (= 8.0.2.1)
activerecord (8.0.2.1)
activemodel (= 8.0.2.1)
activesupport (= 8.0.2.1)
timeout (>= 0.4.0)
activesupport (8.0.2.1)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
ast (2.4.2)
base64 (0.3.0)
benchmark (0.4.1)
bigdecimal (3.2.3)
builder (3.2.4)
bundler-audit (0.9.0.1)
bundler (>= 1.2.0, < 3)
thor (~> 1.0)
coderay (1.1.3)
concurrent-ruby (1.1.9)
concurrent-ruby (1.3.5)
connection_pool (2.5.4)
crass (1.0.6)
diff-lcs (1.4.4)
erubi (1.10.0)
drb (2.2.3)
erubi (1.13.1)
i18n (1.8.10)
concurrent-ruby (~> 1.0)
json (2.13.2)
kaminari (1.2.1)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.1)
Expand All @@ -49,33 +63,39 @@ GEM
activerecord
kaminari-core (= 1.2.1)
kaminari-core (1.2.1)
language_server-protocol (3.17.0.5)
lefthook (0.7.6)
loofah (2.12.0)
lint_roller (1.1.0)
logger (1.7.0)
loofah (2.24.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
nokogiri (>= 1.12.0)
method_source (1.0.0)
mini_portile2 (2.6.1)
mini_portile2 (2.8.9)
minitest (5.14.4)
nokogiri (1.12.5)
mini_portile2 (~> 2.6.1)
nokogiri (1.18.9)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
pagy (3.11.0)
parallel (1.21.0)
parser (3.0.2.0)
parser (3.3.9.0)
ast (~> 2.4.1)
racc
prism (1.4.0)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
racc (1.5.2)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
rails-dom-testing (2.3.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.2)
loofah (~> 2.3)
rails-html-sanitizer (1.6.2)
loofah (~> 2.21)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
rainbow (3.0.0)
rake (13.0.6)
regexp_parser (2.1.1)
rexml (3.2.5)
regexp_parser (2.11.2)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
Expand All @@ -89,34 +109,52 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.2)
rubocop (1.20.0)
rubocop (1.80.2)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.0.0.0)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.9.1, < 2.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.46.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.12.0)
parser (>= 3.0.1.1)
rubocop-performance (1.11.5)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.46.0)
parser (>= 3.3.7.2)
prism (~> 1.4)
rubocop-performance (1.25.0)
lint_roller (~> 1.1)
rubocop (>= 1.75.0, < 2.0)
rubocop-ast (>= 1.38.0, < 2.0)
rubocop-rspec (2.5.0)
rubocop (~> 1.19)
ruby-progressbar (1.11.0)
sqlite3 (1.4.2)
standard (1.3.0)
rubocop (= 1.20.0)
rubocop-performance (= 1.11.5)
securerandom (0.4.1)
sqlite3 (2.7.3)
mini_portile2 (~> 2.8.0)
standard (1.51.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.80.2)
standard-custom (~> 1.0.0)
standard-performance (~> 1.8)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
standard-performance (1.8.0)
lint_roller (~> 1.1)
rubocop-performance (~> 1.25.0)
standardrb (1.0.0)
standard
thor (1.1.0)
tzinfo (2.0.4)
thor (1.4.0)
timeout (0.4.3)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.1.0)
zeitwerk (2.4.2)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.1.0)
uri (1.0.3)

PLATFORMS
ruby
Expand All @@ -137,4 +175,4 @@ DEPENDENCIES
standardrb

BUNDLED WITH
2.2.22
2.7.2
4 changes: 2 additions & 2 deletions jsonapi-query_builder.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.required_ruby_version = ">= 2.5"
spec.required_ruby_version = ">= 3.2"

spec.add_runtime_dependency "activerecord", ">= 5"
spec.add_runtime_dependency "activerecord", ">= 7.2"
spec.add_runtime_dependency "pagy", ">= 3.5"

spec.add_development_dependency "bundler", "~> 2.0"
Expand Down
5 changes: 2 additions & 3 deletions lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ lint:
commands: &lint
lint-frozen-strings:
glob: "*.rb"
run: bundle exec rubocop --only Style/FrozenStringLiteralComment,Layout/EmptyLineAfterMagicComment --format quiet --auto-correct
run: bundle exec rubocop --only Style/FrozenStringLiteralComment,Layout/EmptyLineAfterMagicComment --format quiet --autocorrect

rubocop:
commands: &rubocop
Expand All @@ -13,8 +13,7 @@ rubocop:
pre-commit:
parallel: true
commands:
<<: *lint
<<: *rubocop
<<: [*lint, *rubocop]
standardrb:
glob: "*.rb"
run: bundle exec standardrb {staged_files}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ module QueryBuilder
module Errors
class UnpermittedSortParameters < ArgumentError
def initialize(unpermitted_parameters)
super [
super([
unpermitted_parameters.to_sentence,
unpermitted_parameters.count == 1 ? "is not a" : "are not",
(unpermitted_parameters.count == 1) ? "is not a" : "are not",
"permitted sort attribute".pluralize(unpermitted_parameters.count)
].join(" ")
].join(" "))
end
end
end
Expand Down
5 changes: 2 additions & 3 deletions lib/jsonapi/query_builder/paginator/pagy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ class Pagy < BasePaginator
def paginate(page_params)
@params = {page: page_params}

pagination_details, records = pagy collection, page: page_params[:number],
items: page_params[:size],
outset: page_params[:offset]
pagination_details, records = pagy(collection, page: page_params[:number], items: page_params[:size], outset: page_params[:offset])

[records, pagination_details]
end

Expand Down
2 changes: 1 addition & 1 deletion spec/jsonapi/query_builder/mixins/sort_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
unique_sort_attribute id: :asc
sorts_by :last_name
sorts_by :first_name, ->(collection, direction) { collection.order(name: direction) }
sorts_by :'address.street', StreetSort
sorts_by :"address.street", StreetSort

def initialize(collection, params)
@collection = collection
Expand Down
12 changes: 6 additions & 6 deletions spec/jsonapi/query_builder/paginator/kaminari_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

let(:collection) { instance_double "collection" }
let(:paged_collection) do
instance_double "paged-collection", current_page: 2,
limit_value: 20,
total_count: 35,
total_pages: 2,
next_page: nil,
prev_page: 1
instance_double("paged-collection", current_page: 2,
limit_value: 20,
total_count: 35,
total_pages: 2,
next_page: nil,
prev_page: 1)
end

before do
Expand Down