Welcome to mirror list, hosted at ThFree Co, Russian Federation.

metadatum.rb « nuget « entities « api « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1df57f8243d4376d667dae045fec459d945d687f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

module API
  module Entities
    module Nuget
      class Metadatum < Grape::Entity
        expose :authors, documentation: { type: 'string', example: 'Authors' } do |metadatum|
          metadatum[:authors] || ''
        end
        with_options documentation: { type: 'string', example: 'Description' } do
          set_default = ->(metadatum) { metadatum[:description] || '' }
          expose :description, &set_default
          expose :description, as: :summary, &set_default
        end
        expose :project_url, as: :projectUrl, expose_nil: false, documentation: { type: 'string', example: 'http://sandbox.com/project' }
        expose :license_url, as: :licenseUrl, expose_nil: false, documentation: { type: 'string', example: 'http://sandbox.com/license' }
        expose :icon_url, as: :iconUrl, expose_nil: false, documentation: { type: 'string', example: 'http://sandbox.com/icon' }
      end
    end
  end
end