Class: FE::Document::Location
- Inherits:
-
Object
- Object
- 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.
Instance Method Summary collapse
- #build_xml(node) ⇒ Object
-
#initialize(args = {}) ⇒ Location
constructor
A new instance of Location.
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Location
Returns a new instance of Location.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/facturacr/document/location.rb', line 20 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.
12 13 14 |
# File 'lib/facturacr/document/location.rb', line 12 def county @county end |
#district ⇒ Object
Returns the value of attribute district.
12 13 14 |
# File 'lib/facturacr/document/location.rb', line 12 def district @district end |
#neighborhood ⇒ Object
Returns the value of attribute neighborhood.
12 13 14 |
# File 'lib/facturacr/document/location.rb', line 12 def neighborhood @neighborhood end |
#others ⇒ Object
Returns the value of attribute others.
12 13 14 |
# File 'lib/facturacr/document/location.rb', line 12 def others @others end |
#province ⇒ Object
Returns the value of attribute province.
12 13 14 |
# File 'lib/facturacr/document/location.rb', line 12 def province @province end |
Instance Method Details
#build_xml(node) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/facturacr/document/location.rb', line 31 def build_xml(node) raise "Location invalid: #{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) ⇒ Object
43 44 45 |
# File 'lib/facturacr/document/location.rb', line 43 def to_xml(builder) build_xml(builder).to_xml end |