Sha256: f5acd4ffbc9d79b99ffafea03d69914de8b393a3882c423f7fdaaa7d5f20b6e6

Contents?: true

Size: 610 Bytes

Versions: 2

Compression:

Stored size: 610 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module ComparativeStats
    module Admin
      # A form object used to configure the endpoint.
      #
      class EndpointForm < Decidim::Form
        mimic :endpoint

        attribute :endpoint, String, presence: true
        attribute :active, Boolean
        attribute :name, String

        validate :valid_api_version

        def valid_api_version
          unless context.api.valid?
            errors.add :endpoint, :invalid
            errors.add :endpoint, context.api.error if context.api.error
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
decidim-comparative_stats-1.1.0 app/forms/decidim/comparative_stats/admin/endpoint_form.rb
decidim-comparative_stats-1.0.1 app/forms/decidim/comparative_stats/admin/endpoint_form.rb