Sha256: 21bd897d4a2c8f354ebe2631d93da342e005d6ea57e9a244c30842ae31da1e38

Contents?: true

Size: 551 Bytes

Versions: 1

Compression:

Stored size: 551 Bytes

Contents

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

      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

1 entries across 1 versions & 1 rubygems

Version Path
arbetsformedlingen-0.5.0 lib/arbetsformedlingen/models/salary.rb