Class: FE::Document::Receiver
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/facturacr/document/receiver.rb
Instance Attribute Summary collapse
-
#comercial_name ⇒ Object
Returns the value of attribute comercial_name.
-
#document_type ⇒ Object
Returns the value of attribute document_type.
-
#email ⇒ Object
Returns the value of attribute email.
-
#fax ⇒ Object
Returns the value of attribute fax.
-
#foreign_id_number ⇒ Object
Returns the value of attribute foreign_id_number.
-
#identification_document ⇒ Object
Returns the value of attribute identification_document.
-
#location ⇒ Object
Returns the value of attribute location.
-
#name ⇒ Object
Returns the value of attribute name.
-
#other_foreign_signs ⇒ Object
Returns the value of attribute other_foreign_signs.
-
#phone ⇒ Object
Returns the value of attribute phone.
Attributes inherited from Element
Instance Method Summary collapse
- #build_xml(node, document) ⇒ Object
-
#initialize(args = {}) ⇒ Receiver
constructor
A new instance of Receiver.
- #to_xml(builder, document) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Receiver
Returns a new instance of Receiver.
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/facturacr/document/receiver.rb', line 29 def initialize(args={}) @name = args[:name] @identification_document = args[:identification_document] @comercial_name = args[:comercial_name] @location = args[:location] @phone = args[:phone] @fax = args[:fax] @email = args[:email] @foreign_id_number = args[:foreign_id_number] @other_foreign_signs= args[:other_foreign_signs] end |
Instance Attribute Details
#comercial_name ⇒ Object
Returns the value of attribute comercial_name.
11 12 13 |
# File 'lib/facturacr/document/receiver.rb', line 11 def comercial_name @comercial_name end |
#document_type ⇒ Object
Returns the value of attribute document_type.
11 12 13 |
# File 'lib/facturacr/document/receiver.rb', line 11 def document_type @document_type end |
#email ⇒ Object
Returns the value of attribute email.
11 12 13 |
# File 'lib/facturacr/document/receiver.rb', line 11 def email @email end |
#fax ⇒ Object
Returns the value of attribute fax.
11 12 13 |
# File 'lib/facturacr/document/receiver.rb', line 11 def fax @fax end |
#foreign_id_number ⇒ Object
Returns the value of attribute foreign_id_number.
11 12 13 |
# File 'lib/facturacr/document/receiver.rb', line 11 def foreign_id_number @foreign_id_number end |
#identification_document ⇒ Object
Returns the value of attribute identification_document.
11 12 13 |
# File 'lib/facturacr/document/receiver.rb', line 11 def identification_document @identification_document end |
#location ⇒ Object
Returns the value of attribute location.
11 12 13 |
# File 'lib/facturacr/document/receiver.rb', line 11 def location @location end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/facturacr/document/receiver.rb', line 11 def name @name end |
#other_foreign_signs ⇒ Object
Returns the value of attribute other_foreign_signs.
11 12 13 |
# File 'lib/facturacr/document/receiver.rb', line 11 def other_foreign_signs @other_foreign_signs end |
#phone ⇒ Object
Returns the value of attribute phone.
11 12 13 |
# File 'lib/facturacr/document/receiver.rb', line 11 def phone @phone end |
Instance Method Details
#build_xml(node, document) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/facturacr/document/receiver.rb', line 43 def build_xml(node, document) @document = document @document_type = document.document_type raise FE::Error.new("receiver invalid",class: self.class, messages: errors.) unless valid? node = Nokogiri::XML::Builder.new if node.nil? node.Receptor do |xml| xml.Nombre @name @identification_document.build_xml(xml,@document) if @identification_document.present? xml.IdentificacionExtranjero foreign_id_number if @foreign_id_number.present? xml.NombreComercial @comercial_name if @comercial_name.present? @location.build_xml(xml,@document) if @location.present? @phone.build_xml(xml, @document) if @phone.present? @fax.build_xml(xml, @document) if @fax.present? xml.CorreoElectronico @email if @email.present? xml.OtrasSenasExtranjero @other_foreign_signs if @other_foreign_signs.present? && @document.version_43? end end |
#to_xml(builder, document) ⇒ Object
62 63 64 |
# File 'lib/facturacr/document/receiver.rb', line 62 def to_xml(builder, document) build_xml(builder, document).to_xml end |