rest_framework 0.8.1 → 0.8.2

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: 2fa5466e302bc512ac4dc91b6f79c504bfcc88102be9282be9f55f33bad9a475
4
+ data.tar.gz: f940e69f12a56fc29ca69e10f81a33a5239bbbd8098966af308f2d4e7e2e1cbf
5
5
  SHA512:
6
- metadata.gz: fdcd6eb5262ffcbcf91692389ce78d0560b9d3e2479eabd00ab296707500a3b2611ec733a085c12df363d31f4d41421ac87a102d365810a04db9973276810b6b
7
- data.tar.gz: 37504ff11623057cc5b1c7e5bfdc0c688ca95964c72a312fd5adeb71fc7cb11acd0937b3a4f6186d8b0c71b5730cbff521dd098f9689c9e6718b6c5628f9edc0
6
+ metadata.gz: 1089f785c9003daecb5c416f9122996526f585dd86639efd626bc90760f94d1c6c02eea72cb0c8cf3af67bd68feba9c1f520c8fce85827dec70ab22489b982c2
7
+ data.tar.gz: 833cbaf0e4ca413b0b96faa60eea950188764deebe6035501b2f28da1642aa173b442c13b89042d3c40fe4577651c1450b3a53ae240b99c9d3dd7321b139284f
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.1
1
+ 0.8.2
@@ -297,7 +297,7 @@ module RESTFramework::BaseModelControllerMixin
297
297
  def setup_delegation
298
298
  # Delegate extra actions.
299
299
  self.extra_actions&.each do |action, config|
300
- next unless config.is_a?(Hash) && config[:delegate]
300
+ next unless config.is_a?(Hash) && config.dig(:metadata, :delegate)
301
301
  next unless self.get_model.respond_to?(action)
302
302
 
303
303
  self.define_method(action) do
@@ -313,7 +313,7 @@ module RESTFramework::BaseModelControllerMixin
313
313
 
314
314
  # Delegate extra member actions.
315
315
  self.extra_member_actions&.each do |action, config|
316
- next unless config.is_a?(Hash) && config[:delegate]
316
+ next unless config.is_a?(Hash) && config.dig(:metadata, :delegate)
317
317
  next unless self.get_model.method_defined?(action)
318
318
 
319
319
  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.2
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-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails