Class: Apical::Runner::Blueprint

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

Instance Method Summary collapse

Constructor Details

#initialize(runner, &block) ⇒ Blueprint

Returns a new instance of Blueprint.



21
22
23
24
# File 'lib/apical/runner.rb', line 21

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

Instance Method Details

#accept(format) ⇒ Object



30
31
32
# File 'lib/apical/runner.rb', line 30

def accept(format)
  @runner.accept = ContentType[format]
end

#adapter(identifier, options = {}) ⇒ Object



26
27
28
# File 'lib/apical/runner.rb', line 26

def adapter(identifier, options={})
  @runner.adapter = Adapter[identifier].new(options)
end

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



63
64
65
66
67
68
69
70
# File 'lib/apical/runner.rb', line 63

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

#app(app) ⇒ Object



50
51
52
# File 'lib/apical/runner.rb', line 50

def app(app)
  @runner.app = app
end

#auth_header(token) ⇒ Object



38
39
40
# File 'lib/apical/runner.rb', line 38

def auth_header(token)
  @runner.auth_header = token
end

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



54
55
56
57
58
59
60
61
# File 'lib/apical/runner.rb', line 54

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(format) ⇒ Object



34
35
36
# File 'lib/apical/runner.rb', line 34

def content_type(format)
  @runner.content_type = ContentType[format]
end

#delete(path, &block) ⇒ Object



84
85
86
# File 'lib/apical/runner.rb', line 84

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

#desc(desc) ⇒ Object



46
47
48
# File 'lib/apical/runner.rb', line 46

def desc(desc)
  @runner.desc = desc
end

#get(path, &block) ⇒ Object



72
73
74
# File 'lib/apical/runner.rb', line 72

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

#name(name) ⇒ Object



42
43
44
# File 'lib/apical/runner.rb', line 42

def name(name)
  @runner.name = name
end

#options(path, &block) ⇒ Object



88
89
90
# File 'lib/apical/runner.rb', line 88

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

#post(path, &block) ⇒ Object



76
77
78
# File 'lib/apical/runner.rb', line 76

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

#put(path, &block) ⇒ Object



80
81
82
# File 'lib/apical/runner.rb', line 80

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