Class: Decidim::Verifications::IdDocuments::InformationForm
- Inherits:
-
AuthorizationHandler
- Object
- AttributeObject::Form
- Form
- AuthorizationHandler
- Decidim::Verifications::IdDocuments::InformationForm
- Defined in:
- decidim-verifications/app/forms/decidim/verifications/id_documents/information_form.rb
Overview
A form object to be used as the base for identity document verification
Direct Known Subclasses
Admin::OfflineConfirmationForm, InformationRejectionForm, UploadForm
Constant Summary collapse
- DOCUMENT_TYPES =
%w(DNI NIE passport).freeze
Constants included from AttributeObject::TypeMap
AttributeObject::TypeMap::Boolean, AttributeObject::TypeMap::Decimal
Instance Attribute Summary
Attributes inherited from AttributeObject::Form
Instance Method Summary collapse
- #document_types_for_select ⇒ Object
- #handler_name ⇒ Object
- #map_model(model) ⇒ Object
- #uses_online_method? ⇒ Boolean
- #verification_metadata ⇒ Object
Methods inherited from AuthorizationHandler
#authorization_attributes, #duplicate, #form_attributes, handler_for, handler_name, #metadata, #to_partial_path, #transferrable?, #unique?, #unique_id, #verification_attachment
Methods inherited from AttributeObject::Form
ensure_hash, from_model, from_params, hash_from, infer_model_name, mimic, mimicked_model_name, model_name, #persisted?, #to_key, #to_model, #to_param, #valid?, #with_context
Methods included from AttributeObject::Model
#[], #[]=, #attributes, #attributes_with_values, #initialize, #to_h
Instance Method Details
#document_types_for_select ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'decidim-verifications/app/forms/decidim/verifications/id_documents/information_form.rb', line 46 def document_types_for_select DOCUMENT_TYPES.map do |type| [ I18n.t(type.downcase, scope: "decidim.verifications.id_documents"), type ] end end |
#handler_name ⇒ Object
28 29 30 |
# File 'decidim-verifications/app/forms/decidim/verifications/id_documents/information_form.rb', line 28 def handler_name "id_documents" end |
#map_model(model) ⇒ Object
32 33 34 35 36 |
# File 'decidim-verifications/app/forms/decidim/verifications/id_documents/information_form.rb', line 32 def map_model(model) self.document_type = model.["document_type"] self.document_number = model.["document_number"] self.verification_type = model.["verification_type"].presence || "online" end |
#uses_online_method? ⇒ Boolean
55 56 57 |
# File 'decidim-verifications/app/forms/decidim/verifications/id_documents/information_form.rb', line 55 def uses_online_method? verification_type == "online" end |
#verification_metadata ⇒ Object
38 39 40 41 42 43 44 |
# File 'decidim-verifications/app/forms/decidim/verifications/id_documents/information_form.rb', line 38 def { "document_type" => document_type, "document_number" => document_number, "verification_type" => verification_type } end |