jsonapi-utils 0.5.0.beta2 → 0.5.0.beta3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/jsonapi/utils.rb +0 -1
- data/lib/jsonapi/utils/response/formatters.rb +4 -5
- data/lib/jsonapi/utils/version.rb +1 -1
- metadata +6 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 225d9ad9397e535223a79d573a70ca24ad2c17ef
|
4
|
+
data.tar.gz: 4766857ebe6f45ee342bcc183e4f0c03f818d350
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
* [
|
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/
|
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
@@ -57,11 +57,10 @@ module JSONAPI
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def build_collection(records, options = {})
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
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 = {})
|
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.
|
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-
|
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.
|
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.
|
27
|
+
version: 0.8.0
|
42
28
|
- !ruby/object:Gem::Dependency
|
43
29
|
name: bundler
|
44
30
|
requirement: !ruby/object:Gem::Requirement
|