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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 01dd65d6881984784e66ada7c2f9b6a551df29ba
4
- data.tar.gz: 49f56ed690ce73266c3647106b24feac1795f84a
3
+ metadata.gz: 521d608a58983b2c99246e34faf27eae9bb38b32
4
+ data.tar.gz: 02a2e7a0086ede91a907d8c7d097150f0222b768
5
5
  SHA512:
6
- metadata.gz: f1690aedae0537c30374eebb9322fb21b99eb4312226ce1b1db1ff014ed621a7c20e8d828ea2784cad51d467681104e2273993e8f1a7d1453382c934145d51fe
7
- data.tar.gz: 810c694b033419721279c8dd3c0297081894d855003d1e88852cab94e94dc671aea3cdb68eb76014f7a8e5b78d6cbbc1c5c1c4920a9d815196d9c72fd3027dc3
6
+ metadata.gz: 23f3ebb21b586e5995b6cb4f2c2ae8f3636f93f5f0e11b9fdbbabdb4087c32850bcda172aeda4aabb8f58f762a23e8c034128f4b48bb7ed38d5ee2c573778ff4
7
+ data.tar.gz: b0cdb369d4265dd306a1af8206a46f837322ec00142ec2fac9c40c0ebcc6010cd4f2b7982e05f7ff2f489a960def72431ffc140f3460bffcf9ebecf65aee710d
@@ -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
@@ -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.original_fullpath }
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
- *request.path_parameters.keys.map(&:to_s)
40
- ).to_unsafe_h.with_indifferent_access
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
@@ -1,3 +1,3 @@
1
1
  module JSONAPI
2
- VERSION = '1.5.6'
2
+ VERSION = '1.5.7'
3
3
  end
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.6
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-02-08 00:00:00.000000000 Z
11
+ date: 2020-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fast_jsonapi