Class: FE::Document::Location
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/facturacr/document/location.rb
Instance Attribute Summary collapse
-
#county ⇒ Object
Returns the value of attribute county.
-
#district ⇒ Object
Returns the value of attribute district.
-
#neighborhood ⇒ Object
Returns the value of attribute neighborhood.
-
#others ⇒ Object
Returns the value of attribute others.
-
#province ⇒ Object
Returns the value of attribute province.
Attributes inherited from Element
Instance Method Summary collapse
- #build_xml(node, document) ⇒ Object
-
#initialize(args = {}) ⇒ Location
constructor
A new instance of Location.
- #to_xml(builder, document) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Location
Returns a new instance of Location.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/facturacr/document/location.rb', line 16 def initialize(args={}) @province = args[:province] @county = args[:county] @district = args[:district] @neighborhood = args[:neighborhood] @others = args[:others] end |
Instance Attribute Details
#county ⇒ Object
Returns the value of attribute county.
8 9 10 |
# File 'lib/facturacr/document/location.rb', line 8 def county @county end |
#district ⇒ Object
Returns the value of attribute district.
8 9 10 |
# File 'lib/facturacr/document/location.rb', line 8 def district @district end |
#neighborhood ⇒ Object
Returns the value of attribute neighborhood.
8 9 10 |
# File 'lib/facturacr/document/location.rb', line 8 def neighborhood @neighborhood end |
#others ⇒ Object
Returns the value of attribute others.
8 9 10 |
# File 'lib/facturacr/document/location.rb', line 8 def others @others end |
#province ⇒ Object
Returns the value of attribute province.
8 9 10 |
# File 'lib/facturacr/document/location.rb', line 8 def province @province end |
Instance Method Details
#build_xml(node, document) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/facturacr/document/location.rb', line 27 def build_xml(node, document) raise FE::Error.new("location invalid",class: self.class, messages: errors.) unless valid? node = Nokogiri::XML::Builder.new if node.nil? node.Ubicacion do |x| x.Provincia @province x.Canton @county x.Distrito @district x.Barrio @neighborhood unless @neighborhood.nil? x.OtrasSenas @others end end |
#to_xml(builder, document) ⇒ Object
39 40 41 |
# File 'lib/facturacr/document/location.rb', line 39 def to_xml(builder,document) build_xml(builder,document).to_xml end |