Sha256: 98a9d4ff19763bfc1d69042d9b56f500639123282ae7b68b16dcb8064e079d9c

Contents?: true

Size: 836 Bytes

Versions: 10

Compression:

Stored size: 836 Bytes

Contents

module Dox
  module DSL
    class Resource
      include AttrProxy

      attr_writer :name
      attr_writer :group
      attr_writer :endpoint

      attr_writer :desc

      def initialize(name, &block)
        self.name = name

        instance_eval(&block)

        raise(Dox::Errors::InvalidResourceError, 'Resource name is required!') if @name.blank?
        raise(Dox::Errors::InvalidResourceError, 'Resource group is required!') if @group.blank?
        raise(Dox::Errors::InvalidResourceError, 'Resource endpoint is required!') if @endpoint.blank?
      end

      def config
        {
          resource_name: @name.presence,
          resource_desc: @desc.presence,
          resource_group_name: @group.presence,
          resource_endpoint: @endpoint.presence,
          apidoc: true
        }
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
dox-1.3.0 lib/dox/dsl/resource.rb
dox-2.0.0.beta3 lib/dox/dsl/resource.rb
dox-2.0.0.beta2 lib/dox/dsl/resource.rb
dox-2.0.0.beta1 lib/dox/dsl/resource.rb
dox-1.2.0 lib/dox/dsl/resource.rb
dox-1.1.0 lib/dox/dsl/resource.rb
dox-1.0.2 lib/dox/dsl/resource.rb
dox-1.0.1 lib/dox/dsl/resource.rb
dox-1.0.0 lib/dox/dsl/resource.rb
dox-1.0.0.alpha lib/dox/dsl/resource.rb