Class: ApiCanon::Swagger::ApiDeclaration::Api::Operation

Inherits:
ActiveModel::Serializer
  • Object
show all
Defined in:
lib/api_canon/swagger/api_declaration.rb

Defined Under Namespace

Classes: Parameter

Instance Method Summary collapse

Instance Method Details

#error_responsesObject



69
70
71
72
73
# File 'lib/api_canon/swagger/api_declaration.rb', line 69

def error_responses
  object.response_codes.collect do |code, reason|
    { :code => code, :reason => reason }
  end
end

#nicknameObject



56
57
58
59
60
61
62
63
# File 'lib/api_canon/swagger/api_declaration.rb', line 56

def nickname
  [
    Rails.application.class.parent_name,
    object.controller_name,
    object.action_name,
    http_method
  ].join('-').downcase
end

#parametersObject



75
76
77
78
79
80
# File 'lib/api_canon/swagger/api_declaration.rb', line 75

def parameters
  object.params.collect do |name, param|
    # Reject format because its not a real param :)
    Parameter.new param unless name == :format
  end.compact
end

#summaryObject



65
66
67
# File 'lib/api_canon/swagger/api_declaration.rb', line 65

def summary
  object.description
end