Sha256: 872f467c24d4cafe89fd32d521e5c50276b9a18eb245874509828d4a6fc4a396

Contents?: true

Size: 699 Bytes

Versions: 5

Compression:

Stored size: 699 Bytes

Contents

# frozen_string_literal: true

require 'request_handler/builder/base'

module RequestHandler
  module Builder
    class MultipartResourceBuilder < Base
      MultipartResource = Struct.new(:required, :schema, :type, :options)

      def create_klass_struct
        @result = MultipartResource.new
      end

      def type(value)
        @result.type = value
      end

      def required(value)
        @result.required = value
      end

      def resource(name, &block)
        @result[name.to_sym] = build_multipart_resource(&block)
      end

      def schema(value)
        @result.schema = value
      end

      def options(value)
        @result.options = value
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
request_handler-2.3.0 lib/request_handler/builder/multipart_resource_builder.rb
request_handler-2.2.0 lib/request_handler/builder/multipart_resource_builder.rb
request_handler-2.1.1 lib/request_handler/builder/multipart_resource_builder.rb
request_handler-2.1.0 lib/request_handler/builder/multipart_resource_builder.rb
request_handler-2.0.0 lib/request_handler/builder/multipart_resource_builder.rb