Sha256: 95158dc3875f8869960232bd8ba53266e116ea399f6f9a96a0bbd13942e441c4

Contents?: true

Size: 578 Bytes

Versions: 2

Compression:

Stored size: 578 Bytes

Contents

# frozen_string_literal: true

module Arbetsformedlingen
  SalarySchema = 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(:summary, Types::StrippedString).filled
    required(:currency, Types::Currency).filled(:str?, :currency?)
    required(:type, Types::SalaryType).filled(:str?, :salary_type?)
  end

  class Salary < Model
    def initialize(hash)
      super(SalarySchema.call(hash))
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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