class Swagger::V2::Operation

Class representing a Swagger “Operation Object”. @see github.com/wordnik/swagger-spec/blob/master/versions/2.0.md#operationObject Operation Object

Public Instance Methods

api_title() click to toggle source
# File lib/swagger/v2/operation.rb, line 28
def api_title
  root.info.title
end
default_response() click to toggle source
# File lib/swagger/v2/operation.rb, line 45
def default_response
  return nil if responses.nil? || responses.values.nil?

  # FIXME: Swagger isn't very clear on "normal response codes"
  # In the examples, default is actually an error
  responses['200'] || responses['201'] || responses['default'] || responses.values.first
end
each_parameter() { |parameter| ... } click to toggle source

Iterates over each parameter defined directly on the operation, excluding parameters defined at the API level.

# File lib/swagger/v2/operation.rb, line 55
def each_parameter
  return if parameters.nil?
  parameters.each do |parameter|
    yield parameter
  end
end
full_name() click to toggle source
# File lib/swagger/v2/operation.rb, line 32
def full_name
  "#{api_title} - #{summary}"
end
signature() click to toggle source
# File lib/swagger/v2/operation.rb, line 41
def signature
  "#{verb.to_s.upcase} #{parent.uri_template}"
end
verb() click to toggle source

The HTTP verb for the operation.

# File lib/swagger/v2/operation.rb, line 37
def verb
  parent.operations.key self
end