Class: ApiExplorer::RequestProxy

Inherits:
BaseProxy show all
Defined in:
lib/api_explorer/dsl/request_proxy.rb

Instance Attribute Summary

Attributes inherited from BaseProxy

#obj

Instance Method Summary collapse

Methods inherited from BaseProxy

#collect, #initialize

Constructor Details

This class inherits a constructor from ApiExplorer::BaseProxy

Instance Method Details

#boolean(name, options = {}, &block) ⇒ Object



30
31
32
# File 'lib/api_explorer/dsl/request_proxy.rb', line 30

def boolean(name, options = {}, &block)
  param(name, :boolean, options)
end

#desc(description) ⇒ Object



7
8
9
# File 'lib/api_explorer/dsl/request_proxy.rb', line 7

def desc(description)
  obj.description = description
end

#exclude_shared_header(name) ⇒ Object



3
4
5
# File 'lib/api_explorer/dsl/request_proxy.rb', line 3

def exclude_shared_header(name)
  obj.excluded_shared_headers << name
end

#header(name, options = {}) ⇒ Object



37
38
39
# File 'lib/api_explorer/dsl/request_proxy.rb', line 37

def header(name, options = {})
  obj.headers << Header.new(name, options)
end

#integer(name, options = {}, &block) ⇒ Object



33
34
35
# File 'lib/api_explorer/dsl/request_proxy.rb', line 33

def integer(name, options = {}, &block)
  param(name, :integer, options)
end

#param(name, type = nil, options = {}, &block) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/api_explorer/dsl/request_proxy.rb', line 11

def param(name, type = nil, options = {}, &block)
  desc = options.fetch(:desc, "")
  if type.nil? && block_given?
    param = Parameter.new(name, [], desc)
    param.type = :hash
    proxy = RequestProxy.new(param)
    proxy.collect(&block)
    obj.params << param
  else
    obj.params << Parameter.new(name, type, desc)
  end
end

#string(name, options = {}, &block) ⇒ Object



27
28
29
# File 'lib/api_explorer/dsl/request_proxy.rb', line 27

def string(name, options = {}, &block)
  param(name, :string, options)
end

#struct(name, options = {}, &block) ⇒ Object



24
25
26
# File 'lib/api_explorer/dsl/request_proxy.rb', line 24

def struct(name, options = {}, &block)
  param(name, nil, options, &block)
end