Sha256: ebd8ab07426c9f149b7960ed88cd0839112b8cf1477e2fb69e74e13cf4f47be3

Contents?: true

Size: 610 Bytes

Versions: 1

Compression:

Stored size: 610 Bytes

Contents

# frozen_string_literal: true

# /customers/phone_verifications
module Phone
  class ConfirmationForm < ApplicationForm
    attribute :code, String
    attribute :id, String

    validates :code, presence: true, length: { minimum: 4, maximum: 16 }

    def submit
      return false unless valid?

      api_answer = TranslationCms::Api::Customers::PhoneVerifications.update(submit_params(attributes))
      merge_responce! api_answer
      errors.empty?
    end

    protected

    def submit_params(params)
      {
        id: params.delete(:id),
        phone_verification: params
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
translation_cms-0.1.5 app/forms/phone/confirmation_form.rb