HabitatMap/AirCasting

View on GitHub
app/models/api/links.rb

Summary

Maintainability
A
40 mins
Test Coverage
require 'dry-validation'
require 'dry-struct'

module Api::Links
  module Types
    include Dry::Types.module
  end

  Schema =
    Dry::Validation.Schema do
      required(:url_token).filled(:str?)
      required(:sensor_name).filled(:str?)
    end

  class Struct < Dry::Struct
    transform_keys(&:to_sym)

    attribute :url_token, Types::Coercible::String
    attribute :sensor_name, Types::Strict::String
  end
end