jsonapi_parameters 2.0.0 → 2.1.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 514048af1321f2eb0d1c17e260d8bfc0ce3dbf3b0d8c70fc91f42724fdc6a0c1
|
4
|
+
data.tar.gz: 46a52ac2fa28952b732d11479b9c1a2a3c2ff88bafd37816a920626b32ceda31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 406ea510828fb14bb8b4ba1298ad4a7f1c68a93391b8dce48a0e9132d8b7e05343febc0da9fd8f2e7aa8b6bb81f1a48a5cc23c51f01164d8d13e572b4f2b1c1e
|
7
|
+
data.tar.gz: b455719c009aae879edf3e457f34222cee455a3583ae9c1c58348f4784efafe92c1b2407732500a35d8f5da026bdce9dff5624482c90950a0d3a8d4430c48d81
|
data/README.md
CHANGED
@@ -99,7 +99,7 @@ This gems intention is to make input consumption as easy as possible. Hence, it
|
|
99
99
|
|
100
100
|
If you need custom relationship handling (for instance, if you have a relationship named `scissors` that is plural, but it actually is a single entity), you can use Handlers to define appropriate behaviour.
|
101
101
|
|
102
|
-
Read more at [Relationship Handlers]()
|
102
|
+
Read more at [Relationship Handlers](https://github.com/visualitypl/jsonapi_parameters/wiki/Relationship-handlers).
|
103
103
|
|
104
104
|
## License
|
105
105
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -5,6 +5,10 @@ module JsonApi
|
|
5
5
|
class BaseHandler
|
6
6
|
attr_reader :relationship_key, :relationship_value, :included
|
7
7
|
|
8
|
+
def self.call(key, val, included)
|
9
|
+
new(key, val, included).handle
|
10
|
+
end
|
11
|
+
|
8
12
|
def initialize(relationship_key, relationship_value, included)
|
9
13
|
@relationship_key = relationship_key
|
10
14
|
@relationship_value = relationship_value
|
@@ -8,9 +8,9 @@ module JsonApi
|
|
8
8
|
include DefaultHandlers
|
9
9
|
|
10
10
|
DEFAULT_HANDLER_SET = {
|
11
|
-
to_many:
|
12
|
-
to_one:
|
13
|
-
nil:
|
11
|
+
to_many: ToManyRelationHandler,
|
12
|
+
to_one: ToOneRelationHandler,
|
13
|
+
nil: NilRelationHandler
|
14
14
|
}.freeze
|
15
15
|
|
16
16
|
module_function
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonapi_parameters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Visuality
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-06-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -348,7 +348,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
348
348
|
- !ruby/object:Gem::Version
|
349
349
|
version: '0'
|
350
350
|
requirements: []
|
351
|
-
rubygems_version: 3.
|
351
|
+
rubygems_version: 3.0.3
|
352
352
|
signing_key:
|
353
353
|
specification_version: 4
|
354
354
|
summary: Translator for JSON:API compliant parameters
|