jsonapi-utils 0.3.2 → 0.3.3

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: a232547785780ea0f461b1e4712c5a0d0a8a05d8
4
- data.tar.gz: a8d32ac3b2ad2efa41c3709760d9912e3a6be266
3
+ metadata.gz: dd9b7abb145201ff33ce27c5fa8a70c37914eb94
4
+ data.tar.gz: 188eb2baf1d0f0182b60257cdebab1696cc9d8ee
5
5
  SHA512:
6
- metadata.gz: 4c00db150a5a308c9dac71aacea0c8ac51bb12c37228841f36eff7c1a794d063f74ec8be0adf16bc591317881f0c87014f20c24e27c2d666c1ab0cd0c38058a2
7
- data.tar.gz: bd0789ad0ed58f2552d165ac66992ad3121934170557d7aa325cb0c428551d8a6b13536ed481ebb9dfee23ff7d350894f0d815e6e27ff866e633f9229ed142d5
6
+ metadata.gz: 8d332f2619cb712f97f6f7b104a615fa67d7baed80736580401d7966ef6a9901c60c88404f544cc77ec844af764bcf09efde3cf574304e510c27c8aef4075460
7
+ data.tar.gz: 111fcd196807c42afe7bddea2a8291499efca754aef0c0c8c876656a46ee485d736373af39b0de192df40d5a25ff455cab6de35130ea118bb21f2f0a8fee3eec
data/lib/jsonapi/utils.rb CHANGED
@@ -26,11 +26,11 @@ module JSONAPI
26
26
  end
27
27
 
28
28
  def jsonapi_render_internal_server_error
29
- Rails.env.development? || jsonapi_render_errors(::JSONAPI::Utils::Exceptions::InternalServerError.new)
29
+ jsonapi_render_errors(::JSONAPI::Utils::Exceptions::InternalServerError.new)
30
30
  end
31
31
 
32
32
  def jsonapi_render_bad_request
33
- Rails.env.development? || jsonapi_render_errors(::JSONAPI::Utils::Exceptions::BadRequest.new)
33
+ jsonapi_render_errors(::JSONAPI::Utils::Exceptions::BadRequest.new)
34
34
  end
35
35
 
36
36
  def jsonapi_render_not_found
@@ -105,10 +105,10 @@ module JSONAPI
105
105
  end
106
106
 
107
107
  def build_collection(records, options = {})
108
- return [] if records.nil? || records.empty?
109
- JSONAPI.configuration.default_paginator == :none ||
108
+ unless JSONAPI.configuration.default_paginator == :none
110
109
  records = paginator(@request.params).apply(records, nil)
111
- records.map { |record| turn_into_resource(record, options) }
110
+ end
111
+ records.respond_to?(:to_ary) ? records.map { |record| turn_into_resource(record, options) } : []
112
112
  end
113
113
 
114
114
  def turn_into_resource(record, options = {})
@@ -1,5 +1,5 @@
1
1
  module JSONAPI
2
2
  module Utils
3
- VERSION = '0.3.2'
3
+ VERSION = '0.3.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Guedes
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2015-11-05 00:00:00.000000000 Z
12
+ date: 2015-11-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler