Class: Facturae::Party
- Inherits:
-
Object
- Object
- Facturae::Party
- Includes:
- Validatable
- Defined in:
- lib/facturae/models/party.rb
Overview
Represents a party.
Constant Summary collapse
- NATURAL_PERSON =
"F"- LEGAL_ENTITY =
"J"- PARTY_TYPES =
[NATURAL_PERSON, LEGAL_ENTITY].freeze
- TAX_RESIDENT =
"R"- TAX_NON_RESIDENT =
"E"- TAX_UE_RESIDENT =
"U"- TAX_TYPES =
[TAX_RESIDENT, TAX_NON_RESIDENT, TAX_UE_RESIDENT].freeze
- NIF_PATTERN =
Spanish NIF: 8 digits + check letter
/\A\d{8}[A-Z]\z/- NIE_PATTERN =
Spanish NIE: X/Y/Z + 7 digits + check letter
/\A[XYZ]\d{7}[A-Z]\z/- CIF_PATTERN =
Spanish CIF: letter + 7 digits + control (digit or letter A-J)
/\A[ABCDEFGHJNPQRSUVW]\d{7}[0-9A-J]\z/
Instance Attribute Summary collapse
-
#subject ⇒ Facturae::Subject
The subject.
-
#tax_id ⇒ String
The tax identification number.
-
#tax_identification ⇒ Object
Returns the value of attribute tax_identification.
Instance Method Summary collapse
-
#initialize(person_type_code:, residence_type_code:, tax_id_number:, subject: Subject.new) ⇒ Party
constructor
A new instance of Party.
Methods included from Validatable
Constructor Details
#initialize(person_type_code:, residence_type_code:, tax_id_number:, subject: Subject.new) ⇒ Party
Returns a new instance of Party.
29 30 31 32 33 34 35 36 37 |
# File 'lib/facturae/models/party.rb', line 29 def initialize(person_type_code:, residence_type_code:, tax_id_number:, subject: Subject.new) @tax_identification = { person_type_code: person_type_code, residence_type_code: residence_type_code, tax_id_number: tax_id_number } @subject = subject end |
Instance Attribute Details
#subject ⇒ Facturae::Subject
The subject.
7 8 9 |
# File 'lib/facturae/models/party.rb', line 7 def subject @subject end |
#tax_id ⇒ String
The tax identification number.
7 8 9 |
# File 'lib/facturae/models/party.rb', line 7 def tax_id @tax_id end |
#tax_identification ⇒ Object
Returns the value of attribute tax_identification.
26 27 28 |
# File 'lib/facturae/models/party.rb', line 26 def tax_identification @tax_identification end |