Module: ApiRegulator::DSL::ClassMethods

Defined in:
lib/api_regulator/dsl.rb

Instance Method Summary collapse

Instance Method Details

#api(controller_class, action, desc: nil, title: nil, versions: [], tags: [], &block) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/api_regulator/dsl.rb', line 12

def api(controller_class, action, desc: nil, title: nil, versions: [], tags: [], &block)
  @api_definitions ||= []

  api_definition = Api.new(
    controller_class,
    action.to_s,
    desc: desc,
    title: title,
    versions: versions,
    tags: tags,
    &block
  )

  @api_definitions << api_definition
  ApiRegulator.api_definitions << api_definition
end

#api_definitionsObject



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

def api_definitions
  @api_definitions || []
end

#webhook(event_name, desc: nil, title: nil, tags: [], &block) ⇒ Object



29
30
31
32
# File 'lib/api_regulator/dsl.rb', line 29

def webhook(event_name, desc: nil, title: nil, tags: [], &block)
  webhook = Webhook.new(event_name, desc: desc, title: title, tags: tags, &block)
  ApiRegulator.webhook_definitions << webhook
end