Class: MCFDI::Address
Overview
Address Class for transmitter and receptor.
Instance Attribute Summary collapse
-
#city ⇒ Object
Returns the value of attribute city.
-
#country ⇒ Object
Returns the value of attribute country.
-
#interior_number ⇒ Object
Returns the value of attribute interior_number.
-
#location ⇒ Object
Returns the value of attribute location.
-
#neighborhood ⇒ Object
Returns the value of attribute neighborhood.
-
#reference ⇒ Object
Returns the value of attribute reference.
-
#state ⇒ Object
Returns the value of attribute state.
-
#street ⇒ Object
Returns the value of attribute street.
-
#street_number ⇒ Object
Returns the value of attribute street_number.
-
#zip_code ⇒ Object
Returns the value of attribute zip_code.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Address
constructor
A new instance of Address.
-
#original_string ⇒ Object
return original string (cadena original) of the address.
-
#to_x ⇒ Object
return hash with values in spanish for the xml.
Methods inherited from Base
attr_accessor, attributes, #attributes, #to_h
Constructor Details
#initialize(args = {}) ⇒ Address
Returns a new instance of Address.
19 20 21 |
# File 'lib/m_cfdi/address.rb', line 19 def initialize(args = {}) args.each { |key, value| send("#{key}=", value) } end |
Instance Attribute Details
#city ⇒ Object
Returns the value of attribute city.
16 17 18 |
# File 'lib/m_cfdi/address.rb', line 16 def city @city end |
#country ⇒ Object
Returns the value of attribute country.
16 17 18 |
# File 'lib/m_cfdi/address.rb', line 16 def country @country end |
#interior_number ⇒ Object
Returns the value of attribute interior_number.
16 17 18 |
# File 'lib/m_cfdi/address.rb', line 16 def interior_number @interior_number end |
#location ⇒ Object
Returns the value of attribute location.
16 17 18 |
# File 'lib/m_cfdi/address.rb', line 16 def location @location end |
#neighborhood ⇒ Object
Returns the value of attribute neighborhood.
16 17 18 |
# File 'lib/m_cfdi/address.rb', line 16 def neighborhood @neighborhood end |
#reference ⇒ Object
Returns the value of attribute reference.
16 17 18 |
# File 'lib/m_cfdi/address.rb', line 16 def reference @reference end |
#state ⇒ Object
Returns the value of attribute state.
16 17 18 |
# File 'lib/m_cfdi/address.rb', line 16 def state @state end |
#street ⇒ Object
Returns the value of attribute street.
16 17 18 |
# File 'lib/m_cfdi/address.rb', line 16 def street @street end |
#street_number ⇒ Object
Returns the value of attribute street_number.
16 17 18 |
# File 'lib/m_cfdi/address.rb', line 16 def street_number @street_number end |
#zip_code ⇒ Object
Returns the value of attribute zip_code.
16 17 18 |
# File 'lib/m_cfdi/address.rb', line 16 def zip_code @zip_code end |
Instance Method Details
#original_string ⇒ Object
return original string (cadena original) of the address.
24 25 26 27 28 29 30 31 32 |
# File 'lib/m_cfdi/address.rb', line 24 def original_string c = [] self.attributes.each do |k| v = send(k) next unless v.present? c << v end c end |
#to_x ⇒ Object
return hash with values in spanish for the xml.
35 36 37 38 39 40 |
# File 'lib/m_cfdi/address.rb', line 35 def to_x { calle: @street, noExterior: @street_number, noInterior: @interior_number, colonia: @neighborhood, localidad: @location, referencia: @reference, municipio: @city, estado: @state, pais: @country, codigoPostal: @zip_code } end |