jsonapi_swagger_helpers 0.6.4 → 0.6.5

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: 120127d5171433f69fb65d417989dc398c21741b
4
- data.tar.gz: 06017e09e6276039f7707fb0e79a7991038ebb99
3
+ metadata.gz: df82077581309352a2aac2838725a9ac6d36664a
4
+ data.tar.gz: 337282b88acbc947b67d09e2dc0f87c8001cd352
5
5
  SHA512:
6
- metadata.gz: 63d037d7b0d6b6b1f9b1397503eab836e3ddce5d29e556703cabfc1cd2d2a3dc38251459af9f32635e2583b6cf362bd379c591754d37755fcf27bc4209a5ee8d
7
- data.tar.gz: 0bb06960deed1908866deda9e5d0f543cb9ea7f1f23628b7b54fa398970d802d896bb0d9382dc675b03575599f816069795f4f64022425c8e22937f3ca45e3e8
6
+ metadata.gz: 7477c233457be2905aa7678bd72f1387632c6f72dc452db22670d362133bbae09e64e5f4113c3dab4bfe8a24fbe0855cf2da1bdef4bdac0b89f38ba3af5f91e3
7
+ data.tar.gz: 3f7707312f965a29a1872d7afa437cdc61498ac58d3fe35ec841f859fc755e1204f303d4b8e4f292f7eb2fae15600a6b9693238189f40a1be938818aebd06def
@@ -6,7 +6,6 @@ module JsonapiSwaggerHelpers
6
6
  klass.class_eval do
7
7
  attr_reader :node,
8
8
  :controller,
9
- :resource,
10
9
  :description,
11
10
  :tags,
12
11
  :singular
@@ -16,12 +15,19 @@ module JsonapiSwaggerHelpers
16
15
  def initialize(node, controller, description: nil, tags: [], singular: false)
17
16
  @node = node
18
17
  @controller = controller
19
- @resource = controller._jsonapi_compliable
20
18
  @description = description || default_description
21
19
  @tags = tags
22
20
  @singular = singular
23
21
  end
24
22
 
23
+ def resource
24
+ @resource = controller._jsonapi_compliable
25
+ if @resource.is_a?(Hash)
26
+ @resource = @resource[action_name]
27
+ end
28
+ @resource
29
+ end
30
+
25
31
  def default_description
26
32
  "#{action_name.capitalize} Action"
27
33
  end
@@ -71,6 +71,7 @@ module JsonapiSwaggerHelpers
71
71
 
72
72
  def self.include_directive_for(controller, action)
73
73
  resource_class = controller._jsonapi_compliable
74
+ resource_class = resource_class[action] if resource_class.is_a?(Hash)
74
75
 
75
76
  includes = sideload_hash(resource_class.sideloading)[:base]
76
77
  whitelist = controller._sideload_whitelist
@@ -1,3 +1,3 @@
1
1
  module JsonapiSwaggerHelpers
2
- VERSION = "0.6.4"
2
+ VERSION = "0.6.5"
3
3
  end
@@ -6,7 +6,6 @@ module JsonapiSwaggerHelpers
6
6
  klass.class_eval do
7
7
  attr_reader :node,
8
8
  :controller,
9
- :resource,
10
9
  :description,
11
10
  :tags,
12
11
  :singular
@@ -22,6 +21,14 @@ module JsonapiSwaggerHelpers
22
21
  @singular = singular
23
22
  end
24
23
 
24
+ def resource
25
+ @resource = controller._jsonapi_compliable
26
+ if @resource.is_a?(Hash)
27
+ @resource = @resource[action_name]
28
+ end
29
+ @resource
30
+ end
31
+
25
32
  def util
26
33
  JsonapiSwaggerHelpers::Util
27
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi_swagger_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Richmond
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-24 00:00:00.000000000 Z
11
+ date: 2018-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: swagger-blocks