model_driven_api 3.1.8 → 3.1.9

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: dcceec80f10a8a7bc91a9f8f32982f6d632f8af71936e8333ffe2f47308da2f7
4
- data.tar.gz: e6b1f3833363f78ff5884a25ac986fb47e44e322193b65e3fc90494de2ab08dd
3
+ metadata.gz: 94b18a1b177632591c520596c5b8443da17b84937c934b450550512355d4690d
4
+ data.tar.gz: 8992f753df4957e584a303989130f48ef63346f9adff290f72140bc2f7df14f7
5
5
  SHA512:
6
- metadata.gz: 8675f05d7145638a141e358fac87bb481318f2ea868817ea578d1400e6600291bdbc1d21691277f9c11f2c498be9e2659d724d0e3038f23c706b4a5ef8a81528
7
- data.tar.gz: c1bd46b4cd97f04f50ddef90b3394f4ffce98348f8f73f8e05ac30259c0c16319b785ceeb5f77fb17aa0bbb55ae374009d65eaae7dc1e9e860f06ee7e0ec3565
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
- "post": {
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
@@ -1,2 +1,6 @@
1
1
  class TestApi
2
+ # Initialize the class with the request params
3
+ def initialize params
4
+ @params = params
5
+ end
2
6
  end
@@ -1,3 +1,3 @@
1
1
  module ModelDrivenApi
2
- VERSION = "3.1.8".freeze
2
+ VERSION = "3.1.9".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: model_driven_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.8
4
+ version: 3.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni