Sha256: 262647942074f0820f28cda3a2431eda0258268da14bbddf0655f2627d2aa253

Contents?: true

Size: 868 Bytes

Versions: 1

Compression:

Stored size: 868 Bytes

Contents

# frozen_string_literal: true

module Account
  class FeaturesForm < ApplicationForm
    attribute :order_id, String

    attribute :proofread_by_editor, Integer
    attribute :preferred_writer,    Integer
    attribute :writer_level,        Integer
    attribute :printed_version,     Integer
    attribute :vip_support,         Integer
    attribute :certification,       Integer
    attribute :other,               Integer

    validates :order_id, presence: true

    def submit
      return false unless valid?

      api_answer = TranslationCms::Api::Customers::Feature.create(create_features_params(attributes))
      merge_responce! api_answer
      errors.empty?
    end

    class << self
    end

    protected

    def create_features_params(params)
      {
        order_id: attributes.delete(:order_id),
        feature: params
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
translation_cms-0.1.5 app/forms/account/features_form.rb