jsonapi.rb 1.1.1 → 1.1.2

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
  SHA256:
3
- metadata.gz: 4c76a1e2a0107283282044d238d2926cf55e0722a0a4fe263035af40f30a8da8
4
- data.tar.gz: c178cbd58f5d842400db948830eca9f5a784d3ade02bce30f048484e0d5d2178
3
+ metadata.gz: 34da5d6dcd9a125571ba22e88bf08962369e6a78d849f250e756694b1c32dc1b
4
+ data.tar.gz: 27cd59c2e576c6ae7ab98ef397e6dca446231c9b61ed97568c63e9a2f1fe8034
5
5
  SHA512:
6
- metadata.gz: 104169038398545873c56698b765ad9f7c91f4694c61568531ea82d5315c395956e3548ec769df03c7d3b01ade8a1966916a324af3b2a236d1afd237d81c1908
7
- data.tar.gz: 39bbeb7ae0205139c41a6ba5010369694cbb1d0d9ca902a5830a7e911d3e0ca6945879aa370bf64d44322bfd8971d9b88328d1b97c29e9d68029eb9544aa7ef8
6
+ metadata.gz: a89e3160b394aa072a3cefa1c64f6e4f2ab94fdee53242ab97e48a7fc2d38145aada482d0956c8a17278f7b14f07828721e4e00de1be2eff918b81153ef113c5
7
+ data.tar.gz: 649b9fd8157a09153ef06d23178fc946453cc6d3d65264fb5d979b4c4ceb9adb8fde26c4ca1bbb6343c8651832ec97f66dcfd22be4539458538b74895bf0dc1e
data/Gemfile.lock CHANGED
@@ -8,7 +8,7 @@ GIT
8
8
  PATH
9
9
  remote: .
10
10
  specs:
11
- jsonapi.rb (1.1.1)
11
+ jsonapi.rb (1.1.2)
12
12
  fast_jsonapi (~> 1.5)
13
13
  ransack (~> 2.1)
14
14
 
@@ -39,7 +39,9 @@ module JSONAPI
39
39
 
40
40
  pagination.each do |page_name, number|
41
41
  original_params[:page][:number] = number
42
- links[page_name] = original_url + CGI.unescape(original_params.to_query)
42
+ links[page_name] = original_url + CGI.unescape(
43
+ original_params.to_query
44
+ )
43
45
  end
44
46
 
45
47
  links
@@ -47,7 +49,7 @@ module JSONAPI
47
49
 
48
50
  # Generates pagination numbers
49
51
  #
50
- # @return [Hash] with the first, previous, next, current and last page number
52
+ # @return [Hash] with the first, previous, next, current, last page numbers
51
53
  def jsonapi_pagination_meta(resources)
52
54
  return {} unless JSONAPI::Rails.is_collection?(resources)
53
55
 
data/lib/jsonapi/rails.rb CHANGED
@@ -13,7 +13,7 @@ module JSONAPI
13
13
  Mime::Type.register JSONAPI::MEDIA_TYPE, :jsonapi
14
14
 
15
15
  # Map the JSON parser to the JSONAPI mime type requests.
16
- if Rails::VERSION::MAJOR >= 5
16
+ if ::Rails::VERSION::MAJOR >= 5
17
17
  parser = ActionDispatch::Request.parameter_parsers[:json]
18
18
  ActionDispatch::Request.parameter_parsers[:jsonapi] = parser
19
19
  else
@@ -63,14 +63,16 @@ module JSONAPI
63
63
  options[:meta] ||= (
64
64
  jsonapi_meta(resource) if respond_to?(:jsonapi_meta, true))
65
65
  options[:links] ||= (
66
- jsonapi_pagination(resource) if respond_to?(:jsonapi_pagination, true))
66
+ jsonapi_pagination(resource) if respond_to?(:jsonapi_pagination, true)
67
+ )
67
68
 
68
69
  # If it's an empty collection, return it directly.
69
70
  if JSONAPI::Rails.is_collection?(resource) && !resource.any?
70
71
  return options.slice(:meta, :links).merge(data: []).to_json
71
72
  end
72
73
 
73
- options[:fields] ||= jsonapi_fields if respond_to?(:jsonapi_fields, true)
74
+ options[:fields] ||= (
75
+ jsonapi_fields if respond_to?(:jsonapi_fields, true))
74
76
  options[:include] ||= (
75
77
  jsonapi_include if respond_to?(:jsonapi_include, true))
76
78
 
@@ -1,3 +1,3 @@
1
1
  module JSONAPI
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stas Suscov