Class: ApiExplorer::GroupProxy

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

Direct Known Subclasses

DescriptionProxy

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

#delete(path, &block) ⇒ Object



40
41
42
# File 'lib/api_explorer/dsl/group_proxy.rb', line 40

def delete(path, &block)
  request(:delete, path, &block)
end

#get(path, &block) ⇒ Object



28
29
30
# File 'lib/api_explorer/dsl/group_proxy.rb', line 28

def get(path, &block)
  request(:get, path, &block)
end

#group(title, &block) ⇒ Object



8
9
10
11
12
13
# File 'lib/api_explorer/dsl/group_proxy.rb', line 8

def group(title, &block)
  group = Group.new(title)
  proxy = GroupProxy.new(group)
  proxy.collect(&block) if block_given?
  obj.add_child group
end

#patch(path, &block) ⇒ Object



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

def patch(path, &block)
  request(:patch, path, &block)
end

#path(path = nil) ⇒ Object



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

def path(path = nil)
  obj.path = path if path
  obj.path
end

#post(path, &block) ⇒ Object



31
32
33
# File 'lib/api_explorer/dsl/group_proxy.rb', line 31

def post(path, &block)
  request(:post, path, &block)
end

#put(path, &block) ⇒ Object



34
35
36
# File 'lib/api_explorer/dsl/group_proxy.rb', line 34

def put(path, &block)
  request(:put, path, &block)
end

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



15
16
17
18
19
20
21
# File 'lib/api_explorer/dsl/group_proxy.rb', line 15

def request(method, path, &block)
  method = method.to_s.downcase.to_sym
  req = Request.new(method, path)
  proxy = RequestProxy.new(req)
  proxy.collect(&block) if block_given?
  obj.add_child req
end

#shared(&block) ⇒ Object



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

def shared(&block)
  proxy = RequestProxy.new(obj)
  proxy.collect(&block)
end