Class: ApiDoc::Runner::Blueprint

Inherits:
Object
  • Object
show all
Defined in:
lib/apidoc.rb

Instance Method Summary collapse

Constructor Details

#initialize(runner, &block) ⇒ Blueprint

Returns a new instance of Blueprint.



34
35
36
37
# File 'lib/apidoc.rb', line 34

def initialize(runner, &block)
  @runner = runner
  instance_eval &block
end

Instance Method Details

#accept(type) ⇒ Object



39
40
41
# File 'lib/apidoc.rb', line 39

def accept(type)
  @runner.accept = type
end

#after(type = :each, &block) ⇒ Object



52
53
54
55
56
57
58
59
# File 'lib/apidoc.rb', line 52

def after(type=:each, &block)
  case type
  when :each
    @runner.after_each_blocks << block
  when :all
    @runner.after_all_blocks << block
  end
end

#before(type = :each, &block) ⇒ Object



43
44
45
46
47
48
49
50
# File 'lib/apidoc.rb', line 43

def before(type=:each, &block)
  case type
  when :each
    @runner.before_each_blocks << block
  when :all
    @runner.before_all_blocks << block
  end
end

#content_type(type) ⇒ Object



61
62
63
# File 'lib/apidoc.rb', line 61

def content_type(type)
  @runner.content_type = type
end

#delete(path, &block) ⇒ Object



77
78
79
# File 'lib/apidoc.rb', line 77

def delete(path, &block)
  @runner.resources << DeleteResource.new(@runner, path, &block)
end

#get(path, &block) ⇒ Object



65
66
67
# File 'lib/apidoc.rb', line 65

def get(path, &block)
  @runner.resources << GetResource.new(@runner, path, &block)
end

#options(path, &block) ⇒ Object



81
82
83
# File 'lib/apidoc.rb', line 81

def options(path, &block)
  @runner.resources << OptionsResource.new(@runner, path, &block)
end

#post(path, &block) ⇒ Object



69
70
71
# File 'lib/apidoc.rb', line 69

def post(path, &block)
  @runner.resources << PostResource.new(@runner, path, &block)
end

#put(path, &block) ⇒ Object



73
74
75
# File 'lib/apidoc.rb', line 73

def put(path, &block)
  @runner.resources << PutResource.new(@runner, path, &block)
end