class Swaggable::EndpointDefinition

Public Class Methods

new(*args, &block) click to toggle source
Calls superclass method Swaggable::DefinitionBase::new
# File lib/swaggable/endpoint_definition.rb, line 16
def initialize *args, &block
  self.verb = 'GET'
  super *args, &block
end

Public Instance Methods

body() click to toggle source
# File lib/swaggable/endpoint_definition.rb, line 67
def body
  parameters.detect {|p| p.location == :body }
end
configure(&block) click to toggle source
# File lib/swaggable/endpoint_definition.rb, line 50
def configure &block
  ForwardingDsl.run(self, &block)
  self
end
consumes() click to toggle source
# File lib/swaggable/endpoint_definition.rb, line 42
def consumes
  @consumes ||= MimeTypesCollection.new
end
match?(v, p) click to toggle source
# File lib/swaggable/endpoint_definition.rb, line 55
def match? v, p
  v.to_s.upcase == verb.to_s.upcase && !!(path_template.match p)
end
parameters() click to toggle source
# File lib/swaggable/endpoint_definition.rb, line 28
def parameters
  @parameters ||= MiniObject::IndexedList.new.tap do |l|
    l.build { ParameterDefinition.new }
    l.key {|e| e.name }
  end
end
path_parameters_for(path) click to toggle source
# File lib/swaggable/endpoint_definition.rb, line 63
def path_parameters_for path
  path_template.extract(path) || {}
end
produces() click to toggle source
# File lib/swaggable/endpoint_definition.rb, line 46
def produces
  @produces ||= MimeTypesCollection.new
end
responses() click to toggle source
# File lib/swaggable/endpoint_definition.rb, line 35
def responses
  @responses ||= MiniObject::IndexedList.new.tap do |l|
    l.build { ResponseDefinition.new }
    l.key {|e| e.status }
  end
end
tags() click to toggle source
# File lib/swaggable/endpoint_definition.rb, line 21
def tags
  @tags ||= MiniObject::IndexedList.new.tap do |l|
    l.build { TagDefinition.new }
    l.key {|e| e.name }
  end
end
verb=(value) click to toggle source
# File lib/swaggable/endpoint_definition.rb, line 59
def verb= value
  @verb = value.to_s.upcase
end

Private Instance Methods

path_template() click to toggle source
# File lib/swaggable/endpoint_definition.rb, line 73
def path_template
  Addressable::Template.new path
end