rest_framework 0.8.1 → 0.8.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99cd96572042191fde2bb7fa5b004ac07e193c103c8c18342ea3fed3f50e1be7
4
- data.tar.gz: 2276cedd0fc4b205e0c253df36dbba2a45fcf889e81a214dcda2d435cc690ff7
3
+ metadata.gz: 4a54e0539466e7981ab8ba95a1877ad705b46279309c1d3bfd2cfd038e916b2b
4
+ data.tar.gz: c26e553c6b4b5435545ffb5fa71c59720f42303347b35336077c764b00fd889d
5
5
  SHA512:
6
- metadata.gz: fdcd6eb5262ffcbcf91692389ce78d0560b9d3e2479eabd00ab296707500a3b2611ec733a085c12df363d31f4d41421ac87a102d365810a04db9973276810b6b
7
- data.tar.gz: 37504ff11623057cc5b1c7e5bfdc0c688ca95964c72a312fd5adeb71fc7cb11acd0937b3a4f6186d8b0c71b5730cbff521dd098f9689c9e6718b6c5628f9edc0
6
+ metadata.gz: 79a80f7d7b3ab044203b612fc8ed453c3a7490a17e9e53adb8386719b9d6944838e78ce343d3596ac8c370cc6dc122d2ede66ec2afce7ffaa9dc635ed23146ad
7
+ data.tar.gz: 2943c3779a404ff67f64f6c38001c9de828f3f536c79da1663b02dad0f4c6b20fa36fcd0e4310cbffda48dc4db6c329d09c5e7c48d93e62dc53a157b86e75eef
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.1
1
+ 0.8.3
@@ -290,6 +290,7 @@ module RESTFramework::BaseModelControllerMixin
290
290
  return super().merge(
291
291
  {
292
292
  fields: self.get_fields_metadata,
293
+ callbacks: self._process_action_callbacks.as_json,
293
294
  },
294
295
  )
295
296
  end
@@ -297,7 +298,7 @@ module RESTFramework::BaseModelControllerMixin
297
298
  def setup_delegation
298
299
  # Delegate extra actions.
299
300
  self.extra_actions&.each do |action, config|
300
- next unless config.is_a?(Hash) && config[:delegate]
301
+ next unless config.is_a?(Hash) && config.dig(:metadata, :delegate)
301
302
  next unless self.get_model.respond_to?(action)
302
303
 
303
304
  self.define_method(action) do
@@ -313,7 +314,7 @@ module RESTFramework::BaseModelControllerMixin
313
314
 
314
315
  # Delegate extra member actions.
315
316
  self.extra_member_actions&.each do |action, config|
316
- next unless config.is_a?(Hash) && config[:delegate]
317
+ next unless config.is_a?(Hash) && config.dig(:metadata, :delegate)
317
318
  next unless self.get_model.method_defined?(action)
318
319
 
319
320
  self.define_method(action) do
@@ -16,15 +16,14 @@ module RESTFramework::Utils
16
16
  v = v.symbolize_keys
17
17
  methods = v.delete(:methods)
18
18
 
19
- # First, remove any metadata keys.
20
- delegate = v.delete(:delegate)
21
- fields = v.delete(:fields)
19
+ # First, remove the route metadata.
20
+ metadata = v.delete(:metadata) || {}
22
21
 
23
22
  # Add label to fields.
24
- if controller && fields
25
- fields = fields.map { |f| [f, {}] }.to_h if f.is_a?(Array)
26
- fields&.each do |field, cfg|
27
- cfg[:label] = controller.get_label(field)
23
+ if controller && metadata[:fields]
24
+ metadata[:fields] = metadata[:fields].map { |f| [f, {}] }.to_h if f.is_a?(Array)
25
+ metadata[:fields]&.each do |field, cfg|
26
+ cfg[:label] = controller.get_label(field) unless cfg[:label]
28
27
  end
29
28
  end
30
29
 
@@ -47,8 +46,7 @@ module RESTFramework::Utils
47
46
  path: path,
48
47
  methods: methods,
49
48
  kwargs: kwargs,
50
- delegate: delegate,
51
- fields: fields,
49
+ metadata: metadata.presence,
52
50
  type: :extra,
53
51
  }.compact,
54
52
  ]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest_framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory N. Schmit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-23 00:00:00.000000000 Z
11
+ date: 2023-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails