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: 9aca65b830eaec807d91221b0b82d12cce8df503915512b17e26d37a3f9945cb
4
- data.tar.gz: b18eb03accd6f595ee301e7486e445d21ec7c866625e545ccb61e9566847b7e5
3
+ metadata.gz: 514048af1321f2eb0d1c17e260d8bfc0ce3dbf3b0d8c70fc91f42724fdc6a0c1
4
+ data.tar.gz: 46a52ac2fa28952b732d11479b9c1a2a3c2ff88bafd37816a920626b32ceda31
5
5
  SHA512:
6
- metadata.gz: c3b405a23fabb82bc42eaaa41e5f4c4d5795887edd50816d5277353f811548bf46cf2e87fc484c1c7e219bbc382f8fb840f903c98f862c63eb2b03f07bba79f9
7
- data.tar.gz: d799eed1c456e6d7fea72e6dad315745e4d21509dba432d7428c886af2e1d6083ee883000ee5852b28ff5e4951b39e8274b8adcc4dc37575c9b32bee0e48d69b
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: ->(k, v, included) { ToManyRelationHandler.new(k, v, included).handle },
12
- to_one: ->(k, v, included) { ToOneRelationHandler.new(k, v, included).handle },
13
- nil: ->(k, v, included) { NilRelationHandler.new(k, v, included).handle }
11
+ to_many: ToManyRelationHandler,
12
+ to_one: ToOneRelationHandler,
13
+ nil: NilRelationHandler
14
14
  }.freeze
15
15
 
16
16
  module_function
@@ -1,5 +1,5 @@
1
1
  module JsonApi
2
2
  module Parameters
3
- VERSION = '2.0.0'.freeze
3
+ VERSION = '2.1.0'.freeze
4
4
  end
5
5
  end
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.0.0
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-02-07 00:00:00.000000000 Z
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.1.2
351
+ rubygems_version: 3.0.3
352
352
  signing_key:
353
353
  specification_version: 4
354
354
  summary: Translator for JSON:API compliant parameters