Class: SwaggerApi::Operations::Create

Inherits:
Base
  • Object
show all
Defined in:
lib/swagger_api/operations/create.rb

Instance Attribute Summary

Attributes inherited from Base

#action, #controller

Instance Method Summary collapse

Methods inherited from Base

#model, #model_name, #parameters, #readable_action, #request_body, #responses

Instance Method Details

#createObject



6
7
8
9
10
11
# File 'lib/swagger_api/operations/create.rb', line 6

def create
  create = super
  create[:requestBody] = request_body
  create.delete(:parameters)
  create
end

#error_responsesObject



28
29
30
31
32
# File 'lib/swagger_api/operations/create.rb', line 28

def error_responses
  super.reject do |error_response|
    %w[404].include?(error_response.keys.first)
  end
end

#success_responseObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/swagger_api/operations/create.rb', line 13

def success_response
  {
    '303' => {
      description: "#{readable_action} #{model_name.downcase}'s information",
      headers: {
        Location: {
          schema: {
            type: :string
          }
        }
      }
    }
  }
end