Class: FE::Document::Issuer
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/facturacr/document/issuer.rb
Instance Attribute Summary collapse
-
#comercial_name ⇒ Object
Returns the value of attribute comercial_name.
-
#email ⇒ Object
Returns the value of attribute email.
-
#fax ⇒ Object
Returns the value of attribute fax.
-
#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.
-
#phone ⇒ Object
Returns the value of attribute phone.
Attributes inherited from Element
Instance Method Summary collapse
- #build_xml(node, document) ⇒ Object
-
#initialize(args = {}) ⇒ Issuer
constructor
A new instance of Issuer.
- #to_xml(builder, document) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Issuer
Returns a new instance of Issuer.
23 24 25 26 27 28 29 30 31 |
# File 'lib/facturacr/document/issuer.rb', line 23 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] end |
Instance Attribute Details
#comercial_name ⇒ Object
Returns the value of attribute comercial_name.
8 9 10 |
# File 'lib/facturacr/document/issuer.rb', line 8 def comercial_name @comercial_name end |
#email ⇒ Object
Returns the value of attribute email.
8 9 10 |
# File 'lib/facturacr/document/issuer.rb', line 8 def email @email end |
#fax ⇒ Object
Returns the value of attribute fax.
8 9 10 |
# File 'lib/facturacr/document/issuer.rb', line 8 def fax @fax end |
#identification_document ⇒ Object
Returns the value of attribute identification_document.
8 9 10 |
# File 'lib/facturacr/document/issuer.rb', line 8 def identification_document @identification_document end |
#location ⇒ Object
Returns the value of attribute location.
8 9 10 |
# File 'lib/facturacr/document/issuer.rb', line 8 def location @location end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/facturacr/document/issuer.rb', line 8 def name @name end |
#phone ⇒ Object
Returns the value of attribute phone.
8 9 10 |
# File 'lib/facturacr/document/issuer.rb', line 8 def phone @phone end |
Instance Method Details
#build_xml(node, document) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/facturacr/document/issuer.rb', line 33 def build_xml(node, document) @document = document raise FE::Error.new("issuer invalid",class: self.class, messages: errors.) unless valid? node = Nokogiri::XML::Builder.new if node.nil? node.Emisor do |xml| xml.Nombre @name identification_document.build_xml(xml,document) xml.NombreComercial @comercial_name if @comercial_name location.build_xml(xml, document) phone.build_xml(xml, document) if phone.present? fax.build_xml(xml, document) if fax.present? xml.CorreoElectronico @email end end |
#to_xml(builder, document) ⇒ Object
49 50 51 |
# File 'lib/facturacr/document/issuer.rb', line 49 def to_xml(builder,document) build_xml(builder,document).to_xml end |