Sha256: a9652794445fab66cc7bbe759897af8ff9938c73cd440b9ed3322e8248589282

Contents?: true

Size: 532 Bytes

Versions: 4

Compression:

Stored size: 532 Bytes

Contents

# frozen_string_literal: true
require_relative '../application/parameters'

module Meta
  module RouteDSL
    class ParametersBuilder
      def initialize(&block)
        @parameters = {}

        instance_exec &block if block_given?
      end

      def param(name, options)
        options = options.dup
        op_in = options.delete(:in) || 'query'

        @parameters[name] = { in: op_in, schema: JsonSchema::BaseSchema.new(options) }
      end

      def build
        Parameters.new(@parameters)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
meta-api-0.0.6 lib/meta/route_dsl/parameters_builder.rb
meta-api-0.0.5 lib/meta/route_dsl/parameters_builder.rb
meta-api-0.0.4 lib/meta/route_dsl/parameters_builder.rb
meta-api-0.0.3 lib/meta/route_dsl/parameters_builder.rb