lib/api_regulator/dsl.rb in api-regulator-0.1.1 vs lib/api_regulator/dsl.rb in api-regulator-0.1.2
- old
+ new
@@ -7,20 +7,27 @@
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
- def api(controller_class, action, description, &block)
+ def api(controller_class, action, desc: nil, title: nil, &block)
@api_definitions ||= []
api_definition = Api.new(
controller_class,
action.to_s,
- description,
+ desc: desc,
+ title: title,
&block
)
@api_definitions << api_definition
+ ApiRegulator.api_definitions << api_definition
+ end
+
+ 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
def api_definitions
@api_definitions || []
end