model_driven_api 2.4.4 → 2.5.1
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73cfe08fc31b7f30f5fa957336815aac4a3e50ecc087d112e229788726544367
|
4
|
+
data.tar.gz: 94627de57118c1469e0831c4bd76f6f777ead4f75954108dc27578d1754e6cff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1563f942781fa8f6f42421b6140cc2696b3e54be822413309d4b56e7435295398347b09c3ad86e81a5ade4ba018a1e9ecc4d9e430a3101e540b1d805f013e36
|
7
|
+
data.tar.gz: 31314a903fbd5d88e31954d3303c0602e9d697532e6d723fe9ee1d7a4910137b574c6a30ea11c7d0e54a7505c7af6aa718cb0ebb4957bd32a089e4715c651dd1
|
@@ -16,8 +16,8 @@ class Api::V2::ApplicationController < ActionController::API
|
|
16
16
|
authorize! :index, @model
|
17
17
|
|
18
18
|
# Custom Action
|
19
|
-
status, result = check_for_custom_action
|
20
|
-
return render json: result, status: 200 if status == true
|
19
|
+
status, result, status_number = check_for_custom_action
|
20
|
+
return render json: result, status: (status_number.presence || 200) if status == true
|
21
21
|
|
22
22
|
# Normal Index Action with Ransack querying
|
23
23
|
# Keeping this automation can be too dangerous and lead to unpredicted results
|
@@ -52,8 +52,8 @@ class Api::V2::ApplicationController < ActionController::API
|
|
52
52
|
authorize! :show, @record_id
|
53
53
|
|
54
54
|
# Custom Show Action
|
55
|
-
status, result = check_for_custom_action
|
56
|
-
return render json: result, status: 200 if status == true
|
55
|
+
status, result, status_number = check_for_custom_action
|
56
|
+
return render json: result, status: (status_number.presence || 200) if status == true
|
57
57
|
|
58
58
|
# Normal Show
|
59
59
|
result = @record.to_json(json_attrs)
|
@@ -65,8 +65,8 @@ class Api::V2::ApplicationController < ActionController::API
|
|
65
65
|
authorize! :create, @record
|
66
66
|
|
67
67
|
# Custom Action
|
68
|
-
status, result = check_for_custom_action
|
69
|
-
return render json: result, status: 200 if status == true
|
68
|
+
status, result, status_number = check_for_custom_action
|
69
|
+
return render json: result, status: (status_number.presence || 200) if status == true
|
70
70
|
|
71
71
|
# Normal Create Action
|
72
72
|
# Keeping this automation can be too dangerous and lead to unpredicted results
|
@@ -80,8 +80,8 @@ class Api::V2::ApplicationController < ActionController::API
|
|
80
80
|
authorize! :update, @record
|
81
81
|
|
82
82
|
# Custom Action
|
83
|
-
status, result = check_for_custom_action
|
84
|
-
return render json: result, status: 200 if status == true
|
83
|
+
status, result, status_number = check_for_custom_action
|
84
|
+
return render json: result, status: (status_number.presence || 200) if status == true
|
85
85
|
|
86
86
|
# Normal Update Action
|
87
87
|
# Raisl 6 vs Rails 6.1
|
@@ -93,8 +93,8 @@ class Api::V2::ApplicationController < ActionController::API
|
|
93
93
|
authorize! :destroy, @record
|
94
94
|
|
95
95
|
# Custom Action
|
96
|
-
status, result = check_for_custom_action
|
97
|
-
return render json: result, status: 200 if status == true
|
96
|
+
status, result, status_number = check_for_custom_action
|
97
|
+
return render json: result, status: (status_number.presence || 200) if status == true
|
98
98
|
|
99
99
|
# Normal Destroy Action
|
100
100
|
return api_error(status: 500) unless @record.destroy
|
@@ -114,8 +114,9 @@ class Api::V2::ApplicationController < ActionController::API
|
|
114
114
|
resource = "custom_action_#{params[:do]}"
|
115
115
|
raise NoMethodError unless @model.respond_to?(resource)
|
116
116
|
# return true, MultiJson.dump(params[:id].blank? ? @model.send(resource, params) : @model.send(resource, params[:id].to_i, params))
|
117
|
-
puts json_attrs
|
118
|
-
|
117
|
+
# puts json_attrs
|
118
|
+
body, status = @model.send(resource, params)
|
119
|
+
return true, body.to_json(json_attrs), status
|
119
120
|
end
|
120
121
|
# if it's here there is no custom action in the request querystring
|
121
122
|
return false
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'model_driven_api/version'
|
1
|
+
# require 'model_driven_api/version'
|
2
2
|
class Api::V2::InfoController < Api::V2::ApplicationController
|
3
3
|
# Info uses a different auth method: username and password
|
4
4
|
skip_before_action :authenticate_request, only: [:version], raise: false
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: model_driven_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriele Tassoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thecore_backend_commons
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.4'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: jwt
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|