Sha256: 104738576d425d1541c38aae6d36fe1b65d31036127cf332d32afaffcf642e6b

Contents?: true

Size: 1.4 KB

Versions: 1

Compression:

Stored size: 1.4 KB

Contents

# :nodoc:
module RailsApiDoc
  module Controller
    module Request
      module Headers

        def headers
          REQUEST_HEADERS
        end

        REQUEST_HEADERS = {
          'Parameter' => {
            value: -> (row_name, row_values) {
              title = row_name.to_s
              title += '*' if row_values.required?
              title
            },
            fill_type: :input,
            param: :name
          },
          'Type' => {
            value: -> (row_name, row_values) {
              if row_values.nested?
                (row_values.model || row_values.type).to_s + "(Nested)"
              else
                row_values.type
              end
            },
            fill_type: :select,
            param: :type,
            values: RailsApiDoc::Controller::Request::Param::ACCEPTED_TYPES
          },
          'Special' => {
            value: -> (row_name, row_values) {
              case
              when row_values.enum?
                row_values[:enum]
              when row_values.model?
                row_values[:model]
              end
            },
            fill_type: :input,
            param: :special
          },
          'Desc' => {
            value: -> (row_name, row_values) {
              'TODO: description' # if row_values[:desc]
            },
            fill_type: :input,
            param: :desc
          }
        }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_api_documentation-0.2.3 lib/rails_api_doc/controller/request/headers.rb