Class: VerifactuRails::Persona
- Inherits:
-
Object
- Object
- VerifactuRails::Persona
- Defined in:
- lib/verifactu_rails/registro.rb
Overview
Una persona identificada por NIF español O por identificación extranjera,
nunca las dos (sf:PersonaFisicaJuridicaType lo modela como
Direct Known Subclasses
Instance Attribute Summary collapse
-
#id_otro ⇒ Object
readonly
Returns the value of attribute id_otro.
-
#nif ⇒ Object
readonly
Returns the value of attribute nif.
-
#nombre_razon ⇒ Object
readonly
Returns the value of attribute nombre_razon.
Instance Method Summary collapse
-
#a_pares ⇒ Object
Orden EXACTO de sf:PersonaFisicaJuridicaType.
- #id_type ⇒ Object
-
#initialize(nombre_razon:, nif: nil, id_otro: nil) ⇒ Persona
constructor
A new instance of Persona.
Constructor Details
#initialize(nombre_razon:, nif: nil, id_otro: nil) ⇒ Persona
Returns a new instance of Persona.
152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/verifactu_rails/registro.rb', line 152 def initialize(nombre_razon:, nif: nil, id_otro: nil) if nif.nil? == id_otro.nil? raise ValidacionError, "Indica exactamente uno de nif: o id_otro: para #{self.class.quien}" end @nombre_razon = Formato.limitar(nombre_razon, 'NombreRazon', 120) @nif = nif && Formato.nif(nif, "NIF de #{self.class.quien}") @id_otro = id_otro && IdOtro.normalizar(id_otro, quien: self.class.quien, tipos_con_es: self.class.tipos_con_es, prohibidos: self.class.prohibidos) end |
Instance Attribute Details
#id_otro ⇒ Object (readonly)
Returns the value of attribute id_otro.
148 149 150 |
# File 'lib/verifactu_rails/registro.rb', line 148 def id_otro @id_otro end |
#nif ⇒ Object (readonly)
Returns the value of attribute nif.
148 149 150 |
# File 'lib/verifactu_rails/registro.rb', line 148 def nif @nif end |
#nombre_razon ⇒ Object (readonly)
Returns the value of attribute nombre_razon.
148 149 150 |
# File 'lib/verifactu_rails/registro.rb', line 148 def nombre_razon @nombre_razon end |
Instance Method Details
#a_pares ⇒ Object
Orden EXACTO de sf:PersonaFisicaJuridicaType.
168 169 170 171 |
# File 'lib/verifactu_rails/registro.rb', line 168 def a_pares pares = { 'NombreRazon' => nombre_razon } nif ? pares.merge('NIF' => nif) : pares.merge('IDOtro' => id_otro) end |
#id_type ⇒ Object
165 |
# File 'lib/verifactu_rails/registro.rb', line 165 def id_type = id_otro && id_otro['IDType'] |