Sha256: 56df9f7dd4e0507d7c5995dd8aaf484c307f1395622c99693278b3cc46fd36ec

Contents?: true

Size: 719 Bytes

Versions: 2

Compression:

Stored size: 719 Bytes

Contents

# frozen_string_literal: true

module Arbetsformedlingen
  QualificationSchema = Dry::Validation.Params do
    configure do
      config.type_specs = true
      config.messages_file = File.expand_path('../../../config/locales/errors.yml', __dir__)

      predicates(Predicates)
    end

    required(:required, Types::Bool).filled

    optional(:drivers_license, Types::DriversLicense).filled(:drivers_license?)
    optional(:car, Types::Bool).filled(:bool?)
    optional(:summary, Types::StrippedString).filled
    optional(:experience, Types::ExperienceRequired).filled(:experience_required?)
  end

  class Qualification < Model
    def initialize(hash)
      super(QualificationSchema.call(hash))
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
arbetsformedlingen-0.7.0 lib/arbetsformedlingen/models/qualification.rb
arbetsformedlingen-0.6.0 lib/arbetsformedlingen/models/qualification.rb