Sha256: 58ef993fe0c9fe786b97941540749a61ad23f42a8523f93ae092f99b2878e22b

Contents?: true

Size: 638 Bytes

Versions: 2

Compression:

Stored size: 638 Bytes

Contents

# frozen_string_literal: true

module Europeana
  module FeedbackButton
    class Feedback
      include ActiveModel::Model

      MAX_LENGTH = 400
      MIN_WORDS = 5
      TYPES = %w(comment correction bug).freeze

      attr_accessor :text, :type, :page, :email, :privacy_policy

      validates :text, :type, :page, presence: true
      validates :type, inclusion: { in: TYPES }
      validates :privacy_policy, acceptance: true, allow_nil: false, allow_blank: false
      validates :text, length: { maximum: MAX_LENGTH }
      validates :text, word_count: { minimum: MIN_WORDS }, allow_nil: true, allow_blank: true
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
europeana-feedback-button-0.0.7 app/models/europeana/feedback_button/feedback.rb
europeana-feedback-button-0.0.6 app/models/europeana/feedback_button/feedback.rb