rest_framework 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/rest_framework/controller_mixins/base.rb +6 -2
- data/lib/rest_framework/controller_mixins/models.rb +4 -6
- data/lib/rest_framework/generators/controller_generator.rb +1 -1
- data/lib/rest_framework/serializers.rb +1 -1
- data/lib/rest_framework.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz: '
|
3
|
+
metadata.gz: e303d3d1aae81be9cdf85affab8095f8cfe3115ba3beb0a22a7c6b8c9c91f17d
|
4
|
+
data.tar.gz: '058ae280bbe91f87b88ad4284bea00cbb914e577c56280e3c0c0d7f0c1e55126'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a831e67a8b0328f6ee80262543ddea4be439ac47b05a7615304728bc6ed708b3563ab3bd4c278a95d57b2e8bfb614e31a8b196649c3f0d51e55c14a0c1b7ced
|
7
|
+
data.tar.gz: 25d0b5ef65981c58dee75c168243c9f19dd8ae1c4acb86fbfa84ba80ca3794e6b5e88a392892a988070980b9f1c7b906e61fef9249e5d2f2c74ce70f5a467872
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.1
|
@@ -8,7 +8,7 @@ require_relative "../utils"
|
|
8
8
|
module RESTFramework::BaseControllerMixin
|
9
9
|
RRF_BASE_CONTROLLER_CONFIG = {
|
10
10
|
filter_pk_from_request_body: true,
|
11
|
-
exclude_body_fields: [:created_at, :created_by, :updated_at, :updated_by],
|
11
|
+
exclude_body_fields: [:created_at, :created_by, :updated_at, :updated_by].freeze,
|
12
12
|
accept_generic_params_as_body_params: false,
|
13
13
|
show_backtrace: false,
|
14
14
|
extra_actions: nil,
|
@@ -19,7 +19,7 @@ module RESTFramework::BaseControllerMixin
|
|
19
19
|
# Metadata and display options.
|
20
20
|
title: nil,
|
21
21
|
description: nil,
|
22
|
-
inflect_acronyms: ["ID", "REST", "API"],
|
22
|
+
inflect_acronyms: ["ID", "REST", "API"].freeze,
|
23
23
|
|
24
24
|
# Options related to serialization.
|
25
25
|
rescue_unknown_format_with: :json,
|
@@ -115,6 +115,7 @@ module RESTFramework::BaseControllerMixin
|
|
115
115
|
end
|
116
116
|
|
117
117
|
# Define any behavior to execute at the end of controller definition.
|
118
|
+
# :nocov:
|
118
119
|
def rrf_finalize
|
119
120
|
if RESTFramework.config.freeze_config
|
120
121
|
self::RRF_BASE_CONTROLLER_CONFIG.keys.each { |k|
|
@@ -123,6 +124,7 @@ module RESTFramework::BaseControllerMixin
|
|
123
124
|
}
|
124
125
|
end
|
125
126
|
end
|
127
|
+
# :nocov:
|
126
128
|
end
|
127
129
|
|
128
130
|
def self.included(base)
|
@@ -163,6 +165,7 @@ module RESTFramework::BaseControllerMixin
|
|
163
165
|
|
164
166
|
# Use `TracePoint` hook to automatically call `rrf_finalize`.
|
165
167
|
unless RESTFramework.config.disable_auto_finalize
|
168
|
+
# :nocov:
|
166
169
|
TracePoint.trace(:end) do |t|
|
167
170
|
next if base != t.self
|
168
171
|
|
@@ -172,6 +175,7 @@ module RESTFramework::BaseControllerMixin
|
|
172
175
|
# for performance.
|
173
176
|
t.disable
|
174
177
|
end
|
178
|
+
# :nocov:
|
175
179
|
end
|
176
180
|
end
|
177
181
|
|
@@ -44,7 +44,7 @@ module RESTFramework::BaseModelControllerMixin
|
|
44
44
|
}
|
45
45
|
|
46
46
|
module ClassMethods
|
47
|
-
IGNORE_VALIDATORS_WITH_KEYS = [:if, :unless]
|
47
|
+
IGNORE_VALIDATORS_WITH_KEYS = [:if, :unless].freeze
|
48
48
|
|
49
49
|
# Get the model for this controller.
|
50
50
|
def get_model(from_get_recordset: false)
|
@@ -162,11 +162,7 @@ module RESTFramework::BaseModelControllerMixin
|
|
162
162
|
|
163
163
|
# Get a hash of metadata to be rendered in the `OPTIONS` response. Cache the result.
|
164
164
|
def get_options_metadata(fields: nil)
|
165
|
-
return super().merge(
|
166
|
-
{
|
167
|
-
fields: self.get_fields_metadata(fields: fields),
|
168
|
-
},
|
169
|
-
)
|
165
|
+
return super().merge({fields: self.get_fields_metadata(fields: fields)})
|
170
166
|
end
|
171
167
|
|
172
168
|
def setup_delegation
|
@@ -204,6 +200,7 @@ module RESTFramework::BaseModelControllerMixin
|
|
204
200
|
end
|
205
201
|
|
206
202
|
# Define any behavior to execute at the end of controller definition.
|
203
|
+
# :nocov:
|
207
204
|
def rrf_finalize
|
208
205
|
super
|
209
206
|
self.setup_delegation
|
@@ -216,6 +213,7 @@ module RESTFramework::BaseModelControllerMixin
|
|
216
213
|
}
|
217
214
|
end
|
218
215
|
end
|
216
|
+
# :nocov:
|
219
217
|
end
|
220
218
|
|
221
219
|
def self.included(base)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "rails/generators"
|
2
2
|
|
3
3
|
# Most projects don't have the inflection "REST" as an acronym, so this is a helper class to prevent
|
4
|
-
# this generator from being namespaced
|
4
|
+
# this generator from being namespaced as `"r_e_s_t_framework"`.
|
5
5
|
# :nocov:
|
6
6
|
class RESTFrameworkCustomGeneratorControllerNamespace < String
|
7
7
|
def camelize
|
@@ -114,7 +114,7 @@ class RESTFramework::NativeSerializer < RESTFramework::BaseSerializer
|
|
114
114
|
return subcfg unless subcfg
|
115
115
|
|
116
116
|
if subcfg.is_a?(Array)
|
117
|
-
subcfg = subcfg.
|
117
|
+
subcfg = subcfg.map(&:to_sym)
|
118
118
|
|
119
119
|
if add
|
120
120
|
# Only add fields which are not already included.
|
data/lib/rest_framework.rb
CHANGED
@@ -7,7 +7,7 @@ module RESTFramework
|
|
7
7
|
BUILTIN_MEMBER_ACTIONS = {
|
8
8
|
show: :get,
|
9
9
|
edit: :get,
|
10
|
-
update: [:put, :patch],
|
10
|
+
update: [:put, :patch].freeze,
|
11
11
|
destroy: :delete,
|
12
12
|
}.freeze
|
13
13
|
RRF_BUILTIN_ACTIONS = {
|
@@ -24,7 +24,7 @@ module RESTFramework
|
|
24
24
|
# in:
|
25
25
|
# - Model delegation, for the helper methods to be defined dynamically.
|
26
26
|
# - Websockets, for `::Channel` class to be defined dynamically.
|
27
|
-
# - Controller configuration
|
27
|
+
# - Controller configuration finalization.
|
28
28
|
attr_accessor :disable_auto_finalize
|
29
29
|
|
30
30
|
# Freeze configuration attributes during finalization to prevent accidental mutation.
|
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.7.
|
4
|
+
version: 0.7.1
|
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:
|
11
|
+
date: 2023-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|