jsonapi-utils 0.5.0.beta2 → 0.5.0.beta3

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: 96d7f50884d79e1dbb367adf611cb2f52d7ebf27
4
- data.tar.gz: 67b77e50094f0a223c4bb1220108fcd8f890dcb6
3
+ metadata.gz: 225d9ad9397e535223a79d573a70ca24ad2c17ef
4
+ data.tar.gz: 4766857ebe6f45ee342bcc183e4f0c03f818d350
5
5
  SHA512:
6
- metadata.gz: 06fe4857feebe4f2fda0419c6b83cb5d85335f069c63e997d5c63746b989dcd251360f765d60047e525d97a15dac0c0ab41f78f7b131f3353299251598e804c0
7
- data.tar.gz: e024c8a81831e7a329fb001f676cf24dbec54488514700788bc13a90eb41f0e0c925c629eff0ca09e07e47e8534a1731c7346195e8e526c453eaf523e712756d
6
+ metadata.gz: 284025ede1150c9ed29c9ca898395f7eda49a101b6e9f558d6176e1e79a6cead51d8d1a352127ea47356a33d6a3880fddd3928663b8220e6a406af6e03e04d33
7
+ data.tar.gz: e36c756d5ce31f716d3dfe1da622cea3934dba99468a9e293f2fcdeb1f6dc520377cce5754e033ad123c28d32f9d2b0ec1e1546bb810d55a593abd60fc8c5557
data/README.md CHANGED
@@ -14,7 +14,7 @@ Simple yet powerful way to get your Rails API compliant with [JSON API](http://j
14
14
  * [How does it work?](#how-does-it-work)
15
15
  * [Usage](#usage)
16
16
  * [Response](#response)
17
- * [Rendes](#renders)
17
+ * [Renders](#renders)
18
18
  * [Formatters](#formatters)
19
19
  * [Request](#request)
20
20
  * [Params helpers](#params-helpers)
@@ -139,7 +139,7 @@ It takes arguments and generates a JSON API-compliant error response.
139
139
  ```
140
140
 
141
141
  Arguments:
142
- - Exception
142
+ - Exception
143
143
  - `json`: object to be rendered as a JSON document: ActiveRecord, Exception, Array of Hashes or any object which implements the `errors` method;
144
144
  - `status`: HTTP status code (Integer or Symbol). If ommited a status code will be automatically infered from the error body.
145
145
 
@@ -759,7 +759,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
759
759
 
760
760
  ## Contributing
761
761
 
762
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/jsonapi-utils. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
762
+ Bug reports and pull requests are welcome on GitHub at https://github.com/tiagopog/jsonapi-utils. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](https://contributor-covenant.org) code of conduct.
763
763
 
764
764
 
765
765
  ## License
data/lib/jsonapi/utils.rb CHANGED
@@ -4,7 +4,6 @@ require 'jsonapi/utils/exceptions'
4
4
  require 'jsonapi/utils/request'
5
5
  require 'jsonapi/utils/response'
6
6
  require 'jsonapi/utils/support/filter/custom'
7
- require 'piped_ruby'
8
7
 
9
8
  JSONAPI::Resource.extend JSONAPI::Utils::Support::Filter::Custom
10
9
 
@@ -57,11 +57,10 @@ module JSONAPI
57
57
  end
58
58
 
59
59
  def build_collection(records, options = {})
60
- -> { apply_filter(records, options) }
61
- .>> { |filtered| apply_pagination(filtered, options) }
62
- .>> { |paginated| apply_sort(paginated) }
63
- .>> { |result| result.map { |record| turn_into_resource(record, options) } }
64
- .unwrap
60
+ records = apply_filter(records, options)
61
+ records = apply_pagination(records, options)
62
+ records = apply_sort(records)
63
+ records.respond_to?(:to_ary) ? records.map { |record| turn_into_resource(record, options) } : []
65
64
  end
66
65
 
67
66
  def turn_into_resource(record, options = {})
@@ -1,5 +1,5 @@
1
1
  module JSONAPI
2
2
  module Utils
3
- VERSION = '0.5.0.beta2'.freeze
3
+ VERSION = '0.5.0.beta3'.freeze
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.5.0.beta2
4
+ version: 0.5.0.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Guedes
@@ -9,36 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-09-13 00:00:00.000000000 Z
12
+ date: 2016-09-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jsonapi-resources
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '='
19
- - !ruby/object:Gem::Version
20
- version: 0.8.0.beta2
21
- type: :runtime
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - '='
26
- - !ruby/object:Gem::Version
27
- version: 0.8.0.beta2
28
- - !ruby/object:Gem::Dependency
29
- name: piped_ruby
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - '='
18
+ - - ~>
33
19
  - !ruby/object:Gem::Version
34
- version: 0.2.1
20
+ version: 0.8.0
35
21
  type: :runtime
36
22
  prerelease: false
37
23
  version_requirements: !ruby/object:Gem::Requirement
38
24
  requirements:
39
- - - '='
25
+ - - ~>
40
26
  - !ruby/object:Gem::Version
41
- version: 0.2.1
27
+ version: 0.8.0
42
28
  - !ruby/object:Gem::Dependency
43
29
  name: bundler
44
30
  requirement: !ruby/object:Gem::Requirement