Sha256: b33625f6f778a3da1c3ee9b5caa4ac6408f6134532e3e1784081c613bedb6afb
Contents?: true
Size: 874 Bytes
Versions: 10
Compression:
Stored size: 874 Bytes
Contents
require "active_support/concern" module ApiRegulator module DSL extend ActiveSupport::Concern def self.included(base) base.extend(ClassMethods) end module ClassMethods def api(controller_class, action, desc: nil, title: nil, &block) @api_definitions ||= [] api_definition = Api.new( controller_class, action.to_s, 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 end end end
Version data entries
10 entries across 10 versions & 1 rubygems