Class: Swagger::Api::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, #responses, #success_response

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



19
20
21
22
23
# File 'lib/swagger/api/operations/create.rb', line 19

def error_responses
  super.reject do |error_response|
    error_response.keys.first == '404'
  end
end

#request_bodyObject



13
14
15
16
17
# File 'lib/swagger/api/operations/create.rb', line 13

def request_body
  {
    "$ref" => "#/components/requestBodies/#{model_name}"
  }
end