Class: MHVAC::UpgradeForm
- Inherits:
-
Common::Form
- Object
- Common::Form
- MHVAC::UpgradeForm
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/mhv_ac/upgrade_form.rb
Overview
Models a MHVAC (MyHealtheVet Account Creation) upgrade form.
Instance Attribute Summary collapse
- #form_signed_date_time ⇒ Common::HTTPDate
- #form_upgrade_manual_date ⇒ Common::HTTPDate
- #form_upgrade_online_date ⇒ Common::HTTPDate
- #terms_version ⇒ String
- #user_id ⇒ Integer
Instance Method Summary collapse
-
#mhv_params ⇒ Hash
Validates form attributes and wraps each present attribute to create a parameter set for MHV, stripping attribute values of nil.
Instance Attribute Details
#form_signed_date_time ⇒ Common::HTTPDate
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/mhv_ac/upgrade_form.rb', line 21 class UpgradeForm < Common::Form include ActiveModel::Validations attribute :user_id, Integer attribute :form_signed_date_time, Common::HTTPDate attribute :form_upgrade_manual_date, Common::HTTPDate attribute :form_upgrade_online_date, Common::HTTPDate attribute :terms_version, String validates :user_id, :terms_version, :form_signed_date_time, presence: true ## # Validates form attributes and wraps each present attribute to create # a parameter set for MHV, stripping attribute values of nil. # # @raise [Common::Exceptions::ValidationErrors] if there are validation errors # @return [Hash] A hash of valid form attributes # def mhv_params raise Common::Exceptions::ValidationErrors, self unless valid? attribute_set.map do |attribute| value = send(attribute.name) [attribute.name, value] unless value.nil? end.compact.to_h end end |
#form_upgrade_manual_date ⇒ Common::HTTPDate
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/mhv_ac/upgrade_form.rb', line 21 class UpgradeForm < Common::Form include ActiveModel::Validations attribute :user_id, Integer attribute :form_signed_date_time, Common::HTTPDate attribute :form_upgrade_manual_date, Common::HTTPDate attribute :form_upgrade_online_date, Common::HTTPDate attribute :terms_version, String validates :user_id, :terms_version, :form_signed_date_time, presence: true ## # Validates form attributes and wraps each present attribute to create # a parameter set for MHV, stripping attribute values of nil. # # @raise [Common::Exceptions::ValidationErrors] if there are validation errors # @return [Hash] A hash of valid form attributes # def mhv_params raise Common::Exceptions::ValidationErrors, self unless valid? attribute_set.map do |attribute| value = send(attribute.name) [attribute.name, value] unless value.nil? end.compact.to_h end end |
#form_upgrade_online_date ⇒ Common::HTTPDate
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/mhv_ac/upgrade_form.rb', line 21 class UpgradeForm < Common::Form include ActiveModel::Validations attribute :user_id, Integer attribute :form_signed_date_time, Common::HTTPDate attribute :form_upgrade_manual_date, Common::HTTPDate attribute :form_upgrade_online_date, Common::HTTPDate attribute :terms_version, String validates :user_id, :terms_version, :form_signed_date_time, presence: true ## # Validates form attributes and wraps each present attribute to create # a parameter set for MHV, stripping attribute values of nil. # # @raise [Common::Exceptions::ValidationErrors] if there are validation errors # @return [Hash] A hash of valid form attributes # def mhv_params raise Common::Exceptions::ValidationErrors, self unless valid? attribute_set.map do |attribute| value = send(attribute.name) [attribute.name, value] unless value.nil? end.compact.to_h end end |
#terms_version ⇒ String
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/mhv_ac/upgrade_form.rb', line 21 class UpgradeForm < Common::Form include ActiveModel::Validations attribute :user_id, Integer attribute :form_signed_date_time, Common::HTTPDate attribute :form_upgrade_manual_date, Common::HTTPDate attribute :form_upgrade_online_date, Common::HTTPDate attribute :terms_version, String validates :user_id, :terms_version, :form_signed_date_time, presence: true ## # Validates form attributes and wraps each present attribute to create # a parameter set for MHV, stripping attribute values of nil. # # @raise [Common::Exceptions::ValidationErrors] if there are validation errors # @return [Hash] A hash of valid form attributes # def mhv_params raise Common::Exceptions::ValidationErrors, self unless valid? attribute_set.map do |attribute| value = send(attribute.name) [attribute.name, value] unless value.nil? end.compact.to_h end end |
#user_id ⇒ Integer
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/mhv_ac/upgrade_form.rb', line 21 class UpgradeForm < Common::Form include ActiveModel::Validations attribute :user_id, Integer attribute :form_signed_date_time, Common::HTTPDate attribute :form_upgrade_manual_date, Common::HTTPDate attribute :form_upgrade_online_date, Common::HTTPDate attribute :terms_version, String validates :user_id, :terms_version, :form_signed_date_time, presence: true ## # Validates form attributes and wraps each present attribute to create # a parameter set for MHV, stripping attribute values of nil. # # @raise [Common::Exceptions::ValidationErrors] if there are validation errors # @return [Hash] A hash of valid form attributes # def mhv_params raise Common::Exceptions::ValidationErrors, self unless valid? attribute_set.map do |attribute| value = send(attribute.name) [attribute.name, value] unless value.nil? end.compact.to_h end end |
Instance Method Details
#mhv_params ⇒ Hash
Validates form attributes and wraps each present attribute to create a parameter set for MHV, stripping attribute values of nil.
39 40 41 42 43 44 45 46 |
# File 'lib/mhv_ac/upgrade_form.rb', line 39 def mhv_params raise Common::Exceptions::ValidationErrors, self unless valid? attribute_set.map do |attribute| value = send(attribute.name) [attribute.name, value] unless value.nil? end.compact.to_h end |