model_driven_api 3.1.8 → 3.1.9
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94b18a1b177632591c520596c5b8443da17b84937c934b450550512355d4690d
|
4
|
+
data.tar.gz: 8992f753df4957e584a303989130f48ef63346f9adff290f72140bc2f7df14f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be09d8af6479897b60e760e1d8a1096804acca2a881a9dba302af39a701eeeba3e801ca09bd25caadcdc3a4ae20d8ea0280e9e70458331ea2a53d6a7bbba55b0
|
7
|
+
data.tar.gz: a49c63942e572826abe3e6176bca618589993da59957d012a34db8b49acd4550102b0fb8987a8a602faf20be56363ace53c53fe1496feb97316cd7796edf736d
|
@@ -521,7 +521,7 @@ class Api::V2::InfoController < Api::V2::ApplicationController
|
|
521
521
|
custom_actions.each do |action|
|
522
522
|
custom_action_name = action.to_s.gsub("custom_action_", "")
|
523
523
|
pivot["/#{model}/custom_action/#{custom_action_name}"] = {
|
524
|
-
"
|
524
|
+
"get": {
|
525
525
|
"summary": "Custom Action #{custom_action_name.titleize}",
|
526
526
|
"description": "This is just an example of a custom action, they can accept a wide range of payloads and response with a wide range of responses, also all verbs are valid. Please refer to the documentation for more information.",
|
527
527
|
"tags": [model.classify],
|
@@ -1,5 +1,23 @@
|
|
1
1
|
module Endpoints::TestApi
|
2
2
|
def self.test params
|
3
|
+
# Define an explain var to be used to validate and document the action behavior when using ?explain=true in query string
|
4
|
+
explain = {
|
5
|
+
verbs: ["GET"],
|
6
|
+
body: {},
|
7
|
+
query: {},
|
8
|
+
responses: {
|
9
|
+
200 => {
|
10
|
+
message: :string,
|
11
|
+
params: {}
|
12
|
+
},
|
13
|
+
501 => {
|
14
|
+
error: :string
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
return explain, 200 if params[:explain] == "true"
|
20
|
+
return { error: "This method responds only to #{explain[:verbs].join(", ")} requests" }, 501 if explain[:verbs].exclude? params[:request_verb]
|
3
21
|
return { message: "Hello World From Test API Custom Action called test", params: params }, 200
|
4
22
|
end
|
5
|
-
end
|
23
|
+
end
|
data/app/models/test_api.rb
CHANGED