jsonapi.rb 1.5.6 → 1.5.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +3 -1
- data/lib/jsonapi/pagination.rb +13 -4
- data/lib/jsonapi/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 521d608a58983b2c99246e34faf27eae9bb38b32
|
4
|
+
data.tar.gz: 02a2e7a0086ede91a907d8c7d097150f0222b768
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23f3ebb21b586e5995b6cb4f2c2ae8f3636f93f5f0e11b9fdbbabdb4087c32850bcda172aeda4aabb8f58f762a23e8c034128f4b48bb7ed38d5ee2c573778ff4
|
7
|
+
data.tar.gz: b0cdb369d4265dd306a1af8206a46f837322ec00142ec2fac9c40c0ebcc6010cd4f2b7982e05f7ff2f489a960def72431ffc140f3460bffcf9ebecf65aee710d
|
data/.github/workflows/ci.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
name: CI
|
2
2
|
|
3
|
-
on: [push]
|
3
|
+
on: [push, pull_request]
|
4
4
|
|
5
5
|
jobs:
|
6
6
|
ruby_rails_test_matrix:
|
@@ -27,7 +27,9 @@ jobs:
|
|
27
27
|
RAILS_VERSION: ~> ${{ matrix.rails }}
|
28
28
|
run: |
|
29
29
|
rm -rf Gemfile.lock
|
30
|
+
sudo apt-get update
|
30
31
|
sudo apt-get install libsqlite3-dev
|
32
|
+
gem uninstall bundler -a --force
|
31
33
|
gem install bundler -v '~> 1'
|
32
34
|
echo $RAILS_VERSION | grep -q '4' && export SQLITE3_VERSION='~> 1.3.6'
|
33
35
|
bundle
|
data/lib/jsonapi/pagination.rb
CHANGED
@@ -30,14 +30,14 @@ module JSONAPI
|
|
30
30
|
#
|
31
31
|
# @return [Array]
|
32
32
|
def jsonapi_pagination(resources)
|
33
|
-
links = { self: request.base_url + request.
|
33
|
+
links = { self: request.base_url + request.fullpath }
|
34
34
|
pagination = jsonapi_pagination_meta(resources)
|
35
35
|
|
36
36
|
return links if pagination.blank?
|
37
37
|
|
38
38
|
original_params = params.except(
|
39
|
-
*
|
40
|
-
).
|
39
|
+
*jsonapi_path_parameters.keys.map(&:to_s)
|
40
|
+
).as_json.with_indifferent_access
|
41
41
|
|
42
42
|
original_params[:page] = original_params[:page].dup || {}
|
43
43
|
original_url = request.base_url + request.path + '?'
|
@@ -63,7 +63,7 @@ module JSONAPI
|
|
63
63
|
numbers = { current: page }
|
64
64
|
|
65
65
|
if resources.respond_to?(:unscope)
|
66
|
-
total = resources.unscope(:limit, :offset).count()
|
66
|
+
total = resources.unscope(:limit, :offset, :order).count()
|
67
67
|
else
|
68
68
|
# Try to fetch the cached size first
|
69
69
|
total = resources.instance_variable_get(:@original_size)
|
@@ -98,5 +98,14 @@ module JSONAPI
|
|
98
98
|
|
99
99
|
[(num - 1) * per_page, per_page, num]
|
100
100
|
end
|
101
|
+
|
102
|
+
# Fallback to Rack's parsed query string when Rails is not available
|
103
|
+
#
|
104
|
+
# @return [Hash]
|
105
|
+
def jsonapi_path_parameters
|
106
|
+
return request.path_parameters if request.respond_to?(:path_parameters)
|
107
|
+
|
108
|
+
request.send(:parse_query, request.query_string, '&;')
|
109
|
+
end
|
101
110
|
end
|
102
111
|
end
|
data/lib/jsonapi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonapi.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stas Suscov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fast_jsonapi
|