Class: APISpec::Interface

Inherits:
Node
  • Object
show all
Defined in:
lib/apispec/interface.rb

Instance Attribute Summary

Attributes inherited from Node

#name, #parent

Instance Method Summary collapse

Methods inherited from Node

#full_name, #node_path, #root?, #to_html, #to_path, #to_s

Constructor Details

#initialize(name, &block) ⇒ Interface

Returns a new instance of Interface.



2
3
4
5
# File 'lib/apispec/interface.rb', line 2

def initialize(name, &block)
  @resources = []
  super(name, &block)
end

Instance Method Details

#base_uri(value = nil) ⇒ Object



7
8
9
# File 'lib/apispec/interface.rb', line 7

def base_uri(value = nil)
  @base_uri ||= value
end

#connect(path, &block) ⇒ Object



18
# File 'lib/apispec/interface.rb', line 18

def connect(path, &block);  http(:connect, path, &block); end

#delete(path, &block) ⇒ Object



14
# File 'lib/apispec/interface.rb', line 14

def delete(path, &block);   http(:delete, path, &block);  end

#get(path, &block) ⇒ Object



11
# File 'lib/apispec/interface.rb', line 11

def get(path, &block);      http(:get, path, &block);     end

#head(path, &block) ⇒ Object



16
# File 'lib/apispec/interface.rb', line 16

def head(path, &block);     http(:head, path, &block);    end

#http(method, path, &block) ⇒ Object



20
21
22
# File 'lib/apispec/interface.rb', line 20

def http(method, path, &block)
  @resources << APISpec::Resource.new(method, path, &block)
end

#options(path, &block) ⇒ Object



15
# File 'lib/apispec/interface.rb', line 15

def options(path, &block);  http(:options, path, &block); end

#post(path, &block) ⇒ Object



13
# File 'lib/apispec/interface.rb', line 13

def post(path, &block);     http(:post, path, &block);    end

#put(path, &block) ⇒ Object



12
# File 'lib/apispec/interface.rb', line 12

def put(path, &block);      http(:put, path, &block);     end

#resolve_references!(root_namespace) ⇒ Object



24
25
26
27
28
# File 'lib/apispec/interface.rb', line 24

def resolve_references!(root_namespace)
  @resources.each do |resource|
    resource.resolve_references!(root_namespace)
  end
end

#trace(path, &block) ⇒ Object



17
# File 'lib/apispec/interface.rb', line 17

def trace(path, &block);    http(:trace, path, &block);   end