Sha256: 7865005ff7425339b350fdb4a3b6466f1c2705ee1fe4b1e348a6c27c32dfecc9
Contents?: true
Size: 1.11 KB
Versions: 7
Compression:
Stored size: 1.11 KB
Contents
# encoding: utf-8 module Hyperdrive module DSL class Resource include Values attr_reader :resource def initialize(name, options = {}) @resource = ::Hyperdrive::Resource.new(name, options) instance_eval(&Proc.new) if block_given? end def name(name) resource.name = name end def description(description) resource.description = description end def param(*args) resource.register_param(*args) end def filter(*args) resource.register_filter(*args) end def request(request_method, version = 'v1') unless definable_request_methods.include? request_method raise Errors::DSL::UnknownArgument.new(request_method, 'request') end resource.register_request_handler(request_method, Proc.new, version) end def before(request_methods = [:get, :post, :put, :patch, :delete], version = 'v1') Array(request_methods).each do |request_method| resource.register_callback(:before, request_method, Proc.new, version) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems