rest_framework 1.1.0 → 2.0.0.beta1
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 +4 -4
- data/README.md +107 -41
- data/VERSION +1 -1
- data/app/views/rest_framework/routes_and_forms/_html_form.html.erb +1 -1
- data/lib/rest_framework/controller/actions.rb +256 -0
- data/lib/rest_framework/controller/bulk.rb +247 -32
- data/lib/rest_framework/controller/crud.rb +13 -9
- data/lib/rest_framework/controller/openapi.rb +12 -8
- data/lib/rest_framework/controller.rb +275 -164
- data/lib/rest_framework/errors.rb +70 -3
- data/lib/rest_framework/filters/base_filter.rb +10 -0
- data/lib/rest_framework/filters/ordering_filter.rb +41 -23
- data/lib/rest_framework/filters/query_filter.rb +24 -5
- data/lib/rest_framework/filters/search_filter.rb +8 -4
- data/lib/rest_framework/paginators/page_number_paginator.rb +34 -19
- data/lib/rest_framework/routers.rb +52 -182
- data/lib/rest_framework/serializers/active_model_serializer_adapter_factory.rb +2 -2
- data/lib/rest_framework/serializers/base_serializer.rb +2 -2
- data/lib/rest_framework/serializers/native_serializer.rb +78 -24
- data/lib/rest_framework/utils.rb +39 -70
- data/lib/rest_framework/version.rb +8 -5
- data/lib/rest_framework.rb +7 -41
- metadata +5 -12
- data/lib/rest_framework/errors/base_error.rb +0 -5
- data/lib/rest_framework/errors/nil_passed_to_render_api_error.rb +0 -14
- data/lib/rest_framework/generators/controller_generator.rb +0 -64
- data/lib/rest_framework/generators.rb +0 -4
- data/lib/rest_framework/mixins/base_controller_mixin.rb +0 -12
- data/lib/rest_framework/mixins/bulk_model_controller_mixin.rb +0 -55
- data/lib/rest_framework/mixins/model_controller_mixin.rb +0 -110
- data/lib/rest_framework/mixins.rb +0 -7
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
module RESTFramework::Mixins::BaseModelControllerMixin
|
|
2
|
-
def self.included(base)
|
|
3
|
-
RESTFramework.deprecator.warn(<<~TXT).squish
|
|
4
|
-
BaseModelControllerMixin is deprecated; use RESTFramework::Controller and set the `model` and
|
|
5
|
-
`excluded_actions` class attributes instead.
|
|
6
|
-
TXT
|
|
7
|
-
|
|
8
|
-
base.include(RESTFramework::Controller)
|
|
9
|
-
base.model = RESTFramework::Utils.get_model(base)
|
|
10
|
-
base.excluded_actions = [
|
|
11
|
-
:index, :show, :create, :update, :destroy, :update_all, :destroy_all
|
|
12
|
-
].freeze
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
module RESTFramework::Mixins::ListModelMixin
|
|
17
|
-
def self.included(base)
|
|
18
|
-
RESTFramework.deprecator.warn(
|
|
19
|
-
"ListModelMixin is deprecated; set the `excluded_actions` class attribute instead.",
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
if base.excluded_actions
|
|
23
|
-
base.excluded_actions = (base.excluded_actions - [ :index ]).freeze
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
module RESTFramework::Mixins::ShowModelMixin
|
|
29
|
-
def self.included(base)
|
|
30
|
-
RESTFramework.deprecator.warn(
|
|
31
|
-
"ShowModelMixin is deprecated; set the `excluded_actions` class attribute instead.",
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
if base.excluded_actions
|
|
35
|
-
base.excluded_actions = (base.excluded_actions - [ :show ]).freeze
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
module RESTFramework::Mixins::CreateModelMixin
|
|
41
|
-
def self.included(base)
|
|
42
|
-
RESTFramework.deprecator.warn(
|
|
43
|
-
"CreateModelMixin is deprecated; set the `excluded_actions` class attribute instead.",
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
if base.excluded_actions
|
|
47
|
-
base.excluded_actions = (base.excluded_actions - [ :create ]).freeze
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
module RESTFramework::Mixins::UpdateModelMixin
|
|
53
|
-
def self.included(base)
|
|
54
|
-
RESTFramework.deprecator.warn(
|
|
55
|
-
"UpdateModelMixin is deprecated; set the `excluded_actions` class attribute instead.",
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
if base.excluded_actions
|
|
59
|
-
base.excluded_actions = (base.excluded_actions - [ :update ]).freeze
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
module RESTFramework::Mixins::DestroyModelMixin
|
|
65
|
-
def self.included(base)
|
|
66
|
-
RESTFramework.deprecator.warn(
|
|
67
|
-
"DestroyModelMixin is deprecated; set the `excluded_actions` class attribute instead.",
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
if base.excluded_actions
|
|
71
|
-
base.excluded_actions = (base.excluded_actions - [ :destroy ]).freeze
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
module RESTFramework::Mixins::ReadOnlyModelControllerMixin
|
|
77
|
-
def self.included(base)
|
|
78
|
-
RESTFramework.deprecator.warn(<<~TXT).squish
|
|
79
|
-
ReadOnlyModelControllerMixin is deprecated; use RESTFramework::Controller and set the `model`
|
|
80
|
-
and `excluded_actions` class attributes instead.
|
|
81
|
-
TXT
|
|
82
|
-
|
|
83
|
-
base.include(RESTFramework::Controller)
|
|
84
|
-
base.model = RESTFramework::Utils.get_model(base)
|
|
85
|
-
base.excluded_actions = [ :create, :update, :destroy, :update_all, :destroy_all ].freeze
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
module RESTFramework::Mixins::ModelControllerMixin
|
|
90
|
-
def self.included(base)
|
|
91
|
-
RESTFramework.deprecator.warn(<<~TXT).squish
|
|
92
|
-
ModelControllerMixin is deprecated; use RESTFramework::Controller and set the `model` class
|
|
93
|
-
attribute instead.
|
|
94
|
-
TXT
|
|
95
|
-
|
|
96
|
-
base.include(RESTFramework::Controller)
|
|
97
|
-
base.model = RESTFramework::Utils.get_model(base)
|
|
98
|
-
base.excluded_actions = nil
|
|
99
|
-
end
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
# Aliases for convenience.
|
|
103
|
-
RESTFramework::BaseModelControllerMixin = RESTFramework::Mixins::BaseModelControllerMixin
|
|
104
|
-
RESTFramework::ListModelMixin = RESTFramework::Mixins::ListModelMixin
|
|
105
|
-
RESTFramework::ShowModelMixin = RESTFramework::Mixins::ShowModelMixin
|
|
106
|
-
RESTFramework::CreateModelMixin = RESTFramework::Mixins::CreateModelMixin
|
|
107
|
-
RESTFramework::UpdateModelMixin = RESTFramework::Mixins::UpdateModelMixin
|
|
108
|
-
RESTFramework::DestroyModelMixin = RESTFramework::Mixins::DestroyModelMixin
|
|
109
|
-
RESTFramework::ReadOnlyModelControllerMixin = RESTFramework::Mixins::ReadOnlyModelControllerMixin
|
|
110
|
-
RESTFramework::ModelControllerMixin = RESTFramework::Mixins::ModelControllerMixin
|